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

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

Issue 1242913004: MediaCodecPlayer implementation (stage 3 - browser seek and surface change) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-seek
Patch Set: Fixed the check whether surface is empty, faster stopping after SyncStop, cleanup Created 5 years, 5 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_codec_video_decoder.cc
diff --git a/media/base/android/media_codec_video_decoder.cc b/media/base/android/media_codec_video_decoder.cc
index f44b81931bdb0f343953f85aa7260d915719e7a0..81218163afcd14a9f2664eaedd4c906e9efa8e6b 100644
--- a/media/base/android/media_codec_video_decoder.cc
+++ b/media/base/android/media_codec_video_decoder.cc
@@ -75,18 +75,18 @@ void MediaCodecVideoDecoder::ReleaseDecoderResources() {
delayed_buffers_.clear();
}
-void MediaCodecVideoDecoder::SetPendingSurface(gfx::ScopedJavaSurface surface) {
+void MediaCodecVideoDecoder::SetVideoSurface(gfx::ScopedJavaSurface surface) {
DCHECK(media_task_runner_->BelongsToCurrentThread());
+ DVLOG(1) << class_name() << "::" << __FUNCTION__
+ << (surface.IsEmpty() ? " empty" : " non-empty");
+
surface_ = surface.Pass();
- if (surface_.IsEmpty()) {
- // Synchronously stop decoder thread and release MediaCodec
- ReleaseDecoderResources();
- }
+ needs_reconfigure_ = true;
}
-bool MediaCodecVideoDecoder::HasPendingSurface() const {
+bool MediaCodecVideoDecoder::HasVideoSurface() const {
DCHECK(media_task_runner_->BelongsToCurrentThread());
return !surface_.IsEmpty();
@@ -120,12 +120,12 @@ MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() {
// If we cannot find a key frame in cache, the browser seek is needed.
if (!au_queue_.RewindToLastKeyFrame()) {
DVLOG(1) << class_name() << "::" << __FUNCTION__ << " key frame required";
+ return CONFIG_KEY_FRAME_REQUIRED;
+ }
- // The processing of CONFIG_KEY_FRAME_REQUIRED is not implemented yet,
- // return error for now.
- // TODO(timav): Replace this with the following line together with
- // implementing the browser seek:
- // return CONFIG_KEY_FRAME_REQUIRED;
+ if (configs_.video_codec == kUnknownVideoCodec) {
+ DVLOG(0) << class_name() << "::" << __FUNCTION__
+ << " configuration parameters are required";
return CONFIG_FAILURE;
}
@@ -244,6 +244,11 @@ void MediaCodecVideoDecoder::ReleaseDelayedBuffers() {
delayed_buffers_.clear();
}
+void MediaCodecVideoDecoder::ClearDelayedBuffers() {
qinmin 2015/07/22 17:30:33 I think you can merge this function with ReleaseDe
Tima Vaisburd 2015/07/23 00:37:49 Done.
+ // Media thread
+ delayed_buffers_.clear();
+}
+
#ifndef NDEBUG
void MediaCodecVideoDecoder::VerifyUnitIsKeyFrame(
const AccessUnit* unit) const {
« media/base/android/media_codec_player.cc ('K') | « media/base/android/media_codec_video_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698