summaryrefslogtreecommitdiffstats
path: root/media/libmedia
Commit message (Collapse)AuthorAgeFilesLines
* Declare methods in binder opcode orderGlenn Kasten2013-07-291-11/+12
| | | | Change-Id: I5f624b7a51ffe1a17a67c056cf984f74e4c56eac
* libmedia: offloaded playback supportRichard Fitzgerald2013-07-254-52/+353
| | | | | | | | | | | | | | | | | | | | | | | | | - start() returns a status so that upper layers can recreate a non offloaded track in case of error. - Added states to handle offloaded tracks specific: - waiting for stream end (drain) notification by audio flinger - allow pause while waiting for stream end notification - getPosition() queries the render position directly from audio HAL. - disable APIs not applicable to offloaded tracks - Modified track restoring behavior for invalidated offloaded tracks: just send the callback and wait for upper layers to create a new track. - Added wait for stream end management in audio track client proxy. Similar to obtainBuffer and should be factored in. Change-Id: I0fc48117946364cb255afd653195498891f622bd Signed-off-by: Eric Laurent <elaurent@google.com>
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | - Added specialized playback thread class for offload playback, derived from directoutput thread. This thread type handles specific state transitions for offloaded tracks and offloading commands (pause/resume/drain/flush..) to audio HAL. As opposed to other threads, does not go to standby if the track is paused. - Added support for asynchronous write and drain operations at audio HAL. Use a thread to handle async callback events from HAL: this avoids locking playback thread mutex when executing the callback and cause deadlocks when calling audio HAL functions with the playback thread mutex locked. - Better accouting for track activity: call start/stop and release Output methods in audio policy manager when tracks are actually added and removed from the active tracks list. Added a command thread in audio policy service to handle stop/release commands asynchronously and avoid deadlocks with playback thread. - Track terminated status is not a state anymore. This condition is othogonal to state to permitted state transitions while terminated. Change-Id: Id157f4b3277620568d8eace7535d9186602564de
* Use AudioSystem::setLowRamDevice() to configure memoryGlenn Kasten2013-07-192-0/+23
| | | | | Bug: 9798886 Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
* Merge "Support "suspension" of a video encoder in "surface-input" mode."Andreas Huber2013-07-171-0/+29
|\
| * Support "suspension" of a video encoder in "surface-input" mode.Andreas Huber2013-07-171-0/+29
| | | | | | | | | | | | i.e. feed no more input frames to the encoder while suspended. Change-Id: I51391e18c1517548e869f8ddece19f4af37e78f9
* | Merge "Add comments"Glenn Kasten2013-07-172-0/+9
|\ \
| * | Add commentsGlenn Kasten2013-07-102-0/+9
| | | | | | | | | | | | Change-Id: Ifbf3a46a4183c8abc0feee1c588953ab10303cc1
* | | Merge "Fix typo in logs"Glenn Kasten2013-07-171-2/+2
|\ \ \ | |_|/ |/| |
| * | Fix typo in logsGlenn Kasten2013-07-021-2/+2
| | | | | | | | | | | | Change-Id: I889e31ea3a45a3d8d34fdfb54ebc3947de51d2be
* | | Merge "AudioTrackShared cleanup"Glenn Kasten2013-07-111-31/+32
|\ \ \
| * | | AudioTrackShared cleanupGlenn Kasten2013-07-021-31/+32
| |/ / | | | | | | | | | | | | | | | | | | | | | Maintain unreleased frame count on client side also (was already there on server side). Assertion failure instead of BAD_VALUE status for incorrect usage of APIs. Clean up error handling code. Change-Id: I23ca2f6f8a7c18645309ee5d64fbc844429bcba8
* | | Fix AudioTrack::flush()Glenn Kasten2013-07-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | It was only flushing at a surface level, and even then only the first time the server observed the client's flush request. Now it flushes at a deeper level, but there may be even deeper device-specific flushing. Bug: 9770947 Change-Id: I687cc3410ff9e5e5d4a5dcb9e3b129501e53d247
* | | Fix type error in AudioTrack::processAudioBufferGlenn Kasten2013-07-101-1/+2
| |/ |/| | | | | | | | | It returned a bool instead of nsecs_t Change-Id: If0c096dac411afc0a4142ec1e59c1fdd36d4867c
* | Merge "Explicitly compare raw pointers to NULL"Glenn Kasten2013-07-081-18/+20
|\ \
| * | Explicitly compare raw pointers to NULLGlenn Kasten2013-07-021-18/+20
| |/ | | | | | | Change-Id: Id2c7828a36a6912333465475b21fa87e294c83c7
* | Include what is neededGlenn Kasten2013-07-027-12/+4
|/ | | | | | | Remove old includes. Header files only include other header files that they directly need themselves. Change-Id: Ic471386808d9f42ea19ccbd59cb50a5f83a89dd0
* Public API changes for audio offload support.Richard Fitzgerald2013-06-275-14/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: this does _not_ include all private member variables added to classes as part of offload support. Only public/protected functions and stubs functions/variables needed to make the changes buildable. - isOffloadSupported() added to audio policy service A stub implementation is required to build, this always returns false - setParameters() added to IAudioTrack A stub implementation is required to build, this always returns INVALID_OPERATION - CBlk flag for stream end - Change AudioSystem::getRenderPosition() to take an audio_output_t so caller can specify which output to query - Add AudioSystem::isOffloadSupported() This is fully implemented down to the AudioFlinger function AudioPolicyServer::isOffloadSupported() which is just a stub that always returns false. - Add EVENT_STREAM_END to AudioTrack interface. STREAM_END is used to signal when the hardware has actually finished playing all the data it was sent. - Add event type enumeration to media player interface AudioSink callbacks so that the same callback can be used to handle multiple types of event. For offloaded tracks we also have to handle STREAM_END and TEAR_DOWN events - Pass audio_offload_info_t to various functions used for opening outputs, tracks and audio players. This passes additional information about the compressed stream down to the HAL when using offload. For publicly-available APIs this is an optional parameter (for some of the internal and low-level APIs around the HAL interface it is mandatory) - Add getParameters() and setParameters() API to AudioTrack Currently dummy implementations. - Change AudioPlayer contructor so that it takes a set of bitflags defining what options are required. This replaces the original bool which only specified whether to use deep buffering. - Changes to StageFright class definition related to handling tearing-down of an offloaded track when we need to switch back to software decode - Define new StageFright utility functions used for offloaded tracks Currently dummy implementations. - AudioFlinger changes to use extended audio_config_t. Fills in audio_offload_info_t member if this info is passed in when opening an output. - libvideoeditor changes required to add the new event type parameter to AudioSink callback functions - libmediaplayerservice changes required to add the new event type parameter to AudioSink callback functions Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1 Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Eric Laurent <elaurent@google.com>
* Workaround AudioRecord bug for large buffer sizesGlenn Kasten2013-06-241-1/+2
| | | | | Bug: 9556436 Change-Id: I92d1238b623d2cfd648e0a684d0e710fb0bd8b43
* Use mFutex as an event flag rather than semaphoreGlenn Kasten2013-06-241-6/+5
| | | | | | | | An event flag can be more fault-tolerant in case of loss of synchronization, as it cannot overflow. It also allows more bits to be used in the future. See http://en.wikipedia.org/wiki/Event_flag Change-Id: I01ca25d951eb263124da54bb4738f0d94ec4a48b
* am 767227fc: am 82fc2ca6: am d5018116: Merge "Fix typo."Glenn Kasten2013-06-141-1/+1
|\ | | | | | | | | * commit '767227fcac7be843b338473954420d390e354bf7': Fix typo.
| * am d5018116: Merge "Fix typo."Glenn Kasten2013-06-141-1/+1
| |\ | | | | | | | | | | | | * commit 'd5018116252a3ecb491e2eaddad12180b85d1e78': Fix typo.
| | * Merge "Fix typo."Glenn Kasten2013-06-141-1/+1
| | |\
| | | * Fix typo.Masaki Muranaka2013-06-061-1/+1
| | | | | | | | | | | | | | | | Change-Id: Ia72ed2bef54751dc2d6c3379a58de95a0e9ebfdd
| | * | Noise will be heard if audio sample rate not matched with audio trackMing Zhou2013-06-071-1/+1
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | When audio sample rate which set to audio track is not the same with the actual pcm data, noise will be heard. Fix the bug when write 8 bit pcm samples. Change-Id: Idcb0d7b0e9aaa250dd22b758c8337e23d1706049 Signed-off-by: Ming Zhou <b42586@freescale.com> Signed-off-by: guoyin.chen <guoyin.chen@freescale.com>
* | | New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-124-1045/+1726
| | | | | | | | | | | | | | | | | | | | | | | | Main differences between old and new control block: - removes the mutex, which was a potential source of priority inversion - circular indices into shared buffer, which is now always a power-of-2 size Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
* | | Fix underruns when sample rate != native sample rateGlenn Kasten2013-06-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This forces a minimum of 3 application buffers when the sample rates don't match, using the normal mixer and low latency HAL. There is still an issue that the latency() varies depending on whether screen was off or on at the time of creating the AudioTrack. With screen on: I/AudioTrack( 2028): afFrameCount=960, minBufCount=2, afSampleRate=48000, afLatency=50 I/AudioTrack( 2028): minFrameCount: 2646, afFrameCount=960, minBufCount=3, sampleRate=44100, afSampleRate=48000, afLatency=50 With screen off: I/AudioTrack( 2817): afFrameCount=960, minBufCount=4, afSampleRate=48000, afLatency=84 I/AudioTrack( 2817): minFrameCount: 3528, afFrameCount=960, minBufCount=4, sampleRate=44100, afSampleRate=48000, afLatency=84 Change-Id: Ib45515edff2afcd672dda34881b658c800ffc25a
* | | Use sp<AudioTrack> instead of raw AudioTrack *Glenn Kasten2013-06-033-27/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prepares for the new implementation of AudioTrack client, which will require clients to use only sp<AudioTrack>, not raw AudioTrack *. A raw delete will cause a race condition during AudioTrack destruction. AudioTrack was made a RefBase by commit b68a91a70bc8d0d18e7404e14443d4e4020b3635 on 2011/11/15, when it was needed by OpenSL ES (for the callback protector). At that time, the only other client that was also converted from AudioTrack * to sp<AudioTrack> was android.media.AudioTrack JNI in project frameworks/base (file android_media_AudioTrack.cpp). Details: * Use .clear() instead of delete followed by = NULL. * ALOG %p need .get(). * sp<> don't need to be listed in constructor initializer, if initially 0. * Use == 0 for sp<> vs == NULL for raw pointers. * Use if (sp != 0) instead of if (raw). Change-Id: Ic7cad25795d6e862e112abdc227b6d33afdfce17
* | | am f9bb8358: am b7319a7e: Update HTTP proxy configuration for all media ↵Andreas Huber2013-06-032-0/+49
|\ \ \ | |/ / | | | | | | | | | | | | | | | playback inside stagefright. * commit 'f9bb8358e454be6dc88403171db7e0e182407f17': Update HTTP proxy configuration for all media playback inside stagefright.
| * | Update HTTP proxy configuration for all media playback inside stagefright.Andreas Huber2013-05-312-0/+49
| | | | | | | | | | | | | | | | | | Change-Id: Ie0dd00045aba668d8b49da73224e7a7c9c04f69b related-to-bug: 8873723 (cherry picked from commit 2704965b8a1ff3b7450ff58ccecf86d8ec688c40)
| * | Fix unreleased mutex in ToneGenerator stopTone()Eric Laurent2013-05-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Commit 09108ade introduced a regression by not releasing the ToneGenerator mutex before exiting in case of error. Bug: 8852855 Change-Id: I8ba2755b218842e2034ed8dbd54b18bf2a5fc571
| * | Don't purge effects we're about to start usingMarco Nelissen2013-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | By acquiring the new session id before releasing the old, we prevent purging existing effects with the new session id that aren't currently attached but will be once the player is switched to the new session id. b/8767565 Change-Id: I703881b69c5accd8832ac834246925a20ada4c21
| * | Remove timing jitter during startup of audioGlenn Kasten2013-04-231-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced recently, that increased timing jitter during the startup of the FastMixer and AudioTrack callback threads. The regression was to make requestPriority() asynchronous as a way to avoid an apparent priority inversion in system_server. This means that the target thread could run briefly with the initial priority, before the new priority takes effect. This change removes the startup jitter for FastMixer, by making the requestPriority() synchronous again for that case. It doesn't matter that this restores the priority inversion involving normal mixer thread, because it happens during startup of both threads. The change also removes the startup jitter for the AudioTrack callback thread, by having the target thread check whether the requestPriority() has completed yet. If not, the target thread blocks with a timeout until the priority boost finishes. Finally, we now log an error message if the expected priority boost doesn't happen. Bug: 8698989 Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
| * | Added CTS test for secure stop APIsJeff Tinker2013-04-161-0/+1
| | | | | | | | | | | | | | | | | | bug: 8604418 Change-Id: I173fa1ec904ba11dc4cff0343462b3f4bac0d365
| * | Instead of returning an error, return an invalid duration (-1 ms)Andreas Huber2013-04-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | if no duration information was available. This prevents us from entering ERROR state, effectively rendering the player instance useless. Change-Id: I602d2661ae8b8633360306c0ea9208fb11e2bf17 related-to-bug: 8596285
| * | Add liblogYing Wang2013-04-091-1/+1
| | | | | | | | | | | | | | | Bug: 8580410 Change-Id: If493d87d60d71be664ad75b140c62acadb75b0d0
| * | Merge "Implement async event callout from drm plugin to Java app" into ↵Jeff Tinker2013-04-053-1/+100
| |\ \ | | | | | | | | | | | | jb-mr2-dev
| | * | Implement async event callout from drm plugin to Java appJeff Tinker2013-04-033-1/+100
| | | | | | | | | | | | | | | | Change-Id: I007f147d693664e777b8758be2bb8a4c7ec0236b
| * | | Merge "MediaDrm API update" into jb-mr2-devJeff Tinker2013-04-021-119/+289
| |\ \ \ | | |/ /
| | * | MediaDrm API updateJeff Tinker2013-04-011-119/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarify offline usage of sessions and keys and implement implement CryptoSession to support additional crypto use cases. Change-Id: I5d8000ce7e1dd7eba08969fc50296c9e1456c4fc
| * | | ToneGenerator: fix overflow in stopToneEric Laurent2013-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix overflow in tone duration calculation introduced in commit 681be039. Bug 6607077 Change-Id: Ie12f13701345c2b2d3be0b3c4d71cbfa2394a29b
| * | | ToneGenerator: fix truncated tonesEric Laurent2013-03-271-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first DTMF tone after a silent period is truncated. This is because the phone app starts and stops the tone when the user presses and releases the key. This combined to the fact that the tones use the low latency path and that when the output stream exists standby there is a period of several milliseconds during which no audio is mixed until the stream is "warmed up". The result is that much less audio is generated than the actual key press duration. The fix consists in storing the tone start time and making sure that the number of samples generated corresponds at least to the time difference between the tone start and stop commands. Bug 6607077 Change-Id: I070d20dd8600c25a9e5d5a60c1d3313b7917b00d
| * | | ToneGenerator: fix stop/destroy concurrencyEric Laurent2013-03-261-5/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a problem if the stopTone() method is called from two different threads (for instance if the destructor is called while stopTone() is waiting for the audio callback to finish). In this case, the second call to stopTone() will not wait for the condition to be signaled and call clearWaveGens() while the callback can still be active, thus causing a crash. There is a similar problem in case of concurrent calls to startTone() and stopTone(). The fix consists in making sure that stopTone() always waits for call back completion or timeout and exits before calling clearWaveGens() if a concurrent start request is detected. Bug 8163071 Change-Id: I9ddb4390407701dcad5bf83660fd9903f0d72268
| * | ToneGenerator: fix AudioTrack pointer initEric Laurent2013-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pointer to AudioTrack should be initialized before early return from ToneGenerator constructor because it is tested by the destructor. Bug 8140963 Change-Id: I9a7dfb60ba162b75dfaa5630ab7fc9485afd0074
| * | Merge "ToneGenerator: optimize silent tone" into jb-mr2-devEric Laurent2013-03-261-1/+5
| |\ \
| | * | ToneGenerator: optimize silent toneEric Laurent2013-03-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not create an AudioTrack and start playback when a silent tone is requested to ToneGenerator. Bug 7946399 Change-Id: Ib9282871a56f7a862af7d1504ce3fbd7c18e34e2
| * | | Load crypto plugins from additional shared librariesJeff Tinker2013-03-221-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently crypto plugins are expected to be in libdrmdecrypt.so. When there are multiple plugins supporting different schemes, this approach requires source code integration across vendors which is unmanagable. Also, for integration with MediaDrm where the crypto keys are obtained from a drm server, the MediaCrypto plugin needs to interoperate with the MediaDrm plugin. This change allows {MediaCrypto, MediaDrm} pairs that are logically related to be implemented in a common shared library. Change-Id: I7f6638f29171f91609fc2d944396365568630b56
| * | Merge "Implementing MediaDrm APIs" into jb-mr2-devJeff Tinker2013-03-203-0/+567
| |\ \
| | * | Implementing MediaDrm APIsJeff Tinker2013-03-133-0/+567
| | | | | | | | | | | | | | | | Change-Id: I9ff8eeb7d0c383b5c0c68cd54eb54ce7d2d22fe6
| * | | remove uses of Surface in favor or IGraphicBufferProducerMathias Agopian2013-03-122-4/+4
| |/ / | | | | | | | | | Change-Id: I13d7a9553aa335bca790a3a59d389d7533c83d57