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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 10248002: Report VideoDecoder status through ReadCB instead of through FilterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 93dfbfb93881e340b5a4a6d155521f6a826dffb3..55fe031338ff7172c84fabf00f1a536f2cff4cf7 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -5,6 +5,7 @@
#include "media/filters/ffmpeg_video_decoder.h"
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
@@ -212,7 +213,7 @@ void FFmpegVideoDecoder::DoRead(const ReadCB& read_cb) {
// Return empty frames if decoding has finished.
if (state_ == kDecodeFinished) {
- read_cb.Run(VideoFrame::CreateEmptyFrame());
+ read_cb.Run(VideoFrame::CreateEmptyFrame(), kOk);
return;
}
@@ -288,8 +289,7 @@ void FFmpegVideoDecoder::DoDecodeBuffer(const scoped_refptr<Buffer>& buffer) {
unencrypted_buffer = decryptor_.Decrypt(buffer);
if (!unencrypted_buffer || !unencrypted_buffer->GetDataSize()) {
state_ = kDecodeFinished;
- DeliverFrame(VideoFrame::CreateEmptyFrame());
- host()->SetError(PIPELINE_ERROR_DECRYPT);
+ base::ResetAndReturn(&read_cb_).Run(NULL, kDecryptError);
return;
}
}
@@ -297,8 +297,7 @@ void FFmpegVideoDecoder::DoDecodeBuffer(const scoped_refptr<Buffer>& buffer) {
scoped_refptr<VideoFrame> video_frame;
if (!Decode(unencrypted_buffer, &video_frame)) {
state_ = kDecodeFinished;
- DeliverFrame(VideoFrame::CreateEmptyFrame());
- host()->SetError(PIPELINE_ERROR_DECODE);
+ base::ResetAndReturn(&read_cb_).Run(NULL, kDecodeError);
return;
}
@@ -423,9 +422,7 @@ bool FFmpegVideoDecoder::Decode(
void FFmpegVideoDecoder::DeliverFrame(
const scoped_refptr<VideoFrame>& video_frame) {
// Reset the callback before running to protect against reentrancy.
- ReadCB read_cb = read_cb_;
- read_cb_.Reset();
- read_cb.Run(video_frame);
+ base::ResetAndReturn(&read_cb_).Run(video_frame, kOk);
}
void FFmpegVideoDecoder::ReleaseFFmpegResources() {

Powered by Google App Engine
This is Rietveld 408576698