summaryrefslogtreecommitdiffstats
path: root/media/base/android/media_source_player.h
diff options
context:
space:
mode:
authorqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-20 21:45:01 +0000
committerqinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-20 21:45:01 +0000
commitfda22cc637871c06f9ff19fe8b63c43e46511bce (patch)
treeb154c297949be223856ea469f29ee5f72b73fbba /media/base/android/media_source_player.h
parentcecc8346b4c3bc90aa2091452bf96dd142271a05 (diff)
downloadchromium_src-fda22cc637871c06f9ff19fe8b63c43e46511bce.zip
chromium_src-fda22cc637871c06f9ff19fe8b63c43e46511bce.tar.gz
chromium_src-fda22cc637871c06f9ff19fe8b63c43e46511bce.tar.bz2
Reducing the IPC latency for MSE video decoding
For MSE, we decode the data in the browser process. When all the data is decoded, we started to request data from the render process. So the decoder is idle during the IPC round trip + data copy time This may introduce some issues as this delay may impact smooth video playbacks. This change tries to solve the above problem: 1. Divide data into 2 chunks in the browser process 2. When decoding 1 chunk, check if the chunk is reaching its end. If so, request data for the current chunk, and start decoding the next chunk. 3. When new data arrives, store them in the next chunk (since the current one might still be being decoded) This change also: 1. reduced the buffered data size at the browser side 2. fixes crbug.com/306314 if there is pending data requests across release()/start() 3. fixed all the unit tests behaviors. The new approach should be well tested by all the unit tests we have. BUG=306314 Review URL: https://codereview.chromium.org/196133020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/android/media_source_player.h')
-rw-r--r--media/base/android/media_source_player.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h
index 168126f..ed0483c 100644
--- a/media/base/android/media_source_player.h
+++ b/media/base/android/media_source_player.h
@@ -50,7 +50,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE;
virtual void Start() OVERRIDE;
virtual void Pause(bool is_media_related_action ALLOW_UNUSED) OVERRIDE;
- virtual void SeekTo(const base::TimeDelta& timestamp) OVERRIDE;
+ virtual void SeekTo(base::TimeDelta timestamp) OVERRIDE;
virtual void Release() OVERRIDE;
virtual void SetVolume(double volume) OVERRIDE;
virtual int GetVideoWidth() OVERRIDE;
@@ -70,14 +70,14 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
virtual void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) OVERRIDE;
virtual void OnDemuxerDataAvailable(const DemuxerData& params) OVERRIDE;
virtual void OnDemuxerSeekDone(
- const base::TimeDelta& actual_browser_seek_time) OVERRIDE;
+ base::TimeDelta actual_browser_seek_time) OVERRIDE;
virtual void OnDemuxerDurationChanged(base::TimeDelta duration) OVERRIDE;
private:
friend class MediaSourcePlayerTest;
// Update the current timestamp.
- void UpdateTimestamps(const base::TimeDelta& presentation_timestamp,
+ void UpdateTimestamps(base::TimeDelta presentation_timestamp,
size_t audio_output_bytes);
// Helper function for starting media playback.
@@ -89,7 +89,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// Called when the decoder finishes its task.
void MediaDecoderCallback(
bool is_audio, MediaCodecStatus status,
- const base::TimeDelta& presentation_timestamp,
+ base::TimeDelta presentation_timestamp,
size_t audio_output_bytes);
// Gets MediaCrypto object from |drm_bridge_|.
@@ -104,6 +104,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// Helper method to clear any pending |SURFACE_CHANGE_EVENT_PENDING|
// and reset |video_decoder_job_| to null.
void ResetVideoDecoderJob();
+ void ResetAudioDecoderJob();
// Helper methods to configure the decoder jobs.
void ConfigureVideoDecoderJob();
@@ -135,13 +136,13 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// |presentation_timestamp| - The presentation timestamp used for starvation
// timeout computations. It represents the timestamp of the last piece of
// decoded data.
- void StartStarvationCallback(const base::TimeDelta& presentation_timestamp);
+ void StartStarvationCallback(base::TimeDelta presentation_timestamp);
// Schedules a seek event in |pending_events_| and calls StopDecode() on all
// the MediaDecoderJobs. Sets clock to |seek_time|, and resets
// |pending_seek_|. There must not already be a seek event in
// |pending_events_|.
- void ScheduleSeekEventAndStopDecoding(const base::TimeDelta& seek_time);
+ void ScheduleSeekEventAndStopDecoding(base::TimeDelta seek_time);
// Schedules a browser seek event. We must not currently be processing any
// seek. Note that there is possibility that browser seek of renderer demuxer
@@ -281,6 +282,10 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid,
// Whether |surface_| is currently used by the player.
bool is_surface_in_use_;
+ // Whether there are pending data requests by the decoder.
+ bool has_pending_audio_data_request_;
+ bool has_pending_video_data_request_;
+
// Weak pointer passed to media decoder jobs for callbacks.
// NOTE: Weak pointers must be invalidated before all other member variables.
base::WeakPtrFactory<MediaSourcePlayer> weak_factory_;