summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libmedia: Initialize mState/mActive value to avoid possible crashZhou Song2016-04-131-1/+3
| | | | | | | | | | | If track creation fails on server side, mState/mActive is left unitialized. After this a crash can happen when track stop() is called because of a reference to a NULL object. Initialize mState/mActive to specific value in initialized list of track constructor. Change-Id: If8c3611e3229c0c1b14b81285e07b9357fec7658 CRs-Fixed: 992608
* AudioTrack: Set DIRECT track flag for direct pcm outputLeena Winterrowd2015-12-231-1/+1
| | | | | | | | | | | | | While direct output should ideally be abstracted from the AudioTrack, the use of an offload path can leave data stuck in the shared buffer (especially if the clip is short such that the buffer is never entirely filled). To ensure that all data is played out on track stop(), AudioTrack must be aware of the direct output or offload session. Set the DIRECT track flag for track offload use cases to avoid losing data in the shared buffer. CRs-Fixed: 944878 Change-Id: I13f840b5d67be56e03ec65d3bc7d44f1090b48c5
* Merge tag 'android-6.0.1_r3' of ↵Steve Kondik2015-12-071-1/+5
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/av into cm-13.0 Android 6.0.1 release 3 Change-Id: I2f2a1fe1b58c828e8341556996211562d6e195ab
| * Workaround for busy wait bugGlenn Kasten2015-10-221-1/+2
| | | | | | | | | | | | | | Underlying bug 25195759 is not yet fixed. Bug: 24263351 Change-Id: I04b644246640054d38c8de79e0eb80fcbfef0e48
| * AudioTrack: Skip callback EVENT_STREAM_END on DEAD_OBJECT.Andy Hung2015-10-131-1/+5
| | | | | | | | | | | | | | Send only EVENT_NEW_IAUDIOTRACK to initiate teardown. Bug: 23750452 Change-Id: Ib5dcd578b5b6a6a1d91a03e58ef8da0acd994243
* | Fix benign unsigned overflow in AudioTrackChad Brubaker2015-12-071-3/+3
| | | | | | | | | | | | | | An unsigned overflow could occur in timestamp computation when mTimestamp < mServer. Change-Id: I9e01897478a6d481dd6fb7303d325617466497cf
* | Fix benign overflow in AudioTrackChad Brubaker2015-12-071-6/+6
| | | | | | | | | | | | | | | | two uint32_t's were being used in a computation that could be negative, cast to int32_t before the subtraction to prevent incorrect overflow detection. Change-Id: I33c5ef79a0ebbba055daa0ea041b42229d0c3152
* | Workaround for busy wait bugGlenn Kasten2015-11-301-1/+2
| | | | | | | | | | | | | | Underlying bug 25195759 is not yet fixed. Bug: 24263351 Change-Id: I04b644246640054d38c8de79e0eb80fcbfef0e48
* | Merge branch 'LA.BF64.1.2.2_rb4.8' of ↵Steve Kondik2015-11-291-7/+8
|\ \ | | | | | | | | | git://codeaurora.org/platform/frameworks/av into cm-13.0
| * | AudioTrack: Handle timestamp queries for Track OffloadAlexy Joseph2015-11-151-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | Handle timestamp queries for Track offload session cleanly Change-Id: I93759c0e186e4286037837787057960ee52875d7 CRs-Fixed: 933740
* | | Refactor setPlaybackRate to avoid benign unsigned integer overflow.Dan Austin2015-11-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | There is a check that results in a benign unsigned integer overflow. This has been refactored to avoid the unsigned integer overflow. Bug: 25327431 Change-Id: Ib112a7cd585c680f13e4bee3d7e9f45da7d66f1d
* | | Merge tag 'android-6.0.0_r26' into cm-13.0Ricardo Cerqueira2015-11-051-3/+12
|\ \ \ | | |/ | |/| | | | | | | | | | Android 6.0.0 release 26 Change-Id: I8a57007bf6efcd8b95c3cebf5e0444345bdd4cda
| * | AudioTrack: Prevent stop() from reissuing last marker eventAndy Hung2015-10-061-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | Avoid a duplicate marker event race condition (1 in 30 or less) by clearing marker reached in start() not stop(). Bug: 24497521 Change-Id: I9520d063c7d173d2e642174bf60a2bfe75edf085
* | | Merge branch 'LA.BF64.1.2.2_rb4.6' of ↵Steve Kondik2015-11-041-6/+24
|\ \ \ | | |/ | |/| | | | | | | | | | git://codeaurora.org/platform/frameworks/av into cm-13.0 Change-Id: Iec8118b9a24fafe47e4006fca8a8e993bacb5ba8
| * | Merge "libmedia : audio: handle set playback rate when direct pcm used"Linux Build Service Account2015-10-251-5/+23
| |\ \
| | * | libmedia : audio: handle set playback rate when direct pcm usedvivek mehta2015-10-241-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In direct PCM usecase if setplayback rate is called then invalidate the common block and send empty offload structure below to use default path. CRs-Fixed: 916660 Change-Id: I6df7c10b7115c77a19564e2f9fabc511d76a2410
| * | | AudioTrack: Fix the signature of AudioTrackGetTimestampPraveen Chavan2015-10-231-1/+1
| |/ / | | | | | | | | | | | | | | | | | | to invoke the customized method correctly. CRs-Fixed: 923592 Change-Id: I8a7da0a679bebaa70076920936081be4470da6d1
* | | libmedia: Fix crash seen while running CTSSteve Kondik2015-10-231-1/+1
|/ / | | | | | | | | | | | | * setVolume was called while the track was being torn down during MediaPlayerFlakyNetworkTest Change-Id: Icb965478644909511215c17db3cf2debba85a864
* | libmedia: return error if getRenderPosition failsSatya Krishna Pindiproli2015-10-061-3/+7
| | | | | | | | | | | | | | | | | | Currently, if the call getRenderPosition() fails, no error is propagated to the caller. As the handling is already present in NuPlayerRenderer, return an error if the call fails. CRs-Fixed: 912730 Change-Id: I01e3348ffd696ce781287451b9a9478b50037ade
* | AudioTrack: Fix for offload to BT/SSR fallback at EOSPreetam Singh Ranawat2015-10-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | -With big offload buffer size, connect BT or trigger SSR while waiting for stream to be completed, playback is moving to next clip. -avoid notifying EOS to client on any error while waiting for stream end event if it is offload playback. Change-Id: I748ed299df106385eaa030faecd0df6dc8e3c176
* | libmedia: avoid processing stale callback events when track recycledYamit Mehta2015-10-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | when track is reused from SoundPool and started again, the previous callback events could be processed immediately after track started, the new playback will be stopped then clear the stale cblk flags when recycled track is started again to avoid triggering unexpected callback events Change-Id: Ifc6fd973c655e9c7866391e7004016a7df9a9b9c CRs-Fixed: 819973
* | libmedia: fix for underrun and gapless issue.Preetam Singh Ranawat2015-10-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | -change offload shared buffer size to avoid failure to restart on an underrun. (Merged changeid I4dd9e5e5a7c8aebb34b13f2e6626b73adc2ba557) -fix for gap seen during gapless playback due to big buffer size. (Merged changeid If5234059aa4629e9eb02e236a43214de9ef2204b) Change-Id: I1ad25d3789aced6b804aa695485341bfa4e97eae
* | AVCustomizations: Enable 16 and 24 bit PCM offload.Preetam Singh Ranawat2015-10-061-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | -create extended decoder and renderer -add change to pass bit width and format info to renderer. -add change for PCM conversions -add changes for time calucation Conflicts: media/libmediaplayerservice/nuplayer/NuPlayer.cpp Change-Id: I3363140fad441a7746884076c40b46e777f2e06e
* | audioTrack: Handle track invalidate on wait for stream doneYamit Mehta2015-10-061-30/+30
|/ | | | | | | | | If a track invalidate is called while waiting for a stream done, AudioCallback handler is notified with event EVENT_STREAM_END. This might cause substantial data loss for offload playback. Try to recreate the track if needed. Change-Id: Ie663c85e92588ddfd8d633f4bf5024f9fa4f5c2e
* NuPlayerRenderer: handle error when resuming an offloaded trackEric Laurent2015-08-121-1/+1
| | | | | | | | | | | Make sure that an offloaded audio track is torn down if start() returns an error in onResume(). This makes sure that a track invalidated due to a potential audio path change while paused is re created on the correct output. Bug: 22256441. Change-Id: I6c7bfec6e7322415daffc0451bab46d0c558522a
* Merge "Fix restore position warning and static track adjustment" into mnc-devAndy Hung2015-07-241-9/+9
|\
| * Fix restore position warning and static track adjustmentAndy Hung2015-07-241-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove unnecessary restoreTrack_l() position warning when AudioTrack output device changes. Also, fix rare getPosition() offset error if a static track is continuously playing a long time (> 24 hours at 48khz sampling) and its output device changes. Bug: 22524122 Bug: 21699132 Change-Id: I5a35c13d62ff9f0702b09d5cd9362c730364b18c
* | Fix race condition in AudioTrackThread::wakeAndy Hung2015-07-221-4/+8
|/ | | | | Bug: 22533684 Change-Id: I2f46770dca44fc9dae41e067d3bec893c42a826e
* Merge "Using centralized isAudioPlaybackRateValid to validate parameters" ↵Ricardo Garcia2015-06-231-12/+20
|\ | | | | | | into mnc-dev
| * Using centralized isAudioPlaybackRateValid to validate parametersRicardo Garcia2015-06-221-12/+20
| | | | | | | | | | | | | | Centralized validation code bug: 20701446 Change-Id: I9d9941c7639c05b2afe069ff4f858c693c910bfe
* | Return DEAD_OBJECT if getTimestamp cannot restore trackAndy Hung2015-06-181-1/+6
| | | | | | | | | | Bug: 21699132 Change-Id: I90443f8674ed949e2546048b231be75cd6fe6615
* | Fix AudioTrack comments relating to use of restoreTrack_l()Andy Hung2015-06-181-4/+8
|/ | | | | Bug: 21699132 Change-Id: Ib0d029a5e28676aeffbbbafc88c52a17367a413c
* Improve AudioTrack offload timestamp startup glitch detectorAndy Hung2015-06-041-4/+26
| | | | | | | | | | | | | New or existing glitch behavior for Nexus 5 offload audio: we receive several 0 timestamps, then we get a stale timestamp (very large), then a few ms later we get a correct nonzero timestamp. We attempt to hide the glitch because the retrograde timestamp correction makes the glitch "sticky". Bug: 21633313 Change-Id: I39153af718c151f9435e7d315651a811f72743da
* Compute sleep time when AudioTrack client callback returns no PCM dataAndy Hung2015-06-031-10/+79
| | | | | | | | | | | | Callbacks can go into a sleep-wait cycle if the client/app is unable to deliver data. This can happen if the buffer is large, or if the client/app cannot keep the buffer filled, or upon a stream end condition. We improve the sleep time computation for AudioTrack PCM callbacks. This minimizes the number of callbacks to NuPlayerRenderer. Bug: 21198655 Change-Id: I4247798a6638def2f0d8f1b46f60323482065cb2
* Store server latency, sample rate, framecount information in AudioTrackAndy Hung2015-06-011-38/+12
| | | | | Bug: 21198655 Change-Id: I24590196642a97ea5d61bc6356f0aff782bd37d3
* libmediaplayerservice: try to open audio sink in offload mode in error.Ronghua Wu2015-05-221-6/+10
| | | | | | Bug: 19061432 Bug: 21370108 Change-Id: Iaa757555ef37fd1ac87b6e2d5a9969bb58cc5ebc
* Implement audio device callbackEric Laurent2015-05-061-0/+61
| | | | | | | | | | | | | | | | | | | | Add class AudioSystem::AudioDeviceCallback notifying AudioSystem clients upon device selection change on a given input or output thread. Maintain a list of installed callback per I/O handle in AudioSystem and call registered callbacks when an OPEN of CONFIG_CHANGED event is received on IAudioFlingerClient::ioConfigChanged(). Add methods to AudioTrack and AudioRecord to add and remove device change callbacks. Add methods to AudioTrack and AudioRecord to query currently selected device. ioConfigChanged() events now convey the audio patch describing the input or output thread routing. Fix AudioRecord failure to start when invalidation is handled by start(). Change-Id: I9e938adf025fa712337c63b1e02a8c18f2a20d39
* AudioTrack: reduce retrograde motion spewPhil Burk2015-05-011-5/+12
| | | | | Change-Id: I96aced52b136ceea924aa3d9ef56374dd4c49784 Signed-off-by: Phil Burk <philburk@google.com>
* stagefright: support setting/getting playback/sync config in MediaSyncLajos Molnar2015-04-301-0/+11
| | | | | | | Bug: 18249558 Bug: 19666434 Bug: 20057497 Change-Id: I5868b17423d7c20cfaf4a399f3eb67bfba440605
* AudioTrack: fix buildPhil Burk2015-04-301-4/+2
| | | | | | | Using format %llu did not work for uint64_t on 64-bit systems! Change-Id: I727094e460141b9da3e433ceaa95e069dad948bc Signed-off-by: Phil Burk <philburk@google.com>
* Merge "AudioTrack: fix spurious retrograde messages" into mnc-devPhil Burk2015-04-301-0/+44
|\
| * AudioTrack: fix spurious retrograde messagesPhil Burk2015-04-291-0/+44
| | | | | | | | | | | | | | | | | | | | | | The retrograde motion was confused by some positions coming from the DSP on offloaded tracks. So the retrograde check was moved up into AudioTrack.cpp. This allows us to take advantage of the checks for invalid positions based on timing. Bug: 2047891 Change-Id: Ifcad2349201443a7f1711347c203297100449536 Signed-off-by: Phil Burk <philburk@google.com>
* | audio policy: session routes continued.Eric Laurent2015-04-301-1/+1
|/ | | | | | | | | | | - Clear session routes when client process dies. - Enforce the route only when the requesting session is active. - Fix requested route not working if an output mix change is required (e.g forcing to SPEAKER when the default route is USB or A2DP). - Make sure all sessions sharing the strategy with a rerouted session have the same route (needed for volume control consistency) Change-Id: I0ab347a8fb97e73e2c5965374544c5f4fe509ef1
* Merge "Use AudioPlaybackRate to hold TimestretchBufferProvider parameters"Ricardo Garcia2015-04-221-23/+32
|\
| * Use AudioPlaybackRate to hold TimestretchBufferProvider parametersRicardo Garcia2015-04-221-23/+32
| | | | | | | | | | | | | | | | Use this struct to handle the parameters for TimestretchBufferProvider all across the system. Add stretch mode and fallback mode to TimestretchBuffer Provider. Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
* | audio policy: fix AudioTrack output device selectionEric Laurent2015-04-221-3/+2
|/ | | | | | | | | | | | | | Have AudioTrack::setOutputDevice() set CBLK_INVALID flag instead of calling restoreTrack_l(). This allows restoreTrack_l() to be called in a safe context. Allow device change while the AudioTrack is active by forcing a new device selection in startOutput() if the output route for this session was changed. Remove some warnings. Change-Id: I2d921a63c9bfa0e122233645e2d6d39f95f5f17d
* libmedia: fix all warning, make warnings errors, use clangLajos Molnar2015-04-171-1/+2
| | | | Change-Id: Ic00d2c5d0bbb1605e96666e25c9ccc22bea6d3ff
* Work around lack of pitch adjustment in TimestretcherAndy Hung2015-04-161-12/+40
| | | | Change-Id: I3e057b97c250a826133248b6aa1ff9ed677d88df
* Merge "AudioRecord::obtainBuffer() can return nonContig like AudioTrack"Glenn Kasten2015-04-141-0/+6
|\
| * AudioRecord::obtainBuffer() can return nonContig like AudioTrackGlenn Kasten2015-04-131-0/+6
| | | | | | | | | | | | And fix error handling in both AudioRecord and AudioTrack. Change-Id: I4853d736cc6d2c05de5b18b0eac62716edfa62ec