Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1222)

Unified Diff: media/base/android/media_source_player.h

Issue 16098014: Handle config changes for MSE on android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_source_player.h
diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h
index 0163eaa80d1c07dc76dd57cad28bf78428227c41..f726c4f453da1b820119eb9f8c16363553f80fd9 100644
--- a/media/base/android/media_source_player.h
+++ b/media/base/android/media_source_player.h
@@ -59,6 +59,9 @@ class MediaDecoderJob {
// Causes this instance to be deleted on the thread it is bound to.
void Release();
+ // Called on the UI thread to indicate that one decode cycle has completed.
+ void OnDecodeCompleted();
+
protected:
MediaDecoderJob(base::Thread* thread, bool is_audio);
@@ -96,8 +99,12 @@ class MediaDecoderJob {
// Whether this is an audio decoder.
bool is_audio_;
- // Weak pointer passed to media decoder jobs for callbacks.
+ // Weak pointer passed to media decoder jobs for callbacks. It is bounded to
+ // the decoder thread.
base::WeakPtrFactory<MediaDecoderJob> weak_this_;
+
+ // Whether the decoder is actively decoding data.
+ bool decoding_;
};
typedef scoped_ptr<MediaDecoderJob, MediaDecoderJob::Deleter>
@@ -131,7 +138,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
virtual bool CanSeekForward() OVERRIDE;
virtual bool CanSeekBackward() OVERRIDE;
virtual bool IsPlayerReady() OVERRIDE;
- virtual void OnSeekRequestAck() OVERRIDE;
+ virtual void OnSeekRequestAck(unsigned request_id) OVERRIDE;
acolwell GONE FROM CHROMIUM 2013/06/04 15:19:14 nit:ditto
qinmin 2013/06/04 19:03:23 Done.
// Called when the demuxer is ready.
virtual void DemuxerReady(
@@ -162,6 +169,9 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
// Handle pending events when all the decoder jobs finished.
void ProcessPendingEvents();
+ // Helper method to create the decoder jobs.
+ void CreateMediaDecoderJobs(bool config_change);
+
// Flush the decoders and clean up all the data needs to be decoded.
void ClearDecodingData();
@@ -177,6 +187,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
NO_EVENT_PENDING = 0,
SEEK_EVENT_PENDING = 1 << 0,
SURFACE_CHANGE_EVENT_PENDING = 1 << 1,
+ CONFIG_CHANGE_EVENT_PENDING = 1 << 2,
};
// Pending event that the player needs to do.
unsigned pending_event_;
@@ -184,6 +195,9 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
// Number of active decoding tasks.
int active_decoding_tasks_;
+ // ID to keep track of whether all the seek requests are acked.
+ unsigned seek_request_id_;
+
// Stats about the media.
base::TimeDelta duration_;
int width_;
@@ -208,7 +222,10 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
base::Time start_wallclock_time_;
base::TimeDelta start_presentation_timestamp_;
- // Decoder jobs.
+ // The surface object currently owned by the player.
+ gfx::ScopedJavaSurface surface_;
+
+ // Decoder jobs
ScopedMediaDecoderJob audio_decoder_job_;
ScopedMediaDecoderJob video_decoder_job_;
@@ -222,9 +239,6 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_audio_;
MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_video_;
- // Whether the video decoder need to use anempty surface.
- bool use_empty_surface_;
-
// Weak pointer passed to media decoder jobs for callbacks.
base::WeakPtrFactory<MediaSourcePlayer> weak_this_;

Powered by Google App Engine
This is Rietveld 408576698