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

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

Issue 254473010: Refactor MSE implementation on Android to simplify the logic and improve the performance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase after recent config IPC change Created 6 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/video_decoder_job.h
diff --git a/media/base/android/video_decoder_job.h b/media/base/android/video_decoder_job.h
index e981ab8eac7ec0a71a60072cafa72081537e2e6f..cf351be6654d13d6a8c02c031b0359e1687d149c 100644
--- a/media/base/android/video_decoder_job.h
+++ b/media/base/android/video_decoder_job.h
@@ -16,33 +16,35 @@ class VideoCodecBridge;
// Class for managing video decoding jobs.
class VideoDecoderJob : public MediaDecoderJob {
public:
- virtual ~VideoDecoderJob();
-
// Create a new VideoDecoderJob instance.
- // |video_codec| - The video format the object needs to decode.
- // |is_secure| - Whether secure decoding is required.
- // |size| - The natural size of the output frames.
- // |surface| - The surface to render the frames to.
- // |media_crypto| - Handle to a Java object responsible for decrypting the
- // video data.
// |request_data_cb| - Callback used to request more data for the decoder.
// |request_resources_cb| - Callback used to request resources.
// |release_resources_cb| - Callback used to release resources.
- static VideoDecoderJob* Create(const VideoCodec video_codec,
- bool is_secure,
- const gfx::Size& size,
- jobject surface,
- jobject media_crypto,
- const base::Closure& request_data_cb,
- const base::Closure& request_resources_cb,
- const base::Closure& release_resources_cb);
+ // |on_demuxer_config_changed_cb| - Callback used to inform the caller that
+ // demuxer config has changed.
+ VideoDecoderJob(
+ const base::Closure& request_data_cb,
+ const base::Closure& request_resources_cb,
+ const base::Closure& release_resources_cb,
+ const base::Closure& on_demuxer_config_changed_cb);
+ ~VideoDecoderJob();
- private:
- VideoDecoderJob(scoped_ptr<VideoCodecBridge> video_codec_bridge,
- const base::Closure& request_data_cb,
- const base::Closure& request_resources_cb,
- const base::Closure& release_resources_cb);
+ // Passing an java surface object to the codec.
wolenetz 2014/05/21 00:48:04 nit: s/Passing an/Passes/
qinmin 2014/05/22 00:35:55 Done.
+ bool SetVideoSurface(gfx::ScopedJavaSurface surface);
wolenetz 2014/05/21 00:48:04 nit: doc retval
qinmin 2014/05/22 00:35:55 Done.
+
+ // MediaDecoderJob implementation.
+ virtual bool HasStream() const OVERRIDE;
+ virtual void Flush() OVERRIDE;
+ virtual void ReleaseDecoderResources() OVERRIDE;
+
+ bool next_video_data_is_iframe() {
+ return next_video_data_is_iframe_;
+ }
+
+ int width() const { return width_; }
+ int height() const { return height_; }
+ private:
// MediaDecoderJob implementation.
virtual void ReleaseOutputBuffer(
int output_buffer_index,
@@ -50,12 +52,35 @@ class VideoDecoderJob : public MediaDecoderJob {
bool render_output,
base::TimeDelta current_presentation_timestamp,
const ReleaseOutputCompletionCallback& callback) OVERRIDE;
-
virtual bool ComputeTimeToRender() const OVERRIDE;
+ virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) OVERRIDE;
+ virtual bool IsDemuxerConfigChanged(
+ const DemuxerConfigs& configs) const OVERRIDE;
+ virtual bool CreateMediaCodecBridgeInternal() OVERRIDE;
+ virtual void CurrentDataConsumed(bool is_config_change) OVERRIDE;
+ virtual void OnMediaCodecBridgeReleased() OVERRIDE;
+
+ // Returns true if a protected surface is required for video playback.
+ bool IsProtectedSurfaceRequired();
- scoped_ptr<VideoCodecBridge> video_codec_bridge_;
+ // Video configs from the demuxer.
+ VideoCodec video_codec_;
+ int width_;
+ int height_;
+ // The surface object currently owned by the player.
+ gfx::ScopedJavaSurface surface_;
+
+ // Callbacks to inform the caller about decoder resources change.
+ base::Closure request_resources_cb_;
base::Closure release_resources_cb_;
+
+ // Track whether the next access unit is an I-frame. The first access
+ // unit after Flush() and CurrentDataConsumed(true) is guaranteed to be an
+ // I-frame.
+ bool next_video_data_is_iframe_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob);
};
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698