diff options
author | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-15 00:41:32 +0000 |
---|---|---|
committer | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-15 00:41:32 +0000 |
commit | 60bbbbde53dace07e8dbb383aace4a46c3b8276b (patch) | |
tree | bfe756e577ba2f059587e3816515301ec6b95abc /media/base/android/media_source_player.h | |
parent | 174963675bf92d06bf24b251efa46ddee3475b8e (diff) | |
download | chromium_src-60bbbbde53dace07e8dbb383aace4a46c3b8276b.zip chromium_src-60bbbbde53dace07e8dbb383aace4a46c3b8276b.tar.gz chromium_src-60bbbbde53dace07e8dbb383aace4a46c3b8276b.tar.bz2 |
Fix an issue that audio and video may run out of sync
This CL fixes 3 issues:
1. In ProcessPendingEvents(), if there is a non-seek pending event, UpdateTimestamps() will not get called.
This is probably the number 1 reason that a/v lose sync.
2. MSP use its internal clock to estimate the current presentation time.
However, hardware may consume data at a different rate.
Passing the current frame position from AudioTrack to MSP so we get a better estimation of the current time.
3. When config change comes, We don't need to reset the clock if audio decoder is not recreated.
BUG=351722
Review URL: https://codereview.chromium.org/215783002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/android/media_source_player.h')
-rw-r--r-- | media/base/android/media_source_player.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h index ed0483c..bd8457e 100644 --- a/media/base/android/media_source_player.h +++ b/media/base/android/media_source_player.h @@ -29,7 +29,6 @@ namespace media { class AudioDecoderJob; -class AudioTimestampHelper; class VideoDecoderJob; // This class handles media source extensions on Android. It uses Android @@ -77,8 +76,8 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, friend class MediaSourcePlayerTest; // Update the current timestamp. - void UpdateTimestamps(base::TimeDelta presentation_timestamp, - size_t audio_output_bytes); + void UpdateTimestamps(base::TimeDelta current_presentation_timestamp, + base::TimeDelta max_presentation_timestamp); // Helper function for starting media playback. void StartInternal(); @@ -89,8 +88,8 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, // Called when the decoder finishes its task. void MediaDecoderCallback( bool is_audio, MediaCodecStatus status, - base::TimeDelta presentation_timestamp, - size_t audio_output_bytes); + base::TimeDelta current_presentation_timestamp, + base::TimeDelta max_presentation_timestamp); // Gets MediaCrypto object from |drm_bridge_|. base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); @@ -133,10 +132,14 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, void OnDecoderStarved(); // Starts the |decoder_starvation_callback_| task with the timeout value. - // |presentation_timestamp| - The presentation timestamp used for starvation - // timeout computations. It represents the timestamp of the last piece of - // decoded data. - void StartStarvationCallback(base::TimeDelta presentation_timestamp); + // |current_presentation_timestamp| - The presentation timestamp used for + // starvation timeout computations. It represents the current timestamp of + // rendered data. + // |max_presentation_timestamp| - The presentation timestamp if all the + // decoded data are rendered. + void StartStarvationCallback( + base::TimeDelta current_presentation_timestamp, + base::TimeDelta max_presentation_timestamp); // Schedules a seek event in |pending_events_| and calls StopDecode() on all // the MediaDecoderJobs. Sets clock to |seek_time|, and resets @@ -266,9 +269,6 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, // elapses. base::CancelableClosure decoder_starvation_callback_; - // Object to calculate the current audio timestamp for A/V sync. - scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; - MediaDrmBridge* drm_bridge_; // No decryption key available to decrypt the encrypted buffer. In this case, |