summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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
* 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
* | Add playback rate to AudioTrackAndy Hung2015-04-091-15/+118
| | | | | | | | | | Bug: 19196501 Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
* | Adding explicit routing API to AudioTrackPaul McLean2015-04-081-7/+26
|/ | | | Change-Id: I40c048c7644c46f4e4f7103875206c0785c4b1dc
* Reject sample rate changes for fast tracksAndy Hung2015-03-311-3/+7
| | | | | | | This is needed for a SoundPool fix. Bug: 19970735 Change-Id: I46b69e059aabf0d06b16b31ea436bb71f7146750
* set() in AudioRecord and AudioTracks needs no lockGlenn Kasten2015-03-231-2/+1
| | | | Change-Id: I9d61b3d117e9b21fbbfad772d8981a5abb8fafae
* LoggingGlenn Kasten2015-03-231-8/+9
| | | | | | | | | | Move log of latency to where it is first computed. Log more parameters when a fast track is denied by client. Log session ID in destructor. Remove obsolete ALOGV that were for debugging a particular problem. Log more parameters of set(). Change-Id: I0156bceaf397f2faa053214572c57136705685ee
* Merge "Fix position when restoring streaming audio track"Andy Hung2015-03-231-1/+1
|\
| * Fix position when restoring streaming audio trackAndy Hung2015-03-201-1/+1
| | | | | | | | | | Bug: 19802225 Change-Id: I19ca7836bc89627f6cead4961641b94c6b27b5f6
* | Update AudioTrack code to match AudioRecordGlenn Kasten2015-03-231-2/+9
| | | | | | | | | | | | | | session ID check buffer error code check Change-Id: I092a61adfd249122f9127dceedf67c0a3bdcfe7b
* | namespace does not need a closing semicolonGlenn Kasten2015-03-231-1/+1
| | | | | | | | Change-Id: Ie8f9d42fc061f6d558f23b98414e04eb3d14b376
* | Declare and initialize in one statementGlenn Kasten2015-03-231-4/+2
|/ | | | Change-Id: Ie8593692907e67558f9d7654c9a4bf8cbce99bd8
* fix flush on HW A/V sync tracksEric Laurent2015-03-091-0/+3
| | | | | | | | | | | | Fix mismatch between track flags on client and server side when HW A/V sync is requested. The audio track was connected to a direct output by the audio policy manager but the client failed to set the direct flag when creating the track resulting in the direct flag not being set in audio flinger. Bug: 19665934. Change-Id: I0a5257b20bf76c9c4d89bc2ad9b44777b81f13bf
* Allow TRANSFER_OBTAIN to be used for fast tracksGlenn Kasten2015-03-091-1/+3
| | | | Change-Id: I8fa20c26f076567b38210af4a680fe1cb2eacee4
* AudioTrack::obtainBuffer() now returns number of non-contiguous framesGlenn Kasten2015-03-091-2/+2
| | | | Change-Id: I1f61d7e3d057c3254babe456b4aa0f6a1809da55
* AudioTrack::releaseBuffer parameter is const *Glenn Kasten2015-03-091-1/+1
| | | | Change-Id: I31ac20863107de05b83cd7f8cd7dd61bed98e456
* AudioTrack obtain/release buffer commentsGlenn Kasten2015-03-091-0/+1
| | | | Change-Id: I0eb178d1ab4eea7f72f4c55852c19b216ca55f5f
* Change AudioTrack resampling buffers from 3 to 2Andy Hung2015-02-061-59/+23
| | | | | | | | | | | | | Move computation of minimum AudioTrack buffer size to server for normal streaming PCM tracks. Use server-side computation to exactly determine requirements for the resampler to avoid triple buffering. This reduces latency for normal audio tracks that require resampling, and makes things consistent with the minimum buffer size. Change-Id: I2f2ca0e599ee20e16559bc5c5dab61ed100da16c
* Allow AUDIO_FORMAT_PCM_8_BIT AudioTrack buffersAndy Hung2015-01-141-46/+15
| | | | | | | | Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required. Client shared memory for static tracks and AudioFlinger track creation and buffer delivery now use native 8 bit PCM data. Change-Id: I485c07a4971fde9a25442bd43fed95019d39abcc
* Fix cumulative error in setPositionNotificationPeriodAndy Hung2015-01-071-2/+3
| | | | | | | | Time for AudioTrackThread sleep due to periodic notification needs to be computed from actual position. External reported AOSP issue 65807. Change-Id: Ic46b64588e6c5803afcd8252cde8837eb3fbf6ff
* Event driven wake for AudioTrackThread notification changesAndy Hung2015-01-061-2/+25
| | | | | | Used for setMarkerPosition and setPositionUpdatePeriod. Change-Id: I0d94b929438a5cd94b295d7c1884f876fae8b5e7
* Improve AudioTrack EVENT_LOOP_END and EVENT_BUFFER_END accuracyAndy Hung2015-01-061-11/+40
| | | | | | | | Fix timing computation to consider current position. Fix EVENT_LOOP_END count accuracy (some could be dropped before) for non-infinite loop static AudioTracks. Change-Id: I255f692915b55ab6f08ccd6a2365fee3f5d0a4fe
* Fix loop and position restoration in static AudioTracksAndy Hung2015-01-061-27/+26
| | | | | | | | Allow restoration of loop and position. Make position and loop synchronously readable. Bug: 17964637 Change-Id: I8cfb5036e665f55fdff5c67d27e1363ce9a8665d