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

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

Issue 898843002: Use cached Key frames to avoid browser seek (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 10 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
« no previous file with comments | « media/base/android/video_decoder_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/video_decoder_job.cc
diff --git a/media/base/android/video_decoder_job.cc b/media/base/android/video_decoder_job.cc
index e69426db7752aab98af060756aface45494cb5cf..d34ea28aadacf529b8dfe10abd46af31c9e392ba 100644
--- a/media/base/android/video_decoder_job.cc
+++ b/media/base/android/video_decoder_job.cc
@@ -37,8 +37,7 @@ VideoDecoderJob::VideoDecoderJob(
config_height_(0),
output_width_(0),
output_height_(0),
- request_resources_cb_(request_resources_cb),
- next_video_data_is_iframe_(true) {
+ request_resources_cb_(request_resources_cb) {
}
VideoDecoderJob::~VideoDecoderJob() {}
@@ -61,11 +60,6 @@ bool VideoDecoderJob::HasStream() const {
return video_codec_ != kUnknownVideoCodec;
}
-void VideoDecoderJob::Flush() {
- MediaDecoderJob::Flush();
- next_video_data_is_iframe_ = true;
-}
-
void VideoDecoderJob::ReleaseDecoderResources() {
MediaDecoderJob::ReleaseDecoderResources();
surface_ = gfx::ScopedJavaSurface();
@@ -124,16 +118,17 @@ bool VideoDecoderJob::AreDemuxerConfigsChanged(
config_height_ != configs.video_size.height();
}
-bool VideoDecoderJob::CreateMediaCodecBridgeInternal() {
+MediaDecoderJob::MediaDecoderJobStatus
+ VideoDecoderJob::CreateMediaCodecBridgeInternal() {
if (surface_.IsEmpty()) {
ReleaseMediaCodecBridge();
- return false;
+ return STATUS_FAILURE;
}
- // If the next data is not iframe, return false so that the player need to
- // perform a browser seek.
- if (!next_video_data_is_iframe_)
- return false;
+ // If we cannot find a key frame in cache, browser seek is needed.
+ bool next_video_data_is_iframe = SetCurrentFrameToPreviouslyCachedKeyFrame();
+ if (!next_video_data_is_iframe)
+ return STATUS_KEY_FRAME_REQUIRED;
bool is_secure = is_content_encrypted() && drm_bridge() &&
drm_bridge()->IsProtectedSurfaceRequired();
@@ -143,14 +138,10 @@ bool VideoDecoderJob::CreateMediaCodecBridgeInternal() {
surface_.j_surface().obj(), GetMediaCrypto().obj()));
if (!media_codec_bridge_)
- return false;
+ return STATUS_FAILURE;
request_resources_cb_.Run();
- return true;
-}
-
-void VideoDecoderJob::CurrentDataConsumed(bool is_config_change) {
- next_video_data_is_iframe_ = is_config_change;
+ return STATUS_SUCCESS;
}
bool VideoDecoderJob::UpdateOutputFormat() {
« no previous file with comments | « media/base/android/video_decoder_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698