345 Commits

Author SHA1 Message Date
Jamie Gennis
2fa0ac2e44 Stagefright: ANW::connect in MediaPlayerService
This change moves the ANativeWindow connect and disconnect logic from
MediaPlayer to MediaPlayerService::Client.

Bug: 5502654
Change-Id: Ifc43b98b01ad8f35d62d7ece43110724ec7fda3d
2011-10-26 18:40:00 -07:00
Jamie Gennis
6607b39baa Stagefright: idle OMX after ANW errors
This change fixes an issue in Stagefright where the state of an OMXCodec
object can get out of sync with the state of the OMX component.  In
particular, if one of the ANativeWindow functions failed and put the
OMXCodec into the ERROR state, this would cause Stagefright to skip
doing the Executing -> Idle transition.  Without this transition the
freeBuffersOnPort call would never be made, and the MediaBuffers would
end up being leaked (which would also leak the Gralloc buffers they
reference).

Bug: 5333695
Change-Id: I85ea0cf92d18e7ef6d35c7d1e2a7b4e2c9745d34
2011-10-19 21:22:19 -07:00
James Dong
07b9ae3312 Add QVGA resolution to CamcorderProfile
Change-Id: Icebbafb68d8164370f98a2c36699845d10ef081b
related-to-bug: 5145483
2011-09-19 19:32:26 -07:00
Eric Laurent
3f0c821740 Merge "Issue 5298399: Lost speech after a crash in gTalk." 2011-09-13 17:50:31 -07:00
Eric Laurent
7e8626fd75 Issue 5298399: Lost speech after a crash in gTalk.
Fixed problem in AudioTrack::restoreTrack_l() causing a permanent
failure if the IAudioTrack interface to AudioFlinger could not be
restored at the first attempt.

Change-Id: I039d4fe2dca8d3baf71f1a6c51119f27a67b6611
2011-09-13 17:33:29 -07:00
Guang Zhu
973f553be4 Make MediaScanner skip certain directories
The list of directories to skip are configurable via setprop.
The main motivation is that some test data folder takes long time
to scan, and media scanner may compete for CPU time against perf
tests therefore skewing the results.

Bug: 5263115
Change-Id: I568213e2a4babf6033021c1d336ef0347c0e3315
2011-09-09 15:36:42 -07:00
Eric Laurent
11e2e5dece Merge "AudioTrack: extend callback thread sleep time" 2011-09-08 16:07:40 -07:00
Eric Laurent
f1d360ac86 AudioTrack: extend callback thread sleep time
Do not force wake up the AudioTrack thread every 10ms if no timed
events (loop, markers..) have to be processed.
This will help reduce power consumption.

Change-Id: Icb425b13800690008dd07c27ffac84739e3dbba3
2011-09-08 15:18:37 -07:00
Glenn Kasten
27f4bbb676 Bug 5270905 fix MediaPlayer with IStreamSource
Change-Id: Ia8a6381a6c88b4a0a1378aab03f5275f0fa1125a
2011-09-07 14:42:37 -07:00
Eric Laurent
b6738fc6a5 Merge "Issue 5247986: Battery drain due to audio wakelock" 2011-09-06 14:53:59 -07:00
Eric Laurent
b0808f9c43 Issue 5247986: Battery drain due to audio wakelock
The problem occurs when activating or deactivating A2DP connection
while SoudPool has a channel active. This can happen quite frequently now
that the UI sound effects are enabled by default.
If PCM data is remaining in the AudioTrack buffer when it is restroyed and
re-created on the new AudioFlinger output thread, this data is flushed.
As a consequence, no underrun or request for new data callback is sent to
SoundPool and the sound channel remains active for ever as the end of the
sample is never detected.

Change-Id: I13e0c11e4ce3f83bff7f58d347ca814b6a86712b
2011-09-06 14:37:20 -07:00
Dave Burke
a28279be32 Handle setDataSource failures properly. #5261671
Change-Id: Iea0aa474d1939db23da9aabdfae2081e834f30d9
2011-09-06 20:39:47 +01:00
Eric Laurent
dca56b9432 Fix issue 5252593: any app can restart the runtime
Replace null device address string by empty sting.

Change-Id: I285c35f3345334e6d2190493b1a8a5aca1a361a4
2011-09-02 15:59:50 -07:00
Dave Burke
fc301b0bb5 Require INTERNET permission for network-based content.
Bug #1870981

Change-Id: Ia3ad166390c4d60cea19c3783895b078a2c4c15f
2011-09-02 11:26:59 +01:00
Eric Laurent
05ce094164 226483: A2DP connected, but music out to speaker
When the A2DP headset is connected, there is a possible
race condition when the audio tracks are moved from
the mixer thread attached to the speaker output to the thread
attached to A2DP output.
As the request to clear the stream type to output mapping cache in
the client process is asynchronous, it is possible that the flag
indicating to the client audio track to re-create the IAudioTrack
on the new thread is processed before the cache is invalidated.
In this case, the track will be attached to the old thread and
music will continue playing over the device speaker instead of being
redirected to A2DP headset.

Change-Id: Ib2ce1eb5320eaff83287b93779061bf4e7a330df
2011-08-30 10:19:38 -07:00
Jean-Michel Trivi
22cb204cbb Bug 4364249 Play position is 0 after flushing AudioTrack
AudioTrack::stop() is not synchronous, so a stop() followed
 by flush(), which is synchronous, will not always report
 a playhead position of 0 after being called.
This CL adds a flag to mark a track as flushed, and report the
 correct playhead position in this state.
Bug 5217011 has been created to address the real issue in the
 future, where flush could be made synchronous, to properly
 address bug 4364249.

Change-Id: Icf989d41a6bcd5985bb87764c287f3edb7e26d12
2011-08-25 17:33:49 -07:00
Rajneesh Chowdury
3ced044154 Fix for 4142219 Don't hard code platform-specific limitations (Jni/ Java)
Also fixes 5118207 add other video codec support for video editor export.

Change-Id: If72427173bd8ff684af07ba00f4425c1deef29c6
2011-08-19 14:34:47 -07:00
Eric Laurent
6752ec80b2 Audio effects: track CPU and memory use separately
Before this change, CPU and memory usage for an audio effect were
registered and checked against the limit by audio policy manager
upon effect instantiation. Even if an effect was not enabled
it would prevent another effect to be created if the CPU load budget
was exceeded, which was too restrictive.

This change adds a method to register/unregister CPU load only when
an effect is enabled or disabled.
It also adds a mechanism to place all effects on the global output mix
in suspend state (disabled) when an effect is enabled on a specific session.
This will allow applications using session effects to have the priority
over others using global effects.

Also fixes some issues with suspend/restore mechanism:
- avoid taking actions when an effect is disconnected and was not enabled.
- do not remove a session from the suspended sessions list when corresponding
effect chain is destroyed.

Change-Id: I5225278aba1ae13d0d0997bfe26a0c9fb46b17d3
2011-08-11 14:33:45 -07:00
Marco Nelissen
c74b93fdf3 Keep effects sessions active when the caller dies.
Don't remove effects until the session they are in goes away or all
AudioEffects have been explicitly released. This allows the control
panel process to die without stopping the effects.

Change-Id: I4496e5df080230ca1af149dec95c1309ab8ea888
2011-08-09 10:21:10 -07:00
Gloria Wang
ba5ddf5cfc Merge "Fix ordering assumption of argument evaluation." 2011-08-02 09:22:05 -07:00
Mathias Agopian
982d2da4ee connect/disconnect is now called from our EGL wrapper
the original connect/disconnect hooks are deprecated
and replace by api_connect/api_disconnect. the original
hooks are no no-ops.
api_connect/api_disconnect is now only called from the
android framework.

Bug: 5057915
Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
2011-08-01 14:06:20 -07:00
Gloria Wang
8f164fe847 Fix ordering assumption of argument evaluation.
No specific order is specified in the C++ standard, but the order of
the calls to Parcel read commands matters.  Move any calls with multiple
reads to local variables.

Fix for bug 5104979.

Change-Id: I709aa040e990d2659e7a3a089f7a42ae812de9ff
2011-08-01 14:01:29 -07:00
Eric Laurent
678cc95903 AudioRecord: Fix getInput()
AudioRecord::getInput() was issuing a query to get a new input stream from
audio policy service instead of returning the cached input stream in AudioRecord.

Change-Id: Ice324b7c60bc0898149023797bcb56a72091b9d3
2011-07-26 20:32:28 -07:00
Eric Laurent
234cef8129 Merge "Added APIs for audio preprocessing" 2011-07-25 14:43:05 -07:00
Eric Laurent
0f7f4ece1b Added APIs for audio preprocessing
Added APIs to control pre processes applied on captured audio.
Those APIs are still hidden until reviewed by API council.

Three types of standard pre processes are supported:
- Automatic Gain Control (AGC) by AutomaticGainControl class
- Acoustic Echo Cancellation (AEC) by AcousticEchoCanceler class
- Noise Suppression (NS) by NoiseSuppressor class

A method is added to AudioEffect class to query audio pre processings
applied by default by the platform on a given AudioRecord session ID.

Change-Id: I0b9fceeb8c704dd06319c3b52b85c96fe871d51d
2011-07-25 14:39:00 -07:00
James Dong
83dd43f45a Do not support still image capture mode for timelapse video recording
related-to-bug: 4973779

Change-Id: Ica665217ab10247b2242acc4e93d4fe9f83e3f45
2011-07-24 10:33:54 -07:00
Pannag Sanketi
897e27bc75 Connect MediaRecorder Native to SurfaceMediaSource
Making a connection from MediaRecorder Native layer to the
SurfaceMediaSource for the purpose of encoding GL Frames. This will be
called from the java side inside the Mobile Filter Framework.

The mediarecorder native layer (client), when set the videosource to
option VIDEO_SOURCE_FRAMES, asks the StageFrightRecorder on the mediaserver
side to create a SurfaceMediaSource object and pass it back as a
sp<ISurfaceTexture> object. Using that, the client side will dequeue and
queue buffers. Connecting the GL Frames to the obtained
sp<ISurfaceTexture> is not part of this CL.

Related to bug id: 4529323

Change-Id: I651bec718dd5b935779e7d7a050b841c2d0b0fcd
2011-07-22 14:17:25 -07:00
James Dong
8a42a55720 Merge "Log setVideoSurface() and setVideoSurfaceTexture() failures." 2011-07-22 10:09:22 -07:00
James Dong
ce78dc5baa Log setVideoSurface() and setVideoSurfaceTexture() failures.
Change-Id: Iaea34e74a0cf569fc85b926949253dea6baa6142
related-to-bug: 5063370
2011-07-21 17:38:18 -07:00
Hong Teng
432fb8ecbe Merge "fix for issue 4142219 Don't hard code platform-specific limitations-jni/java part" 2011-07-21 11:13:43 -07:00
Jeff Brown
5da67f4f69 Merge "Untangle MediaScanner error handling. Bug: 5056917" 2011-07-20 18:03:47 -07:00
Eric Laurent
ae7c092649 Merge "Audio framework: support for audio pre processing" 2011-07-20 17:45:37 -07:00
Jeff Brown
2c70d4a372 Untangle MediaScanner error handling.
Bug: 5056917

Change-Id: I1a7a73579e3ba4e9709459329fc1901a28b0f4b1
2011-07-20 17:33:13 -07:00
Hong Teng
600acf14ff fix for issue 4142219
Don't hard code platform-specific limitations-jni/java part

Change-Id: Icde261b1caf29a8cf552884c97f3c9d0b41741a3
2011-07-20 16:51:39 -07:00
Jamie Gennis
5129b6838b MediaPlayer: add a disconnect from ANativeWindow
This change makes MediaPlayer::disconnect disconnect from the
ANativeWindow once the player has been disconnected.

Change-Id: I6744559030d1edc520cf77402d1f5ce841742340
2011-07-19 14:50:43 -07:00
Jamie Gennis
5a4ab16eba Merge "MediaPlayer: add ANativeWindow (dis)connect calls" 2011-07-18 15:18:43 -07:00
Eric Laurent
464d5b3da2 Audio framework: support for audio pre processing
Audio effect framework is extended to suport effects on
output and input audio path.

AudioFlinger: Support for audio effects and effect chains is
moved from PlaybackThread class to ThreadBase class so that
RecordThread can manage effects.
Effects of type pre processing are allowed on record thread
only. When a pre processing is enabled, the effect interface handle is
passed down to the input stream so that the audio HAL can call the
process function. The record thread loop calls the effect chain process
function that will only manage the effect state and commands and skip the
process function.

AudioRecord: The audio session is allocated before calling getInput() into
audio policy serice so that the session is known before the input theead is
created and pre processings can be created on the correct session.

AudioPolicyService: default pre processing for a given input source are
loaded from audio_effects.conf file.
When an input is created, corresponding effects are created and enabled.

Change-Id: Id17119e0979b4dcf189b5c7957fec30dc3478790
2011-07-18 09:42:57 -07:00
Jamie Gennis
c85ca5d6b5 MediaPlayer: add ANativeWindow (dis)connect calls
This change makes MediaPlayer connect to the ANativeWindow to which it
is going to render video frames and disconnect when it is done.

Change-Id: I88ab5c2fe62493aabdc84a283ff31634f795d415
2011-07-14 17:48:33 -07:00
Andreas Huber
67d464f47e Enable signalling of a stream discontinuity involving a format-change
through IStreamListener.

Change-Id: Ic0409cdc4891ad26b61f2f98bdda3c7fb2e2de6a
related-to-bug: 5022434
2011-07-13 09:47:09 -07:00
Jeff Brown
bd882b1c87 Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Eric Laurent
5cc0526339 Moved and renamed effect API header files
Moved specific effect header files to
system/media/audio_effects/include/audio_effects
and renamed to lower case (effect_xxx.h).

Change-Id: Icfc2264bfd013cab0395d7e310ada636b9fe3621
2011-07-07 15:25:51 -07:00
Wu-cheng Li
42419ce28a Add framework support for camcorder zoom.
The purpose of ICameraRecordingProxy and ICameraRecordingProxyListener is to
allow applications using the camera during recording.

Camera service allows only one client at a time. Since camcorder application
needs to own the camera to do things like zoom, the media recorder cannot
access the camera directly during recording. So ICameraRecordingProxy is a proxy
of ICamera, which allows the media recorder to start/stop the recording and
release recording frames. ICameraRecordingProxyListener is an interface that
allows the recorder to receive video frames during recording.

ICameraRecordingProxy
  startRecording()
  stopRecording()
  releaseRecordingFrame()

ICameraRecordingProxyListener
  dataCallbackTimestamp()

The camcorder app opens the camera and starts the preview. The app passes
ICamera and ICameraRecordingProxy to the media recorder by
MediaRecorder::setCamera(). The recorder uses ICamera to setup the camera in
MediaRecorder::start(). After setup, the recorder disconnects from camera
service. The recorder calls ICameraRecordingProxy::startRecording() and
passes a ICameraRecordingProxyListener to the app. The app connects back to
camera service and starts the recording. The app owns the camera and can do
things like zoom. The media recorder receives the video frames from the
listener and releases them by ICameraRecordingProxy::releaseRecordingFrame.
The recorder calls ICameraRecordingProxy::stopRecording() to stop the
recording.

The call sequences are as follows:
1. The app: Camera.unlock().
2. The app: MediaRecorder.setCamera().
3. Start recording
   (1) The app: MediaRecorder.start().
   (2) The recorder: ICamera.unlock() and ICamera.disconnect().
   (3) The recorder: ICameraRecordingProxy.startRecording().
   (4) The app: ICamera.reconnect().
   (5) The app: ICamera.startRecording().
4. During recording
   (1) The recorder: receive frames from ICameraRecordingProxyListener.dataCallbackTimestamp()
   (2) The recorder: release frames by ICameraRecordingProxy.releaseRecordingFrame().
5. Stop recording
   (1) The app: MediaRecorder.stop()
   (2) The recorder: ICameraRecordingProxy.stopRecording().
   (3) The app: ICamera.stopRecording().

bug:2644213

Change-Id: I15269397defc25cbbcae16abc071c8349c123122
2011-06-27 15:44:57 +08:00
Gloria Wang
1e1b13e62e - Public part of the Metadata API.
- Modify the media framework test for Metadata.

Change-Id: Ib8fa4991f114e1bb88a17ca662844b9b8e1d0faf
2011-06-23 15:28:36 -07:00
Glenn Kasten
db262e6cf0 Merge "Fix warnings for uninitialized local variables" 2011-06-23 09:00:03 -07:00
Eric Laurent
e2ac799dfc Merge "Added audio_bytes_per_sample() helper function" 2011-06-23 08:08:20 -07:00
Glenn Kasten
028ab996e5 Fix warnings for uninitialized local variables
Change-Id: Ic9b03b0fd215444e76c7b7bebb385f7831c557e0
2011-06-22 16:18:04 -07:00
Eric Laurent
c310dcbed6 Added audio_bytes_per_sample() helper function
Change-Id: Ibfcd75c4c241a53d5f052c25ada091904991048a
2011-06-17 14:19:55 -07:00
Glenn Kasten
79cd8ba46b Remove unneeded #include <sys/resource.h>
Suggested in code review for previous change.

Change-Id: Ic3225b240367dc6c9bf56fb4498fb8a0f9f806ec
2011-06-15 07:30:19 -07:00
Dima Zavin
290029d19a audio: update for audio/audio_policy header names/locations
Change-Id: I36c49352eee57559403cd1597f56a8485a360289
Signed-off-by: Dima Zavin <dima@android.com>
2011-06-13 18:16:26 -07:00
Dianne Hackborn
4bb506afeb am 15e9d474: am 88748e6d: am d86302df: Quiet the log.
* commit '15e9d474d1033adbedc8632309df26c3d6dfaee3':
  Quiet the log.
2011-06-10 14:08:45 -07:00