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

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

Issue 898843002: Use cached Key frames to avoid browser seek (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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_decoder_job.h
diff --git a/media/base/android/media_decoder_job.h b/media/base/android/media_decoder_job.h
index 9a3e76a5b27c5cda956958945316b198515d1ace..29b595d5199913b1685a0f609fe1eb24af48694c 100644
--- a/media/base/android/media_decoder_job.h
+++ b/media/base/android/media_decoder_job.h
@@ -27,6 +27,13 @@ class MediaDrmBridge;
// data request will be sent to the renderer.
class MediaDecoderJob {
public:
+ // Return value when Decode() is called.
+ enum MediaDecoderJobStatus {
+ STATUS_SUCCESS,
+ STATUS_KEY_FRAME_REQUIRED,
+ STATUS_FAILURE,
+ };
+
struct Deleter {
inline void operator()(MediaDecoderJob* ptr) const { ptr->Release(); }
};
@@ -57,13 +64,11 @@ class MediaDecoderJob {
// Called by MediaSourcePlayer to decode some data.
// |callback| - Run when decode operation has completed.
//
- // Returns true if the next decode was started and |callback| will be
- // called when the decode operation is complete.
- // Returns false if |media_codec_bridge_| cannot be created; |callback| is
- // ignored and will not be called.
- bool Decode(base::TimeTicks start_time_ticks,
- base::TimeDelta start_presentation_timestamp,
- const DecoderCallback& callback);
+ // Returns STATUS_SUCCESS on success, or STATUS_FAILURE on failure, or
+ // STATUS_KEY_FRAME_REQUIRED if a browser seek is required.
wolenetz 2015/02/04 21:07:23 nit: retain comment around |callback| usage
qinmin 2015/02/04 23:11:23 Done.
+ MediaDecoderJobStatus Decode(base::TimeTicks start_time_ticks,
+ base::TimeDelta start_presentation_timestamp,
+ const DecoderCallback& callback);
// Called to stop the last Decode() early.
// If the decoder is in the process of decoding the next frame, then
@@ -132,12 +137,18 @@ class MediaDecoderJob {
// Releases the |media_codec_bridge_|.
void ReleaseMediaCodecBridge();
+ // Sets the current frame to a previously cached key frame. Returns true if
+ // a key frame is found, or false otherwise.
+ // TODO(qinmin): add UMA to study the cache hit ratio for key frames.
+ bool SetCurrentFrameToPreviouslyCachedKeyFrame();
+
MediaDrmBridge* drm_bridge() { return drm_bridge_; }
void set_is_content_encrypted(bool is_content_encrypted) {
is_content_encrypted_ = is_content_encrypted;
}
+ virtual bool is_video() { return false; }
bool need_to_reconfig_decoder_job_;
scoped_ptr<MediaCodecBridge> media_codec_bridge_;
@@ -209,18 +220,16 @@ class MediaDecoderJob {
// Called when the decoder is completely drained and is ready to be released.
void OnDecoderDrained();
- // Creates |media_codec_bridge_| for decoding purpose. Returns true if it is
- // created, or false otherwise.
- bool CreateMediaCodecBridge();
-
- // Called when an access unit is consumed by the decoder. |is_config_change|
- // indicates whether the current access unit is a config change. If it is
- // true, the next access unit is guarateed to be an I-frame.
- virtual void CurrentDataConsumed(bool is_config_change) {}
+ // Creates |media_codec_bridge_| for decoding purpose.
+ // Returns STATUS_SUCCESS on success, or STATUS_FAILURE on failure, or
+ // STATUS_KEY_FRAME_REQUIRED if a browser seek is required.
+ MediaDecoderJobStatus CreateMediaCodecBridge();
// Implemented by the child class to create |media_codec_bridge_| for a
- // particular stream. Returns true if it is created, or false otherwise.
- virtual bool CreateMediaCodecBridgeInternal() = 0;
+ // particular stream.
+ // Returns STATUS_SUCCESS on success, or STATUS_FAILURE on failure, or
+ // STATUS_KEY_FRAME_REQUIRED if a browser seek is required.
+ virtual MediaDecoderJobStatus CreateMediaCodecBridgeInternal() = 0;
// Returns true if the |configs| doesn't match the current demuxer configs
// the decoder job has.

Powered by Google App Engine
This is Rietveld 408576698