summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AwesomePlayer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix potential double close in IMediaMetadataRetriever::setDataSourceTaiju Tsuiki2015-12-181-0/+1
| | | | | | | | | | | | | | 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: Add OMX.ffmpeg. checkingKeith Mok2015-12-071-0/+1
| | | | | | | Port from L, add "OMX.ffmpeg." checking in additional to "OMX.google." for software codec Change-Id: I3ef70a965573d7c2818236a70d4f99b6b7873468
* stagefright: Squashed commit of pause/resume featuresSteve Kondik2015-11-071-4/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* NuCachedSource2: fix possible erroneous early freeWonsik Kim2015-09-091-2/+2
| | | | | | | | | | | | Because the constructor of NuCachedSource2 sent a message to AHandlerReflector object, AHandlerReflector::onMessageReceived could have executed just before the object gets wrapped in a strong pointer, resulting in erroneous early free. Fix the issue by using static Create function to ensure the message is sent after the object is wrapped in a sp. Bug: 23882800 Change-Id: I38a9d7a3083f184b4c81d0b00ba1661721278855
* stagefright: add support for output frame rendered callbackLajos Molnar2015-06-091-3/+3
| | | | | | | | | | | - Added FRAME_RENDERED event in OMX, used by tunneled video decoders to signal rendered event timing - Track buffers sent for rendering in ACodec and in SoftwareRenderer, and determine when they have rendered - Propagate render times to MediaCodec Bug: 20503131 Change-Id: Idf0a8714d5368b237c2285dd39fa82db847c232f
* stagefright: support setting/getting playback/sync config in MediaSyncLajos Molnar2015-04-301-8/+62
| | | | | | | Bug: 18249558 Bug: 19666434 Bug: 20057497 Change-Id: I5868b17423d7c20cfaf4a399f3eb67bfba440605
* stagefright: warnings be gone, some are now errors, use clangLajos Molnar2015-04-171-4/+4
| | | | Change-Id: I81f438ae444f04c12ae27ae4ef6d073033de172c
* resolved conflicts for merge of b955b722 to lmp-mr1-dev-plus-aospMarco Nelissen2015-01-271-4/+1
|\ | | | | | | Change-Id: I385371869169eee4fe6330ffe0abc5eda4cb4f72
| * Remove MediaPlayerService::decode()Marco Nelissen2015-01-261-4/+1
| | | | | | | | | | | | | | and make SoundPool use MediaCodec for decoding files to PCM. Bug: 18239054 Change-Id: Ia144fc1bbb0d2787638ee972e2224339b4965310
* | Don't autoloop notificationsMarco Nelissen2014-11-181-0/+10
| | | | | | | | | | | | | | | | Some apps think it's cool to use ringtones as notification sounds, but ringtones often loop, which is not appropriate for notifications. Bug: 15929273 Change-Id: I77c4277801cb2561743f8c676ef76ab4d1668b08
* | NuPlayer: reduce offload pause teardown timeout.Eric Laurent2014-10-291-1/+1
|/ | | | | | | | | | Waiting 60 seconds to teardown an offloaded path when paused is not needed and causes unecessary battery drain. 10 seconds is enough to avaoid teardown when it would be problematic (seek, pause for notifications, buffering...). Bug: 13505340. Change-Id: Ibcaa609b59e86ba2bc49539620bd77504d534c0c
* stagefright: Fix race condition between MediaCodec and SoftwareRendererRonghua Wu2014-08-151-4/+8
| | | | | | | | | | | * Set the buffer's format info when it's returned from OMX component. * Move frame format meta from SoftwareRenderer's ctor to the render call. I.e. each frame sent to the renderer carries the format info. * Reset renderer with the new format instead of re-creating SoftwareRenderer when incoming frame's format is changed. Bug: 13842676 Change-Id: Ibab46f109200bcbdeab13a4cc1bcd0870f2a99fb
* Restore the LOOPING flag in onAudioTearDownEventSungsoo Lim2014-06-271-0/+4
| | | | | Bug: 15728572 Change-Id: Ib8d118a148a7bb74531c8c025dae479c0a86efcb
* libstagefright: 64-bit compile warningsMark Salyzyn2014-06-261-8/+10
| | | | Change-Id: I3d1146714fa23be3d4e696599b6f70cac1f9d28b
* Parse trex and mehd boxesMarco Nelissen2014-06-231-0/+7
| | | | | | | | | | | | Also get duration from mvhd if available, use that in addition to track durations to determine total length of file, clear track header struct so we don't read uninitialized garbage from it, and take composition time offset into account for proper ordering when B frames are used. b/15669839 Change-Id: Ibf3e35b5c7299bac11d0e78a391545fc325dd2d0
* stagefright: set PTS for SoftwareRendererLajos Molnar2014-05-071-3/+6
| | | | Change-Id: I08661a9eae09f919149aa5a58aa514d848de50a1
* am 63249d6e: am bc4bf532: am b2314088: Merge "AwesomePlayer: use PTS for ↵Lajos Molnar2014-05-021-7/+10
|\ | | | | | | | | | | | | queueBuffer" * commit '63249d6ea560b2f29d3ee255951f527b01ecbac5': AwesomePlayer: use PTS for queueBuffer
| * AwesomePlayer: use PTS for queueBufferLajos Molnar2014-05-011-7/+10
| | | | | | | | Change-Id: I1c14ad4784c799c46cf06a14b0f00c5e4d01f718
* | am 113f2122: am 5fa3f7af: am b52675e9: Merge "Smooth out AwesomePlayer"Lajos Molnar2014-05-021-4/+22
|\ \ | |/ | | | | | | * commit '113f2122662856f2482836f1b4c585a050888afa': Smooth out AwesomePlayer
| * Smooth out AwesomePlayerLajos Molnar2014-05-011-4/+22
| | | | | | | | | | | | Use clock estimator to smooth out audio time stamps. Change-Id: Iec1ff30c011069d06ff8051fc4839d00895463d6
* | am 9e0922ba: am 6e76fda3: am f9782266: Merge "AwesomePlayer: improve ↵Lajos Molnar2014-05-021-3/+7
|\ \ | |/ | | | | | | | | | | scheduling of video event to hit PTS" * commit '9e0922ba7dda72fc94d2af2872cfc630ad599c91': AwesomePlayer: improve scheduling of video event to hit PTS
| * AwesomePlayer: improve scheduling of video event to hit PTSLajos Molnar2014-05-011-3/+7
| | | | | | | | Change-Id: I7b19911acbde9b592b757b952d4ad63cd8efebed
| * warnings be gone.Andreas Huber2014-04-111-2/+3
| | | | | | | | | | | | | | | | (cherry picked from commit 84333e0475bc911adc16417f4ca327c975cf6c36) Modified by Mark Salyzyn <salyzyn@google.com> to keep merge conflicts or errors downstream to a minimum. Change-Id: Ic3b272f9cbf3155001aabd2f79728f1bc31de613
* | AwesomePlayer: fixed division by zero in onBufferingUpdateRobert Shih2014-04-251-6/+4
| | | | | | | | | | Bug: 13911283 Change-Id: I968a274634a86f5c46f75dc533024dad44afc36b
* | stagefright: log uri protocols, and opt-in to log full uriLajos Molnar2014-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | Added property media.stagefright.log-uri. Set it to true or 1 to log uris by AwesomePlayer. Added utility function to get uri debug string based on incognito and log opt-in status. Change-Id: I5ccc23079ddfb120dd9703a3ed651a162ed5acec Related-Bug: 6994761
* | Fix race condition in AwesomePlayerMarco Nelissen2014-02-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | This fixes a race condition that could cause two threads to attempt to connect to a server at the same time, resulting in multiple requests and/or aborted connections. In some cases, it could cause other operations on MediaPlayer to block until network access was complete. b/13187722 Change-Id: Ibf78acff15dbfbf6c443a4c60623e8eac967d955
* | warnings be gone.Andreas Huber2014-02-111-2/+3
| | | | | | | | Change-Id: Ie3bae3f037730e316d7fca12e7a3527973f752ef
* | resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-14/+15
|\ \ | |/ | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | Contains the necessary changes to make frameworks/av build and work on a 64-bit machine. Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Change-Id: I725feaae50ed8eee25ca2c947cf15aee1f395c43
* | FINAL ATTEMPT: HTTP services are now provided from JAVA and made available ↵Andreas Huber2014-02-041-15/+26
|/ | | | | | to media code Change-Id: I9f74a86e70422187c9cf0ca1318a29019700192d
* Avoid jumps to faulty position after seeksRoger1 Jonsson2013-12-181-1/+4
| | | | | | | | | | | | | | | | | When seeking multiple times it is possible that some seeks are discarded in AwesomePlayer, which causes unwanted jumps to faulty positions. The reason is that a seek flag is reset twice in AwesomePlayer. At first when the video seek is completed and then again when the audio seek is completed. If a new seek is made after the previous video seek completed but before the previous audio seek completed, the new seek position is discarded by the previous audio seek completion. This fix makes sure that the seek flag is reset only when video has completed the seek. Change-Id: I8f8741d4cb8682345f1d1855bbad57c05f4e3c8d
* AwesomePlayer: correct stream type for offloadEric Laurent2013-11-141-1/+7
| | | | | | | | | | | | canOffloadStream() function in stagefright utils forces the stream type to AUDIO_STREAM_MUSIC when querying the audio policy manager if a particular track is offloadable or not. This causes MP3 ringtones to be offloaded which is not a validated use case. The fix consists in using the actual stream type read from the AudioSink. Bug: 11410937. Change-Id: I44b8e033a8e785a79cdc291b142f80b5580bdc4d
* Merge "AwesomePlayer: Improve performance on high-fps clips" into klp-devLajos Molnar2013-11-131-1/+36
|\
| * AwesomePlayer: Improve performance on high-fps clipsLajos Molnar2013-11-121-1/+36
| | | | | | | | | | | | | | | | | | | | - Immediately retry rendering next frame after frame skip. - Schedule next videoEvent based on the timestamp of the next frame. Change-Id: Ia106382c4c225321b682c1f7c2d126d7eab7d56d Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 11159147
* | am 27ae268a: am 00cb884f: Merge "StageFright: Removes hacks for Nvidia MPEG2 ↵Adam Hampson2013-11-131-2/+1
|\ \ | |/ |/| | | | | | | | | decoder" into jb-mr2-dev * commit '27ae268af29b25d85f83aa34e92ac8b7f6c87c6f': StageFright: Removes hacks for Nvidia MPEG2 decoder
| * am 00cb884f: Merge "StageFright: Removes hacks for Nvidia MPEG2 decoder" ↵Adam Hampson2013-11-131-2/+1
| |\ | | | | | | | | | | | | | | | | | | into jb-mr2-dev * commit '00cb884fc870aba4052c8d187a45e4aec50a6b43': StageFright: Removes hacks for Nvidia MPEG2 decoder
| | * StageFright: Removes hacks for Nvidia MPEG2 decoderSuresh Choudhary2013-08-091-2/+1
| | | | | | | | | | | | | | | | | | | | | Removes the NVIDIA MPEG2 decoder specific hacks in legacy code as Nvidia HW MPEG2 decoder is enabled and tested now. Change-Id: Ifc67e1119d9741551336753f85f9cfdfd3fc8600
* | | AwesomePlayer: ensure STARTED message works after resetLajos Molnar2013-10-281-0/+5
| | | | | | | | | | | | | | | | | | Change-Id: I06217c07c0b68476cb296fd6151f6a0d8d4e02d0 Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 11412881
* | | Make sure we get to discover that the cache is sufficiently full againAndreas Huber2013-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | by posting buffering events while in the CACHE_UNDERRUN state. Change-Id: Ic60c8d57f0ae502aa2b6eec7160dc4224b989604 related-to-bug: 11262689
* | | AwesomePlayer: fix concurrent pause and teardownEric Laurent2013-10-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a race condition if a pause request was received while we were executing a teardown event. Although we hold a mutex while processing the teardown event, there is a step of the prepare sequence where we release the mutex if streaming. In this case, the pause request is executed but ignored because the player state is still preparing. At the end of the teardown event processing we restore previous playback state and resume. The fix consists in clearing the saved teardown playback state when a pause request is received while processing a teardown event. Bug: 11225491. Change-Id: If0e61855ce5a336322f1ba8e5559bdc190beeb76
* | | AwesomePlayer: do not send events when paused.Eric Laurent2013-10-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When streaming audio and paused, AwesomePlayer should stop sending BufferingEvents as they will keep a wake lock for no reason. TimedEventQueue should always acquire the wakelock with mediaserver identity so that it is released with the same identity by the event handler thread. Bug: 11104408. Change-Id: Ied0e03acd6ad2f5a4c0ec82d5c2aa4e1c6da772c
* | | MediaTimeProvider support fixesLajos Molnar2013-09-301-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add MEDIA_SKIPPED event when resuming at a different time than seeked to. Send MEDIA_STARTED/PAUSED events only when playing (vs. when doing seek previews) Change-Id: I243ebf054303755ea8863229c3211694f2c204a7 Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 10954008
* | | Merge "Prevent onPrepared callback from being called twice" into klp-devMarco Nelissen2013-09-281-17/+19
|\ \ \
| * | | Prevent onPrepared callback from being called twiceMarco Nelissen2013-09-271-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | b/10891995 Change-Id: If6845c832d114629282f0b03f904a37c3325208e
* | | | fix playback position after switching to offloadEric Laurent2013-09-271-0/+7
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After switching from offloaded track to PCM track while paused (e.g. when connecting A2DP), playback restarts from the beginning of the song when resuming. Save current position before recreating an AudioPlayer in AwesomePlayer::play_l() and seek to the saved position before starting playback. Also fix a problem where the position is not reported properly by AudioPlayer if a seek is pending and queried just after start and before the first buffer is read from the MediaSource. Bug: 8174034. Change-Id: I254e65418ff903a9bf2e2111b89a00e2e54876c5
* | | Set PREPARING flag after setDataSource_l()Chong Zhang2013-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise the reset_l() inside setDataSource_l() will get stuck waiting for the PREPARING to be cleared. Bug: 10426788 Change-Id: I7ccdf7abcea71cf150544c7cd3f4781e3a946b97
* | | Add MEDIA_STARTED/PAUSED/STOPPED events to media playersLajos Molnar2013-08-151-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed for the MediaTimeProvider java interface, so it does not continually poll for current media time. Note: NuPlayer and AwesomePlayer do not correctly handle stop (pause instead), so for those we will signal PAUSED. Signed-off-by: Lajos Molnar <lajos@google.com> Change-Id: I3c61e1bda475f131323f475c18a42e3ec66c9ae1 Bug: 10326117
* | | Merge "Fix typo in AwesomePlayer"Andreas Huber2013-07-291-1/+1
|\ \ \
| * | | Fix typo in AwesomePlayerSungsoo Lim2013-07-101-1/+1
| | | | | | | | | | | | | | | | Change-Id: I32113e382a3033c9a1b038dc06e4ccddc2a97d7f
* | | | stagefright: offload playback supportRichard Fitzgerald2013-07-261-42/+202
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Offloading of compressed audio decoding to audio DSP is implemented for audio only, non streamed content. when the datasource is AudioPlayer: - Create an offloaded sink when playing a compressed source - Send metadata to audio HAL - Return sink start error to AwesomePlayer so that a new player for PCM audio can be created in case of problem. - Forward stream end and tear down callback events to AwesomePlayer - Stop the sink and wait for stream end callback when EOS is reached. - Pause and restart the sink if needed before flushing when seeking (otherwise flush is a no op). - For current media time, directly query the render position from the sink and offset by the start position (seek to time) AwesomePlayer: - When initializing the audio decoder, check with audio policy manager if offloading is supported. If yes, create the software decoder in case a reconfiguration is needed but connect the audio track directly to the AudioPlayer. - In case of error when starting the AudioPlayer, reconnect the software decoder (OMXSource) and recreate a PCM AudioPlayer. - Handle AudioPlayer tear down event by detroying and recreating the AudioPlayer to allow transitions between situations were offloading is supported or not. - Force tear down of offloaded AudioPlayer when paused for a certain time: This will close the sink and allow the DSP to power down. Utils: - Added helper methods: - send meta data to audio ia sink setParameters - query audio policy manager if offloading is supported for a given audio content Change-Id: I115842ce424f947b966d45e253a74d3fd5df9aae Signed-off-by: Eric Laurent <elaurent@google.com>