summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/MediaPlayerService.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-6.0.1_r72' into HEADJessica Wagantall2016-10-061-0/+10
|\ | | | | | | | | | | Android 6.0.1 Release 72 (M4B30X) Change-Id: I617426a3fbf7a8d013c5be838ad4c80a00b61a5f
| * MediaPlayerService: allow next player to be NULLWei Jia2016-08-301-1/+1
| | | | | | | | | | | | | | Bug: 31155917 Bug: 30204103 Change-Id: I9a2a59ddb900fc942e7c19b31b53a110d790474c (cherry picked from commit 282841278723166e74039329ca56e444ad472daf)
| * MediaPlayerService: avoid invalid static castRobert Shih2016-08-261-0/+10
| | | | | | | | | | | | Bug: 30204103 Change-Id: Ie0dd3568a375f1e9fed8615ad3d85184bcc99028 (cherry picked from commit ee0a0e39acdcf8f97e0d6945c31ff36a06a36e9d)
| * Add bound checks to utf16_to_utf8Sergio Giro2016-08-161-1/+2
| | | | | | | | | | | | Bug: 29250543 Change-Id: I3518416e89ed901021970958fb6005fd69129f7c (cherry picked from commit 1d3f4278b2666d1a145af2f54782c993aa07d1d9)
* | Merge tag 'android-6.0.1_r66' into HEADJessica Wagantall2016-09-071-1/+2
|\ \ | | | | | | | | | | | | | | | Android 6.0.1 release 66 Change-Id: I1d3eb6b66b7482149fe93647c278065fa46dc518
| * | Add bound checks to utf16_to_utf8Sergio Giro2016-07-211-1/+2
| |/ | | | | | | | | | | Bug: 29250543 Change-Id: I3518416e89ed901021970958fb6005fd69129f7c (cherry picked from commit 1d3f4278b2666d1a145af2f54782c993aa07d1d9)
* | Merge tag 'android-6.0.1_r22' of ↵Steve Kondik2016-03-101-2/+7
|\ \ | | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/av into cm-13.0 Android 6.0.1 release 22
| * | fix deadlock in MediaPlayerServiceErik Wolsheimer2015-10-301-2/+7
| |/ | | | | | | | | | | BUG: 25263909 Change-Id: I3f08c02a851b67ab269e9aef7b2fb17eda09ea5d
| * AudioSink: Fix for gapless offload playbackPreetam Singh Ranawat2015-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gapless mode is not working for offload playback due to mismatch in flags of current track and next track to be played. AUDIO_OUTPUT_FLAG_DIRECT is added in AudioTrack flags for current track which does not match exactly with requested flags for next track. Because of this mismatch, reuse of the AudioTrack is not allowed. To fix this, update audio sink flags with requested flags and use track flags only to setPlaybackRate if AUDIO_OUTPUT_FLAG_DIRECT flag is not set. Bug: 23221273 authored-by: Preetam Singh Ranawat <apranawat@codeaurora.org> Change-Id: I52761ccd854b66a7bc218e83c9b44598771c46f7
* | Fix potential double close in IMediaMetadataRetriever::setDataSourceTaiju Tsuiki2015-12-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | IMediaMetadataRetriever::setDataSource(fd, offset, length) takes the ownership of |fd| on the direct invocation, and doesn't take the ownership on invocation from Binder. This is inconsintent to other similar methods like IMediaPlayer::setDataSource, and causes potential double close of |fd|. This CL changes the caller and implementations to leave the ownership to make them consistent. Also, fixes a double close in IMediaPlayerService::setDataSource in an error case. Change-Id: Id551a1e725c4392b0fe6b7293871212eb101c0a5
* | stagefright: Squashed commit of pause/resume featuresSteve Kondik2015-11-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add 2 APIs (suspend/resume) in MediaPlayer - API:suspend() will just pause the player and release all the decoders to replace release() which will release the whole player - API:resume() will just init the decoders again, then start() will be called to restart streaming playback - Add a check in AwesomePlayer::onVideoEvent() to make sure the first seek operation will always seek to the next i-frame Change-Id: Ie4c82906a2a056378119921a656128ebdc1007c4 audio: Add pause support for hardware omx component - ADSP doesn't enter sleep state after wma playback is paused and power suspended. - No support for NT session pause in case of hardware component. NT session need to be paused to put ADSP into power collapse. - Add support of pause in stagefright to ensure device enters suspend mode. Also add intermediate states to avoid concurrency issues between read and pause. Change-Id: I41b946b8c8805e6ee303646b63513b5b16514ef6 libstagefright: Drain input buffer on resume - Buffers returned from codec in paused state are not drained. When codec is resumed these buffers are not drained until the next flush, and may cause timed out issue. - Added change to drain input buffers for sw decoders when resuming. Change-Id: Ida2ab1d5dc3a1910accdd6fb89548262a912d8e7 CRs-Fixed: 569585, 574967 libstagefright: camcorder pause-resume implementation - Add pause resume feature in camcorder app. So that user can pause recording and resume later which results in a single recorded clip. Change-Id: Id19c45ae5bb85265aa4d5304b160ebf119d9575a libstagefright: support pause/resume for timelapse recording Modify the timestamp calculation mechanism in CameraSourceTimeLapse in order to support pause/resume. Change-Id: Icb02ea798b0b807ffb7ada2d1ef5b2414b74edfb
* | Stagefright: Add Checks for allocationsSathishKumar Mani2015-10-061-0/+1
| | | | | | | | | | | | | | Warn allocation failures explicitly rather than crash trying to access unallocated memory Change-Id: Ie86c3ac130917e1f4030eb8207ac8350cba7711d
* | AudioOutput: Consider output bit width when reusing offload outputHaynes Mathew George2015-10-061-0/+18
| | | | | | | | | | | | | | | | Consider bit width of the incoming audio stream before deciding to recycle the previously used AudioTrack object. CRs-Fixed: 802834 Change-Id: I33058fb4af2fb3b10714b14d8591f5f6b81e57d1
* | AudioSink: Fix for gapless offload playbackPreetam Singh Ranawat2015-10-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gapless mode is not working for offload playback due to mismatch in flags of current track and next track to be played. AUDIO_OUTPUT_FLAG_DIRECT is added in AudioTrack flags for current track which does not match exactly with requested flags for next track. Because of this mismatch, reuse of the AudioTrack is not allowed. To fix this, update audio sink flags with requested flags and use track flags only to setPlaybackRate if AUDIO_OUTPUT_FLAG_DIRECT flag is not set Change-Id: I52761ccd854b66a7bc218e83c9b44598771c46f7
* | libmediaplayerservice:Fix deadlock on gapless start failureYamit Mehta2015-10-061-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue:- Current gapless implementation starts the next clip when MEDIA_PLAYBACK_COMPLETE event for the first clip is recieved by MediaPlayerService. -Even if start for next clip fails, application is notified with MEDIA_INFO_STARTED_AS_NEXT. - This causes the framework to trigger mediaplayer start which again fails as it being for the same clip resulting in a deadlock in the mediaplayer. Fix:- Notify application with MEDIA_INFO_STARTED_AS_NEXT only when start for the next clip is successful. Change-Id: I77c570074c7c98c996122e275161ba88298e56fc
* | stagefright: Disable AwesomePlayerMingming Yin2015-10-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Permanently remove StagefrightPlayer codebase & remove its entry from MediaPlayerFactory as AwesomePlayer is completely replaced by NuPlayer. Keep the AwesomePlayer codebase to make libstagefright_timedtext available to NuPlayer via libstagefright. Conflicts: media/libmediaplayerservice/MediaPlayerFactory.cpp Change-Id: Idfecdc519919ee940817c7bb515433fc37588bd3
* | mediaplayerservice: fix 64-bit compliation errorsPraveen Chavan2015-10-061-6/+7
|/ | | | | | | | | | Use correct format specifiers to fix 64-bit compilation. Conflicts: media/libmediaplayerservice/StagefrightRecorder.cpp media/libstagefright/VideoFrameScheduler.cpp Change-Id: Ic2238db525a23710716558015ca152871b4c549f
* MediaPlayerService: prevent audio_attributes_t race conditionsJean-Michel Trivi2015-07-231-4/+21
| | | | | | | | | | | | Access to audio attributes fields in Client and AudioOutput was not always locked. Audio attributes field in AudioOutput cannot share the same pointer as Client because it can be indepently accessed. Save the attributes inside AudioOutput instead. Bug 22672670 Change-Id: Ib1002b57b45cea44ff5e6eb115d581dc3beec006
* libmediaplayerservice: propagate caller pid to MediaCodec.Ronghua Wu2015-07-211-1/+1
| | | | | Bug: 22630317 Change-Id: I0337d74f4ef04bf96f2de83f33d98d0d7da47c12
* mediaplayer: fix audio attributes override by stream typeEric Laurent2015-07-151-0/+16
| | | | | | | | Make sure that when audio attributes are set, the stream type is always derived from them. Bug: 22481669. Change-Id: Ia10c7017eb27e7753faf97a42dd4f44e15f2c986
* libmediaplayerservice: Serialize access to AudioOutputAndy Hung2015-07-101-37/+131
| | | | | | | | | NuPlayerRenderer may open and close the AudioOutput while MediaPlayerService::Client accesses it. Bug: 20069455 Bug: 22295200 Change-Id: Ic37987c1de1919cf890b2e69778e6df71e7ee7c5
* Merge "AudioSink: use flags granted by AudioTrack, instead of the requested ↵Wei Jia2015-06-091-2/+4
|\ | | | | | | flags." into mnc-dev
| * AudioSink: use flags granted by AudioTrack, instead of the requested flags.Wei Jia2015-06-091-2/+4
| | | | | | | | | | | | | | Do not call AudioTrack::setPlaybackRate when DIRECT flag is set. Bug: 17459982 Change-Id: Ib8fb07be72558234519590bcc3bb88c4f6edfa37
* | NuPlayer: Add audio sink buffer configurationAndy Hung2015-06-031-13/+23
| | | | | | | | | | | | | | | | Property media.stagefright.audio.sink (in milliseconds) Also change the default buffer size for PCM playback to 500 ms. Bug: 21198655 Change-Id: I5781288f59bf08fbecd9263a26c919570b58be0f
* | Merge "MediaPlayerService: Reset the bytes written in AudioSink stop and ↵Andy Hung2015-06-031-0/+2
|\ \ | | | | | | | | | flush" into mnc-dev
| * | MediaPlayerService: Reset the bytes written in AudioSink stop and flushAndy Hung2015-06-031-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | When playing in non-offloaded mode with gapless playback it is necessary to reset AudioSink's bytes written on stop and flush (e.g. seeking) so the frames written can be correctly retrieved for the subsequent song in NuPlayer::Renderer::onAudioSinkChanged(). Without this change, seeks performed during playback will cause a time position offset of the subsequent song in Play Music. Bug: 21198655 Change-Id: I0fb6cc94b5a0ff106dc8a71571ed85d75fb00660
* | MediaPlayerService: Remove unnecessary zero writes to AudioSinkAndy Hung2015-06-031-10/+17
|/ | | | | | | | | | | | Causes glitches in PCM playback for NuPlayer callback mode. Not sure the original intention of this with AwesomePlayer, as zeroes are only placed under EOS condition for AudioSink targets, not AudioTrack targets. Does not seem useful anymore as AwesomePlayer appears to call stop() which should send the remaining track data out. Bug: 21198655 Change-Id: Iab80dd7bc6e2e341f92406c5d8f8085e9d877bcd
* Merge "Track camera and flashlight usage in battery stats." into mnc-devRuben Brunk2015-06-021-12/+4
|\
| * Track camera and flashlight usage in battery stats.Ruben Brunk2015-06-011-12/+4
| | | | | | | | | | | | Bug: 15986092 Change-Id: I9dc6828332e4091fd93bf2d82839e8e3862a2fc2
* | Explicit log for AudioTrack::EVENT_UNDERRUNGlenn Kasten2015-06-011-0/+9
| | | | | | | | | | | | | | Prompted by this bug, but not a fix for the bug Bug: 21352202 Change-Id: I350d9d8660a367470450c9f54d7c541d4896ebda
* | libmediaplayerservice: try to open audio sink in offload mode in error.Ronghua Wu2015-05-221-3/+6
| | | | | | | | | | | | Bug: 19061432 Bug: 21370108 Change-Id: Iaa757555ef37fd1ac87b6e2d5a9969bb58cc5ebc
* | Clear mAudioRecord and mAudioTrack on set() failureGlenn Kasten2015-05-181-0/+1
|/ | | | | | Bug: 20818955 Bug: 20890069 Change-Id: I243205b99b198eb1b5a1a027b27cbb7d5aaaa8db
* stagefright: support setting/getting playback/sync config in MediaSyncLajos Molnar2015-04-301-15/+71
| | | | | | | Bug: 18249558 Bug: 19666434 Bug: 20057497 Change-Id: I5868b17423d7c20cfaf4a399f3eb67bfba440605
* Respect the record audio app op - mediaSvet Ganov2015-04-291-3/+4
| | | | Change-Id: I3a97977b6e9a09355e2008f780d22d480fb7308b
* Fix mips build.Ying Wang2015-04-201-1/+1
| | | | Change-Id: I49aa83e38e90ebd20793885de9420de96062aa37
* libmediaplayerservice: fix warnings, make warnings errors, use clangLajos Molnar2015-04-171-3/+1
| | | | Change-Id: I1b2f6b65c5abbc366068a60b8909104f31b94228
* Unhide the android.media.[Media]DataSource interface.Chris Watkins2015-04-151-0/+13
| | | | | | | | | | | | | | | | | | | | | This allows apps to implement MediaDataSource, which is modeled on stagefright's DataSource, to supply media data to the framework. This was already implemented for MediaExtractor, but it was renamed from DataSource. MediaExtractor, MediaPlayer and MediaMetadataRetriever each have a new overload: #setDataSource(android.media.MediaDataSource) Only NuPlayer supports this new data source. The change introduces: * IDataSource: The binder interface for DataSource. * JMediaDataSource: The native counterpart to the java interface. It implements IDataSource. * CallbackDataSource: A stagefright DataSource that wraps an IDataSource. Change-Id: Ib3c944b49cc8a792c8eb9c85e5015c07f298ebc1
* Merge "libmediaplayerservice: fix deadlock in dump()"Vineeta Srivastava2015-03-111-0/+5
|\
| * libmediaplayerservice: fix deadlock in dump()Ravi Kumar Alamanda2015-03-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: Calling dump function while the media clients (sessions) are created and destroyed will result in a deadlock. Description: MediaPlayerService::dump() takes Mutex while calling client::dump() and right after that the strong reference to client is cleared. If there are no references to client object at this moment (which is the case if multiple audio sessions are created and destroyed) then the client destructor gets called which tries to take the same Mutex resulting in a deadlock. Fix: Take a strong reference to client objects and release them only after releasing the Mutex. Bug: 18700631 Author: Sidipotu Ashok<sashok@codeaurora.org> Change-Id: I82c89771de352d2f0d914eb0a3b9fc7bfb6116b0
* | Merge "Defensively check for batterystats service instead of blocking to get ↵Warren Rehman2015-03-091-1/+2
|\ \ | | | | | | | | | it."
| * | Defensively check for batterystats service instead of blocking to get it.Warren Rehman2015-03-051-1/+2
| |/ | | | | | | | | | | | | | | | | bug: 19189826 Change-Id: I656e863eb68edf22812eb380ec6cd4105f4000aa On branch checkbattstats Changes to be committed: modified: MediaPlayerService.cpp
* | mediaplayer: use non-blocking mode for AudioSink::write().Wei Jia2015-03-031-2/+2
|/ | | | | | | This cherry picks https://googleplex-android-review.git.corp.google.com/#/c/643541/ to master. Bug: 19448263 Change-Id: I43dea830212de79c2b080185b6c6b36078f517d2
* mediaplayer: support dynamic playback rateWei Jia2015-02-241-0/+8
| | | | | | Bug: 19196501 Change-Id: I856b1507d5fa2cedfb645706d2435683a7d3e050
* Add dumpsys infoMarco Nelissen2015-02-181-3/+13
| | | | | | | | Print a list of looper-handler pairs and the number of messages they've processed, and optionally break those stats out by message type. Change-Id: I68ce4a7003152d5c9b5cb3f42e6f3949b471aa6e
* Remove MediaPlayerService::decode()Marco Nelissen2015-01-261-316/+1
| | | | | | | and make SoundPool use MediaCodec for decoding files to PCM. Bug: 18239054 Change-Id: Ia144fc1bbb0d2787638ee972e2224339b4965310
* Replace MidiFile player with a Midi extractorMarco Nelissen2015-01-081-1/+0
| | | | | | | This gets rids of a bunch of special midi handling and replaces it with an extractor that works with NuPlayer and MediaMetadataRetriever. Change-Id: I8d0f5bbdde2ca24267cf4d62ab26afe9630e0217
* Merge "Fix double close."Marco Nelissen2014-12-221-1/+0
|\
| * Fix double close.Bao Haojun2014-05-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch will fix the double close issue in SoundPool::doLoad(): status = MediaPlayer::decode(mFd, mOffset, mLength, &sampleRate, &numChannels, &format, mHeap, &mSize); ALOGV("close(%d)", mFd); ::close(mFd); mFd = -1; In MediaPlayerService::decode() which is called directly by MediaPlayer::decode(), the fd will be closed, and after it return, the mFd will be closed again. When the system is idle, the second close will fail with EBADFD, but if the system is busy, the mFd will be reused with another open/socket/pipe system call, and the second close will cause errors. Change-Id: If709515392cd490fea569658202524c51f8df785 Signed-off-by: Bao Haojun <baohaojun@gmail.com> Signed-off-by: Wang Liang <wangliang@smartisan.cn>
* | Update calls to IInterface::asBinder()Marco Nelissen2014-11-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | to use the new static version. Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a Conflicts: media/libmedia/IAudioFlinger.cpp media/libmedia/IMediaPlayer.cpp media/libstagefright/CameraSource.cpp
* | NuPlayer: use getTimestamp instead of getPositionLajos Molnar2014-09-171-0/+16
| | | | | | | | | | Bug: 14659809 Bug: 16985287 Change-Id: I59ec72fbd40a9b8d28fe548ddad082c03000c045