619 Commits

Author SHA1 Message Date
Glenn Kasten
85b65f2008 Merge "Miscellaneous code cleanup in audio framework" 2011-04-06 13:03:11 -07:00
Glenn Kasten
ed0079dddd Miscellaneous code cleanup in audio framework
Changes:
 - Move declaration of kClassPathName to top of file so it can be used
   in more than one place, instead of "android/media/AudioSystem".
 - Make private methods static.
 - Add comment to stream_type, audio_mode, force_use types that they must match
   values in AudioSystem.java.
 - Add comment about unused types mp3_sub_format and vorbis_sub_format.
 - Fix typos.
 - Use @ in javadoc comments.
 - Delete dead APIs setMode, getMode, setRouting, getRouting in AudioSystem.java
   (they are all hidden, deprecated, and unused by rest of framework)
 - Delete unused private log method.
 - Fix pathname for android_media_AudioSystem.cpp.
 - Improve code formatting for space after == and !=.
 - Add logging of delta for changing audio policy manager ref count.

Change-Id: I18037c7beb8ab76d1fda08c11e589f6e591d36e1
2011-04-06 10:24:18 -07:00
Mathias Agopian
fb96b5ece3 Remove unused references to ISurface
Change-Id: I542806b5c91c525ed7cde821f6963f1e020ddf1a
2011-04-04 21:09:55 -07:00
Andreas Huber
cabb7da712 Support for divx files, i.e. mpeg 4 video + mpeg audio layer III in .avi files
Change-Id: I6e1e989c43300ddb0d341e3e9183cdccd69eeae6
related-to-bug: 4192562
2011-03-30 13:13:25 -07:00
Andreas Huber
a2e57ca650 Stagefright DataSources now expose the underlying content mime type.
Use that mime type to determine if we should do upfront buffering at the start of
playback and don't for audio streams to ensure playback starts fairly instantly.

Change-Id: If21e36d1b024f0e5c723911bceadaa2e0307ab42
related-to-bug: 4090916
2011-03-30 11:15:27 -07:00
Iliyan Malchev
40c364136f frameworks/base: some camera-interface cleanup
Methods getNumberOfVideoBuffers() and getVideoBuffer() as well as struct
image_rect_struct are no longer used (instead, the necessary information is
passed through ANativeWindow.)

Change-Id: If4b11446fc9ccbde1f6b45bc70c0d0b8e54376eb
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-03-28 16:28:57 -07:00
Andreas Huber
4dc482daac Delay signaling the end of audio playback until all frames have actually played.
Change-Id: I1fa07358a885a818fd0a5d7da425740f86095e10
related-to-bug: 3404000
2011-03-22 13:18:09 -07:00
Andreas Huber
5b7ced6a4e Support passing headers to MediaMetadataRetriever's setDataSource API
Change-Id: Ib1a5c08fc5034cac05034db27007a35c9b660b26
related-to-bug: 3506316
2011-03-21 11:13:59 -07:00
James Dong
7fc8b4f5ff Better organize media recorder error and information event and types
Change-Id: I45f1f953596985494725525c1fabf57eccc19175
2011-03-18 13:27:39 -07:00
James Dong
be3c82f25d am 782ffe91: am 9c0c5b56: am 2f1f2248: Fix missing AOSP copyright headers for a bunch of media framework files
* commit '782ffe91da665c6b1fb9e297faa6e0dc6035f40c':
  Fix missing AOSP copyright headers for a bunch of media framework files
2011-03-17 12:38:58 -07:00
James Dong
2f1f2248c8 Fix missing AOSP copyright headers for a bunch of media framework files
bug - 4119349

Change-Id: If5924e16a5f596d5d73d9beb66eaf5ac9a6f0e50
2011-03-17 11:10:40 -07:00
James Dong
ed73246b32 Add memory leak tracking/debugging code to drm server
bug - 4099038

Change-Id: I6c048eaf3d7f34bc144b8daaa5fdef1ed474af66
2011-03-14 18:48:19 -07:00
Glenn Kasten
6dd429efe2 am 055066e1: am 92f2f3ff: Merge "Bug 3012968 DRM output control" into honeycomb-mr1
* commit '055066e1e77d944383360d50057f5b8187f23c0b':
  Bug 3012968 DRM output control
2011-03-11 08:46:40 -08:00
Glenn Kasten
b8763f60b4 Bug 3012968 DRM output control
Modifies Stagefright to verify that there is a hardware-protected path
to video sink for DRM content.

Change-Id: I18b8741390e803a05a88c7f180b860a24ba88a10
2011-03-10 19:16:40 -08:00
Gloria Wang
ae7752798a Fix for bug 3477330
This patch fixs a crash bug caused by using a NULL DecryptHandle pointer.
Fix by using sp<DecryptHandle> instead.

Change-Id: Icbd59858385e8256125a615a3c82656b25319d44
2011-03-10 16:20:48 -08:00
Eric Laurent
18632db49a am 2dc78477: am cc34967f: Merge "Fix issue 3439872: video chat and bluetooth SCO" into honeycomb-mr1
* commit '2dc78477364bd4accb9a603baaafca9a5523dcec':
  Fix issue 3439872: video chat and bluetooth SCO
2011-03-09 11:00:22 -08:00
Eric Laurent
421ddc014b Fix issue 3439872: video chat and bluetooth SCO
This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
2011-03-08 16:33:15 -08:00
Andreas Huber
c4c38fc1ea Added more metadata published by the MediaMetaDataRetriever
- presence of audio/video content
- video dimensions
- avg. bitrate

Change-Id: Ie6d478a3c2d0bb6bebaea99ac0a20a4c17808934
related-to-bug: 3506316
2011-03-04 10:32:36 -08:00
Gloria Wang
396f6de660 Merge "- To track the usage of all audio output devices - To track the currently used audio device - The devices are separated as speaker and other audio devices - Provide the collected data to battery application through pullBatteryData()" 2011-03-02 19:51:04 -08:00
Gloria Wang
9b3f1521b5 - To track the usage of all audio output devices
- To track the currently used audio device
- The devices are separated as speaker and other audio devices
- Provide the collected data to battery application through pullBatteryData()

Change-Id: I374c755266b5ac6b1c6c630400f4daf901ea8acc
2011-03-02 16:53:24 -08:00
Andreas Huber
669ad13de9 Allow optional specification of a PTS timestamp when signalling a discontinuity.
If present, rendering will be suppressed until reaching the timestamp.

Change-Id: Ic64bdf4225063c5a4d042ea9809960b843a46d19
related-to-bug: 3489454
2011-03-02 15:38:32 -08:00
James Dong
797e4f1dce Get rid of redundant media profiles
bug - 3330679

Change-Id: Idc55aea32746c0c57552c5e15a289681421aa859
2011-03-01 15:58:59 -08:00
Jamie Gennis
e6befb88bd Add an OMX IL API for querying buffer usage flags.
This change defines an OpenMAX IL API for querying from the IL component
the gralloc buffer usage flags that should be used to allocate the
buffers.  It also adds the Stagefright plumbing for using the new OMX IL
API.

Change-Id: I046b5e7be70ce61e2a921dcdc6e3aa9324d19ea6
Related-Bug: 3479027
2011-02-28 12:12:20 -08:00
Glenn Kasten
cc562a3576 Bug 3438258 Add SurfaceTexture as MediaPlayer sink
This change enables the use of a SurfaceTexture in place of a Surface
as the video sink for an android.media.MediaPlayer. The new API
MediaPlayer.setTexture is currently hidden.

This includes:
 - New Java and C++ interfaces
 - C++ plumbing and implementation (JNI, Binder)
 - Stagefright AwesomePlayer and NuPlayer use ANativeWindow
   (either Surface or SurfaceTextureClient)

Change-Id: I2b568bee143d9eaf3dfc6cc4533c1bebbd5afc51
2011-02-23 15:02:56 -08:00
Gloria Wang
87e639bc15 Merge "- Add method in MediaPlayerService to collect and pull codec usage (duration) for the battery app - Collect MediaPlayer decoding usage data" 2011-02-23 09:58:33 -08:00
Gloria Wang
d211f41f76 - Add method in MediaPlayerService to collect and pull
codec usage (duration) for the battery app
- Collect MediaPlayer decoding usage data

Change-Id: I0ef4e32b6a041ba1fe73c19f9c67185c61d03965
2011-02-22 22:42:05 -08:00
Andreas Huber
8c7c6dc413 Support more MPEG4-LATM audio functionality.
related-to-bug: 3474610

Change-Id: I6dab40e8b465922c62be9ee7f168718822c6caac
Now skipping extra header that the spec claimed shouldn't be present in LATM...
2011-02-22 13:21:38 -08:00
James Dong
cbeebb194b A/V synchronization at the beginning of a recording session
o do not use edts/elst boxes since these optional boxes are ignored
o manipulate the first video/audio frame duration to make sure that the rest
  of the audio/video is in sync (ideally, we should only manipulate
  the vidoe frame duration, not the audio)
o reduce the initial audio mute/suppression period, which is used to
  eliminate the "recording" sound.

bug - 3405882 and 3362703

Change-Id: Ib0acfb4f3843b365157288951dc122b006299c18
2011-02-17 14:43:16 -08:00
James Dong
d33a4ccb5c Decouple AudioRecord read and audio encoding
bug - 3313754

Change-Id: I951dd0e21e34aa1412c391f003bc32103d0424b0
2011-02-16 11:23:21 -08:00
Gloria Wang
94f4019994 Merge "Add AAC extractor" 2011-02-15 17:22:01 -08:00
Gloria Wang
c5b0abf900 Add AAC extractor
Change-Id: Iedb08525ac72e65ba98e5c791734da0720a0e3f6
2011-02-15 17:16:22 -08:00
James Dong
fe84cf13cd Make available h263 DSI information from MPEG4Extractor
bug - 3446863

Change-Id: Idbaf7a564d544784fdbc36ed0339c98a519adc88
2011-02-11 15:25:03 -08:00
Glenn Kasten
8b4b97a14a Bug 3352047 Wrong message when adjusting volume
Add hidden AudioManager.getDevicesForStream and output device codes.

Change-Id: I4d1c1d3b6a077cd117720817d1f733dda557b947
2011-02-10 14:37:42 -08:00
James Dong
f6a2bff0c9 Reduce blocking time in file write
bug - 3418787

Change-Id: I4723662bf46ed07271be8468f84ae5d93cb793fa
2011-02-09 15:44:32 -08:00
Andreas Huber
5ed9a80571 Merge "Handle some edge cases when seeking while starting up OMXCodec" 2011-02-08 13:15:37 -08:00
Andreas Huber
b928983334 Handle some edge cases when seeking while starting up OMXCodec
These were exposed by the new preview-seekframe while paused code.
In particular, the codec may have been in state RECONFIGURING when attempting
to seek, or we may have initiated flushing of the output port and this may not
have completed yet by the time we want to reconfigure the output port.

Change-Id: Id7640ade11dbc7205a22f648ea0b5e3e9b49cf4b
related-to-bug: 3392259
2011-02-08 13:10:25 -08:00
Gloria Wang
c2dc4729e3 - Do not use global DrmManagerClient
- Release the DrmManagerClient and DecryptHandle in DataSource
Fix for bug 3429811

Change-Id: I549f72b75225751877eb0e630ce8098f8ec6316f
2011-02-07 15:10:33 -08:00
Andreas Huber
6760f9832d Improvements/fixes to ACodec.
- Make sure ACodec reverts its state when it's shutdown
- Defer "resume" to after handling the OutputPortSettingsChange

- If the OMX_EventPortSettingsChanged event comes in while we're flushing, defer it
  and make sure the output port can be disabled by deleting all buffers not already
  owned by the component.

Change-Id: I1f8cdffa71237b57d4275a48b834647a7b263e8b
2011-02-04 10:12:26 -08:00
Eric Laurent
2e8fbebff4 am 6f1bd261: am 9c0a1003: Merge "Fix issue 3371080" into honeycomb
* commit '6f1bd261b7fd86ac7817ca061dfb55b95150b836':
  Fix issue 3371080
2011-02-03 17:18:46 -08:00
Glenn Kasten
f9f223edb4 Bug 1804058 FLAC extractor
Note: dependent on external/flac for libFLAC

Implemented and tested:
 * FLAC container
 * mono and stereo
 * standard sample rates
 * standard bit depths
 * sniffer
 * media scanner
 * Vorbis comment metadata including album art
 * random access seeking with "torture test"
 * web browser integration for audio/flac (not audio/x-flac), but
   note that most web servers don't correctly report the MIME type

Not implemented:
 * 24-bit to 16-bit dither or noise shaping in AudioFlinger
 * 96 kHz to 44.1 or 48 kHz downsampling low pass filter in AudioFlinger
 * replay gain is better done in AudioFlinger
 * multi-channel, would need AudioFlinger support
 * Ogg container, does not seem to be very popular yet

Change-Id: I300873e8c0cfc2e95403d9adb5064d16a2923f17
2011-02-03 13:39:10 -08:00
Eric Laurent
25101b0b9a Fix issue 3371080
Modified default volume control logic in AudioService:
1 IN_CALL volume if in video/audio chat
2 NOTIFICATION if notification is playing or was playing less than 5s ago.
3 MUSIC

Modified silent mode:
- now also affect MUSIC stream type
- entering silent mode when VOL- hard key is pressed once while selected
stream volume is already at 0 (except for VOICE_CALL stream).
- exiting silent mode when pressing VOL+ hard key while in silent mode

Play sound FX (audible selections, keyboard clicks) at a fixed volume.

Modified audio framework:
- isStreamActive() method now implemented in AudioPolicyManagerBase (previously AudioFlinger)
- iStreamActive() now specifies a time window during which the stream is considered
active after it actually stopped.

Change-Id: I7e5a0724099450b9fc90825224180ac97322785f
2011-02-03 09:26:24 -08:00
James Dong
5f3ab06e90 Make sure that key frame is generated for timelapse video recording if there are at least two input video frames from camera source.
This will fix the stop failure issue where we have to wait n * time_interval before a key frame can be received by the file writer, where
 o n is the actual number of buffers advertised by the video encoder
 o time_interval is the interval settings for timelapse video recording
   specifying the time distance between neighboring input video frames

The fix includes two parts:
o OMXCodec will not submit all n buffers at one time, but instead submit one input
  frame at one time if it become available.

o Timelapse camera source made available the first two input frames and do not skip
  them so that the first compressed output frame data can be received regardless
  the specified time_interval

bug - 3367659

Change-Id: Ia68cc2cb0d71aa7dc54540e9ad82fae911ad530b
2011-01-26 12:11:22 -08:00
Andreas Huber
2ffbb18053 Protect notification callback parameters with a mutex.
This avoids the race condition where notifications are dispatched to a NULL receiver
after notifications have been disabled.

Change-Id: I6d351ffbee97616e2c35559c132a6c5e6a66948a
related-to-bug: 3394139
2011-01-26 11:20:42 -08:00
Mike Lockwood
8151dc3229 StagefrightMediaScanner: Close metadata retriever after we are done scanning
This prevents the mediaserver from leaking a file descriptor after
the media scanner runs

BUG: 3373546

Change-Id: I82a8bae82306de3da56a5c7da5b03ecf106a4efc
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-25 15:20:04 -08:00
Andreas Huber
5e9dc94a3c Properly rotate video that's marked as such and decoded to a surface.
Change-Id: I1e9144db3447e58c99aac3f47702ad471678789c
related-to-bug: 3378148
2011-01-21 14:32:31 -08:00
Andreas Huber
19922adceb Some tweaks to HTTP live / nuplayer behaviour
- play audio-only streams again
- workaround for malformed streams that switch PIDs across bandwidths
- attempt to pick a different bandwidth stream if the previously chosen one appears
  to be malformed/unsupported.

Change-Id: I426d0a40dc725aa242f619d4c9d048b69aca55c9
related-to-bug: 2368598
2011-01-21 10:34:40 -08:00
James Dong
08adfd29ae Fix the presentation video resolution when it is different from the actual image resolution of the video.
bug - 3352413

Change-Id: I8f08f3896e9fb90f09119dccdb88b82af60f79f2
2011-01-19 08:33:07 -08:00
Dharmaray Kundargi
3b3cddccc1 integrate videoeditor preview player.
Change-Id: I83084f494605c8e6f4d198afa8c36f9e29579667
2011-01-16 16:43:20 -08:00
James Dong
11eab056dd Publish MediaMetadataRetriever.java as public API
o Removed setMode() methods and related mode constants
o Removed some of the unused the metadata keys
o Updated the javadoc

o part of a multi-project change.

bug - 2433195

Change-Id: I5ed167f1fd6a53cb143b7dc385b149431d434438
2011-01-12 14:14:11 -08:00
Andreas Huber
748ba9a951 Merge "NuPlayer now properly sends MEDIA_SET_VIDEOSIZE notifications." into honeycomb 2011-01-10 11:26:38 -08:00