summaryrefslogtreecommitdiffstats
path: root/media/libmedia
Commit message (Collapse)AuthorAgeFilesLines
* soundpool: allocate shared memory heap by clientEric Laurent2013-09-244-53/+111
| | | | | | | | | | | | | | | | | | | | | | | Current SoundPool implementation allocates the shared memory heap containing decoded PCM samples in mediaserver process. When mediaserver process crashes, the shared memory heaps allocated by AudioCache cannot be mapped anymore in the new instance of mediaserver. This causes a silent failure to end playback of new sounds because AudioFlinger believes the new AudioTracks are opened in streaming mode and not static mode: it sees a NULL shared memory pointer when the track is created. The fix consists in allocating the memory heap in the client process. Thus the heap is not lost when mediaserver restarts. The global memory usage is the same as this is shared memory. Also added a way to detect that a shared memory is passed when the track is created but cannot be mapped on mediaserver side. Also fix a crash in SoundPool when ALOGV is enabled. Bug: 10894793. Change-Id: Ice6c66ec3b2a409d75dc903a508b6c6fbfb2e8a7
* Merge "Add support for level measurements in Visualizer" into klp-devJean-Michel Trivi2013-09-231-0/+68
|\
| * Add support for level measurements in VisualizerJean-Michel Trivi2013-09-231-0/+68
| | | | | | | | | | | | | | | | | | New commands to set a measurement mode and perform peak + RMS measurements. Bug 8413913 Change-Id: Ib25254065c79d365ebb34f9dc9caa0490e2d300d
* | AudioTrack: fix music resumeEric Laurent2013-09-232-4/+6
|/ | | | | | | | Fix regression introduced by commit 5a6cd22 in AudioTrack resume: the callback thread was not signaled if paused internaly. Bug: 10895013. Change-Id: Ic356b115132d6fccbcee2d9bb855e92671dc20c5
* Merge "Revert "Workaround slow AudioTrack destruction"" into klp-devGlenn Kasten2013-09-201-23/+0
|\
| * Revert "Workaround slow AudioTrack destruction"Glenn Kasten2013-09-201-23/+0
| | | | | | | | | | | | This reverts commit 8bbbd7da02fac3de40139af19f7cf7a7cc3cc824. Change-Id: I269a6c445cbce33451b6a9e74223e36e6abbdbe0
* | Fix slow AudioTrack and AudioRecord destructionGlenn Kasten2013-09-202-48/+59
|/ | | | | | | | | | | | | | | | | | | | There were two causes for the slowness: When thread was paused, it used nanosleep and sleep. These usually run to completion (except for POSIX signal, which we avoid because it is low-level). Instead, replace the nanosleep and sleep by condition timed wait, as that can be made to return early by a condition signal. Another advantage of condition timed wait is that a condition wait was already being used at top of thread loop, so it is a simpler change. The AudioRecord destructor was missing a proxy interrupt that was correct in AudioTrack. This proxy interrupt is needed in case another thread is blocked in proxy obtainBuffer. Does not address the 1 second polling for NS_WHENEVER. Bug: 10822765 Change-Id: Id665994551e87e4d7da9c7b015f424fd7a0b5560
* Workaround slow AudioTrack destructionGlenn Kasten2013-09-181-0/+23
| | | | | Bug: 10809586 Change-Id: I5f30d4deb1233e8ade8967568e40684ef680c395
* Partial fix for SoundPool not terminatingGlenn Kasten2013-09-181-2/+2
| | | | | | | | | | | SoundPool was waiting for EVENT_UNDERRUN only to indicate end of clip. In J, AudioTrack delivered both EVENT_UNDERRUN followed by EVENT_BUFFER_END. However, as of K, AudioTrack is only delivering EVENT_BUFFER_END (this lack of EVENT_UNDERRUN is another bug which still needs to be fixed). The workaround is to also respond to EVENT_BUFFER_END in SoundPool. Bug: 10787103 Change-Id: Id68a23bddd6dd9df6c49c55138197260d71ca468
* Fix underruns when fast track denied due to SRCGlenn Kasten2013-09-172-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | OpenSL ES requests a fast track. If sample rate conversion is needed, the request is denied by server, and a larger client buffer is used to handle the higher latency of a normal track. However the client notification period was calculated based on buffer being divided into 2 sub-buffers. That resulted in the notification period being too long. The server pulls chunks that are smaller than half the total buffer. So now the client uses 3 sub-buffers when there is SRC. Also removed the 'defer wake' optimization because it was incorrect. This optimization attempted to reduce the number of wakeups of client, when server releaseBuffer knows that another releaseBuffer will be following. But there is no way for the first releaseBuffer to predict how soon the second releaseBuffer will occur. In some cases it was a long time, and the client underran. So now the client is woken up immediately if the total number of available frames to client is >= the minimum number the client wants to see (the notification period). Also fix bug where minimum frame count was not being used in the calculation of notification period. Bug: 10342804 Change-Id: I3c246f4e7bc3684a344f2cf08268dc082e338e2a
* Fix SoundPool.play() loopingGlenn Kasten2013-09-111-2/+2
| | | | | | | | | | | | This is done by configuring SoundPool for shared memory and fast track. Previously SoundPool used a streaming track, and looping in streaming mode relied on the ability to loop the most recently enqueued data. That 'feature' was lost in the new implementation of streaming, so we're now switching from streaming mode to shared memory mode. Shared memory mode had always been desired, but was blocked by bug 2801375 which is fixed now. Bug: 10171337 Change-Id: I2a938e3ffafa2a74d5210b4198b50db20ad5da0e
* Merge "wifi-display: do not use HDCP's encryptNative method if its ↵Chong Zhang2013-09-041-0/+16
|\ | | | | | | unsupported" into klp-dev
| * wifi-display: do not use HDCP's encryptNative method if its unsupportedChong Zhang2013-09-031-0/+16
| | | | | | | | | | Bug: 10609422 Change-Id: I005f1d04a4191b1503b5f3e895a98b8d6560c402
* | Fix miscellanous AudioTrack::getTimestamp() bugsGlenn Kasten2013-09-031-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check that get_presentation_position is non-NULL before calling. AudioTrack::getTimestamp not implemented for fast tracks. Fix typo in Track::getTimestamp(). Fix bugs in AudioTrack::getTimestamp after stop: - getTimestamp while stopped is not allowed. - stop, start, getTimestamp now returns the correct value. Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
* | Instantiate SingleStateQueue<AudioTimestamp>Glenn Kasten2013-09-032-0/+3
|/ | | | | | as typedef AudioTimestampSingleStateQueue and use it in MonoPipe. Change-Id: Idaebb362bd9d0a81a7ed83792ab9369dc37c0e74
* Merge "Add IAudioTrack::getTimestamp()" into klp-devGlenn Kasten2013-08-302-11/+36
|\
| * Add IAudioTrack::getTimestamp()Glenn Kasten2013-08-292-11/+36
| | | | | | | | | | | | | | | | | | | | with dummy implementation in AudioFlinger::TrackHandle, and implement AudioTrack::getTimestamp() using IAudioTrack. Also document invariant that mAudioTrack and control block are always non-0 after successful initialization. Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
* | Merge "New AudioTrack C++ API for audio timestamps" into klp-devGlenn Kasten2013-08-291-0/+5
|\ \ | |/
| * New AudioTrack C++ API for audio timestampsGlenn Kasten2013-08-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new API is intended to replace latency(), especially for A/V sync. The application will receive periodic timestamp notifications. The period is unspecified, but will likely be more frequent after a pause or stop, set position, underrun, display on/off change, route change, or when audio framework notices drift. It will be up to the higher level application (e.g. Stagefright) to reconstruct a clock that updates more frequently. The current latency() method doesn't indicate when latency changes due to screen on/off state, route changes, etc. Includes squahsed change-Id: I2082f8752040be0c234b1a6f1be2e269abf2ce7c Dummy implementation of AudioTrack:getTimestamp() Rename AudioTrack::Timestamp to AudioTimestamp. Renaming and pulling up to a higher level allows more modules to use it. Change-Id: Ibf7f6a207c3f8d8697f25ede2cd5200697fadb86 (cherry picked from commit dd69eb893867634fd169c03204a6ad7c74b351e7)
* | AudioTrack: fix write retries for compressed audioEric Laurent2013-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | When the amount of frames that can be written to the buffer is less than requested, AudioTrack::processAudioBuffer() estimates the time needed to free the missing amount of frames and asks the callback thread to sleep. This behavior is not possible for compressed audio and should not be enabled for offloaded tracks. Change-Id: I5b657283cfba06254c9ac0ea9b447467cce7eb61
* | AudioTrack: fix unwanted underrun when restartingEric Laurent2013-08-281-0/+3
|/ | | | | | | | | | | When restarting an AudioTrack from stopped state, it is necessary to force refresh of mRemainingFrames by processAudioBuffer() as the last write before stop() could be partial. No doing so will lead into unnecessary sleep before filling the non contiguous part of the buffer returned by obtainBuffer() when processAudioBuffer() is executed for the first time after start(). Change-Id: Id703f8dc092a6f07c905eee194054b4a978f979d
* Merge "wifi-display: pass session info to wifi display settings" into klp-devChong Zhang2013-08-231-2/+4
|\
| * wifi-display: pass session info to wifi display settingsChong Zhang2013-08-211-2/+4
| | | | | | | | | | | | Bug: 9371882 Change-Id: I9e4b8c2154b03ce8ff3e14c465a5224bb6e8db9a
* | Merge "MediaPlayer: add listener for raw track data" into klp-devChong Zhang2013-08-231-0/+3
|\ \
| * | MediaPlayer: add listener for raw track dataChong Zhang2013-08-191-0/+3
| | | | | | | | | | | | | | | | | | Bug: 10326117 Change-Id: I2c0bdf8adc67b11f8dc633423bee66897548f181
* | | Merge "Add ability to test supported content types to MediaDrm" into klp-devJeff Tinker2013-08-221-2/+5
|\ \ \ | |_|/ |/| |
| * | Add ability to test supported content types to MediaDrmJeff Tinker2013-08-221-2/+5
| |/ | | | | | | | | bug: 10244066 Change-Id: I317f05b146db962c271893f6208890a5a6c396f1
* | AudioSystem: new audioflinger restart detectionEric Laurent2013-08-191-0/+8
|/ | | | | | | | | Add a specific method to AudioSystem for AudioService to poll for AudioFlinger service restart instead of relying on current callback mechanism which is flaky. Bug: 9693068. Change-Id: Ie88bc9d25033503bc5cd2fa9d8c754d0f8045b8f
* Fix potential leak of audio input handle.Jeff Brown2013-08-091-61/+42
| | | | | | | | | | | | | The audio input handle is ultimately owned by the audio recorder object but it could be dropped on the floor if an error occurred before that object was fully initialized. Rearranged some of the argument validation and merged getInput_l with openRecord_l to simplify the code and prevent such a leak from occurring. Bug: 10265163 Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2
* Fix regression for AudioRecord streaming callback modeGlenn Kasten2013-08-081-6/+11
| | | | | | | | | The notification period (frequency of client wakeups) was broken in streaming callback mode. Fast tracks were OK, but non-fast tracks with normal latency weren't getting woken up at all. Bug: 10222943 Change-Id: Ife9a2f57fa73c6eb921f1c5ba62de0bfcc20557b
* Merge "IOMX: add updateGraphicBufferInMeta method for metadata mode"Lajos Molnar2013-08-061-0/+33
|\
| * IOMX: add updateGraphicBufferInMeta method for metadata modeLajos Molnar2013-08-061-0/+33
| | | | | | | | | | | | | | | | | | This is used to set the handle in the metadata buffer that is valid in the mediaserver process, as well as to keep a reference for the graphic buffers in BufferMeta. Change-Id: I46bb68d8bed894f357eeeb25368360d11b276634 Signed-off-by: Lajos Molnar <lajos@google.com>
* | Merge "AudioRecord notification frames"Glenn Kasten2013-08-061-4/+27
|\ \
| * | AudioRecord notification framesGlenn Kasten2013-08-021-4/+27
| | | | | | | | | | | | Change-Id: I76ec536d1504eb9a558178b62bf225aace4b40d1
* | | Merge "AudioRecord::openRecord_l use flags"Glenn Kasten2013-08-061-2/+14
|\ \ \ | |/ /
| * | AudioRecord::openRecord_l use flagsGlenn Kasten2013-08-021-2/+14
| | | | | | | | | | | | | | | | | | Use the flags to determine input parameters for IAudioFlinger::openRecord. Change-Id: I98d2726503af75c8830ce80ceaf3b94a755b342f
* | | Merge "Reject unprepared MediaPlayers"Marco Nelissen2013-08-061-0/+7
|\ \ \
| * | | Reject unprepared MediaPlayersMarco Nelissen2013-08-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't allow a MediaPlayer that has been reset() or release()d to be used as the argument to setNextMediaPlayer. Change-Id: I47da1460ec3742f5b2bd7b79e7998b290032d5a1
* | | | Merge "AudioRecord::openRecord_l now take flags"Glenn Kasten2013-08-061-2/+3
|\ \ \ \ | | |/ / | |/| |
| * | | AudioRecord::openRecord_l now take flagsGlenn Kasten2013-08-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new parameter 'flags' of type audio_input_flags_t will be used for requesting a fast track, but is currently ignored. Change-Id: If68dfda8b2d4eaaca42927d721b4630c47f71f3b
* | | | Merge "IAudioFlinger::openRecord track_flags_t flags is in/out"Glenn Kasten2013-08-052-4/+11
|\ \ \ \ | |/ / /
| * | | IAudioFlinger::openRecord track_flags_t flags is in/outGlenn Kasten2013-08-022-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | This will allow AudioFlinger to tell client it is denying a request. Change-Id: Iff2be3ad6636371bbda9c9899a283c94620c1f06
* | | | Merge "AudioRecord::set and constructor now take flags"Glenn Kasten2013-08-051-2/+6
|\ \ \ \ | |/ / /
| * | | AudioRecord::set and constructor now take flagsGlenn Kasten2013-08-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new optional parameter 'flags' of type audio_input_flags_t will be used for requesting a fast track. Change-Id: Ia7e070cb57c833e608352da354fb30dc26df6918
* | | | Merge "AudioRecord callback thread waits for priority boost"Glenn Kasten2013-08-051-0/+20
|\ \ \ \ | |/ / /
| * | | AudioRecord callback thread waits for priority boostGlenn Kasten2013-08-021-0/+20
| |/ / | | | | | | | | | Change-Id: Iae38fa4ac20a45751566169213a08a15deb0a2f6
* | | Merge "AudioRecord has no default sample rate"Glenn Kasten2013-08-051-1/+2
|\ \ \
| * | | AudioRecord has no default sample rateGlenn Kasten2013-08-021-1/+2
| |/ / | | | | | | | | | Change-Id: I72feefdd6f3a623fd3669b80d4b264518fdc0929
* | | Recording of non-linear formats is not supportedGlenn Kasten2013-08-021-9/+5
|/ / | | | | | | | | | | Such formats are already rejected in AudioRecord::set() Change-Id: I5ba1fd9e4cd659e5226c75aa4f63e52f655e0521
* | Report underruns for fast tracks alsoGlenn Kasten2013-07-311-0/+19
|/ | | | | | | | | | | | | | | | | | | | | | | This fixes a regression that was introduced earlier by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 called "New control block for AudioTrack and AudioRecord". That commit broke underrun reporting for fast tracks. Also remove Track::mUnderrunCount, which counted the number of underrun events, and was only used by dumpsys media.audio_flinger. Now dumpsys media.audio_flinger reports the number of underrun frames, Isolated underrun-related control block accesses via the proxy, so that the server is not directly poking around in the control block. The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns a rolling counter for streaming tracks, or zero for static buffer tracks which never underrun, but do a kind of 'pause' at end of buffer. tallyUnderrunFrames() increments the counter by a specified number of frames. Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2