summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AwesomePlayer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* am 046d9c8d: am 06197925: am 267363ee: Merge "Prevent Media Server crash ↵Jean-Baptiste Queru2013-07-081-1/+1
|\ | | | | | | | | | | | | while the AwesomePlayer getBitrate return true with mBitrate equals to zero." * commit '046d9c8dad97118535778cf93efc662ceb5fec8d': Prevent Media Server crash while the AwesomePlayer getBitrate return true with mBitrate equals to zero.
| * am 267363ee: Merge "Prevent Media Server crash while the AwesomePlayer ↵Jean-Baptiste Queru2013-07-081-1/+1
| |\ | | | | | | | | | | | | | | | | | | getBitrate return true with mBitrate equals to zero." * commit '267363ee2836ff9bc18d7fdd93aaedf19de546ad': Prevent Media Server crash while the AwesomePlayer getBitrate return true with mBitrate equals to zero.
| | * Prevent Media Server crash while the AwesomePlayer getBitrate return true ↵hovanchen2013-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with mBitrate equals to zero. [Cause] - getBitrate(int64_t *bitrate) will return true if mBitrate = 0. - Then, in getCachedDuration_l(int64_t *durationUs, bool *eos), we might execute the following function when getBitrate(&bitrate) = true and bitrate = 0. *durationUs = cachedDataRemaining * 8000000ll / bitrate; - Mediaserver will be crashed when divided by zero. - The mediaserver crash often occur when DLNA IOP tests on Golden DMS with AAC_ADTS_320 audio. [Solution] - Prevent the divide function executing when bitrate is zero. Change-Id: I4439d92cee5faec95df2109e9186c33b3fff6c66
| * | Refactoring: Rename SurfaceTextureClient to SurfaceMathias Agopian2013-02-151-2/+2
| | | | | | | | | | | | Change-Id: I4e8a8b20914cb64edc37abe68233fbc9f2b5d830
| * | Return error code if setting scaling mode failsMarco Nelissen2013-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The return code from native_window_set_scaling_mode() was ignored. Looking at the code review comments that introduced this code, it seems like the intention was to return the error code in that case. Change-Id: I9592cc378f0a0b960d37178aa0525fc17e8734ba
| * | Rename ISurfaceTexture and SurfaceTextureAndy McFadden2012-12-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C++ class names don't match what the classes do, so rename ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to GLConsumer. Bug 7736700 Change-Id: I64520a55f8c09fe6215382ea361c539a9940cba5
| * | Don't attempt to seek audio and video separately.Andreas Huber2012-10-231-9/+17
| | | | | | | | | | | | | | | | | | | | | The widevine extractor doesn't deal too well with that... Change-Id: Iadfeede4fe0c086af788c5639782854e4fbb98ff related-to-bug: 7262386
| * | Added some extra failure logging messagesJames Dong2012-10-171-0/+1
| | | | | | | | | | | | | | | | | | o related-to-bug: 7282066 Change-Id: I0896551a45aab61fb571fef19061397ff84321d9
| * | [WVDRM] Fix for stuttering on low bandwidthJeff Tinker2012-10-011-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reintroduces the play/pause rebuffering logic we eliminated in JB zero day to fix double spins and slow startup - but activates that logic only based on a comparison of the current bandwidth measurement and the lowest bitrate track in the movie. Needs to be submitted with related changes in /vendor/widevine bug: 7230071 Change-Id: If4f5ecda36c4858ce8bf5c4abb722f90a329ecdb
| * | Add getError and setError to propagate error code from WVMMediaExtractor up ↵Edwin Wong2012-09-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to player. The two virtual functions provides a path for the player(AwesomePlayer) to retrieve the last error from WVMMediaExtractor container. Change-Id: Iee8d4a3eccf82af95eb3d4d465f069daced4aa1a related-to-bug: 7073630
* | | libstagefright: Check for duration > 0 to avoid divide-by-zero exceptionAjay Dudani2013-05-281-1/+1
| | | | | | | | | | | | Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6
* | | Refactoring: Rename SurfaceTextureClient to SurfaceMathias Agopian2013-02-151-2/+2
| | | | | | | | | | | | Change-Id: I4e8a8b20914cb64edc37abe68233fbc9f2b5d830
* | | Return error code if setting scaling mode failsMarco Nelissen2013-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The return code from native_window_set_scaling_mode() was ignored. Looking at the code review comments that introduced this code, it seems like the intention was to return the error code in that case. Change-Id: I9592cc378f0a0b960d37178aa0525fc17e8734ba
* | | Rename ISurfaceTexture and SurfaceTextureAndy McFadden2012-12-181-4/+4
| |/ |/| | | | | | | | | | | | | | | | | The C++ class names don't match what the classes do, so rename ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to GLConsumer. Bug 7736700 Change-Id: I64520a55f8c09fe6215382ea361c539a9940cba5
* | Don't attempt to seek audio and video separately.Andreas Huber2012-10-231-9/+17
| | | | | | | | | | | | | | The widevine extractor doesn't deal too well with that... Change-Id: Iadfeede4fe0c086af788c5639782854e4fbb98ff related-to-bug: 7262386
* | Added some extra failure logging messagesJames Dong2012-10-171-0/+1
| | | | | | | | | | | | o related-to-bug: 7282066 Change-Id: I0896551a45aab61fb571fef19061397ff84321d9
* | [WVDRM] Fix for stuttering on low bandwidthJeff Tinker2012-10-011-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Reintroduces the play/pause rebuffering logic we eliminated in JB zero day to fix double spins and slow startup - but activates that logic only based on a comparison of the current bandwidth measurement and the lowest bitrate track in the movie. Needs to be submitted with related changes in /vendor/widevine bug: 7230071 Change-Id: If4f5ecda36c4858ce8bf5c4abb722f90a329ecdb
* | Add getError and setError to propagate error code from WVMMediaExtractor up ↵Edwin Wong2012-09-111-1/+5
|/ | | | | | | | | | to player. The two virtual functions provides a path for the player(AwesomePlayer) to retrieve the last error from WVMMediaExtractor container. Change-Id: Iee8d4a3eccf82af95eb3d4d465f069daced4aa1a related-to-bug: 7073630
* Send current bandwidth info event when buffering occursJeffrey Tinker2012-08-231-3/+8
| | | | | | | There is a dependent change in vendor/widevine repo. Change-Id: If063f4b1c8857e5bfc7be54ab0f97a4ed169b303 related-to-bug: 5883234
* Don't log streaming url.James Dong2012-08-171-6/+2
| | | | | | o related-to-bug: 6994761 Change-Id: I79d5549a70b3bde67ddf496cfc6283ac92b1f569
* Added a callback to signal when the rendering of the video frame just occurredJames Dong2012-07-201-0/+7
| | | | | Change-Id: Ifbd78606ffc33483aecebf02cb18e0e52af9624d related-to-bug: 6851811
* Ensure MEDIA_INFO_BUFFERING_END is always sentMarco Nelissen2012-07-201-2/+3
| | | | | | b/6620761 Change-Id: Iafd2eeac7b3cbbeb42af3638628a32dc6c2bb414
* Update ANativeWindow client code for syncJamie Gennis2012-06-211-1/+1
| | | | | | | This change updates all the uses of ANativeWindow to use the new ANW functions that accept and return Sync HAL fence file descriptors. Change-Id: Id7db42d8d6380f8b440d88476ce9211c6225fb16
* Fix track selection code in AwesomePlayerInsun Kang2012-06-151-1/+1
| | | | | Change-Id: I1c5a2f13f562a0ba253a93b4346cbe2c60099ddd related-to-bug: 6671977
* Fix one of the potential ANR issues from AwesomePlayerJames Dong2012-06-121-1/+7
| | | | | Change-Id: I8ac7bbb5fe219f65bdbdd223538fbac0575e2957 related-to-bug: 6565826
* Part of fix for double spins & faster startupJeff Tinker2012-05-311-8/+12
| | | | | | | | | | | | | | | | | | This change alters the way that the media player interacts with the Widevine adaptive streaming buffer logic. It eliminates the reliance on cached buffer duration to determine pause/play states and instead only generates buffering events when the widevine library is not producing data (i.e. when it is buffering). This eliminates unnecessary pause and rebuffer cycles, reducing startup time and the frequency and duration of spinners. Multi-repo commit, depends on related changes in vendor/widevine Change-Id: I387db2decd83841775a8351bddf5a6381fe4104f related-to-bug:6503294 related-to-bug:6463780
* Only mark the audio player as started if it did so successfully.Andreas Huber2012-05-221-2/+2
| | | | | Change-Id: I4683f5ca243f9f1b80990028d225d0f6c5973899 related-to-bug: 6500580
* Switch audio tracks at runtimeJames Dong2012-05-141-10/+91
| | | | | | | | o The switching is not allowed if there is an audio seek operation ongoing. o related-to-bug: 6110705 Change-Id: Ib92a165f3984aa033d97800184d3d17319522db5
* stagefright: add tracing to AwesomePlayer.Jamie Gennis2012-05-111-1/+30
| | | | Change-Id: Id84419a1c54e41e158b24477f0676071e90f6922
* Revert our seek behaviour to SEEK_CLOSEST_SYNC instead of SEEK_CLOSEST.Andreas Huber2012-05-031-1/+1
| | | | | Change-Id: I375ca724b228cb0bb4776b87eeaab788e365be84 related-to-bug: 6437985
* Removed mutex lock in addTextSource, and rename to addTextSource_lEdwin Wong2012-05-021-3/+2
| | | | | | | | to indicate this method needs to be called with a lock hold. Change-Id: I7e99f0a622e7de49c288be09dd4fc955bbca390b related-to-bug: 5629511 related-to-bug: 5542712
* Impl for supporting two video scaling modesJames Dong2012-05-011-0/+26
| | | | | | | | | o allows the video scaling mode to change at any time o also remove the scaling mode logic in OMXCodec.cpp o related-to-bug: 5454345 Change-Id: I6f1714eb0c2774591ce650d56c1e779b8afd085f
* Handle the case when there is no timed text trackJames Dong2012-04-261-22/+29
| | | | | | | | o also replaced mTimedTextLock with mLock, since there is no particular reason to use a separate lock for timed text o related-to-bug: 6110705 Change-Id: Ia687e96956692c42d492e57992e5721ca1e8e18b
* Add support for deep audio buffersEric Laurent2012-04-201-1/+12
| | | | | | | | | | Allow AudioSink to use deep audio buffering when the source is audio only and its duration is more than a certain threshold. This helps improve battery life but implies higher audio latency. Change-Id: Ie79915b61c370292f05aabda9779356570e03cbb
* Fix for multiple audio/timed track feature implementation - part oneJames Dong2012-04-161-37/+102
| | | | | | | | | | | | | | | | o getTrackInfo now returns all tracks, rather than just the timed text tracks. o the index of the track info is kept to the same as the track index if the track is not from an external source o correctly maps the selectTrack() and unselectTrack() calls to the right track index o TODO: 1) note that the selectTrack() and unselectTrack() only works for timed text track at present; 2) the lock is timed text specific o related-to-bug: 6110705 Change-Id: Ib1feeef2184bc992930ace0d1197b6c00a2636d7
* Add external timed text source using a passed file descriptorJames Dong2012-04-131-1/+1
| | | | | | | | o Also fixed a minor issue where the file length should be of type off64_t rather than size_t o related-to-bug: 5542712 Change-Id: I35fd8ceea0bc75e553b7f4a99932cf58ea560c4e
* Fix a bug in MediaPlayer's addExternalSource().Insun Kang2012-03-161-16/+3
| | | | Change-Id: I035cbfb7acccc7ff88d659861ece7d0f61314fda
* Defines MediaPlayer APIs to support multiple audio/video/timedtextInsun Kang2012-03-151-44/+101
| | | | | | | | | | | | | | | | | | tracks. o Newly introduced APIs are (MediaPlayer): getTrackInfo() / addExternalSource() / enableTrack() / disableTrack(). o Timed text tracks are supported only, for now. o TODOs: - Define the audio/video behavior for enableTrack and disableTrack. - Refactoring AwesomePlayer / TimedTextDriver so that all types of track index can be managed in the correct order and be ready for supporting audio/video tracks. (MediaExtractor and MediaSource for text file might be necessary.) Change-Id: Idb85e1b3f2ed49a64f377d05472dd6663ce94e07
* Merge "Fix videos app bandwidth accounting for 4G streaming"Jeff Tinker2012-03-081-0/+2
|\