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

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: Rename VideoDecoder::Status to VideoDecoder::DecoderStatus since Status has been polluted by Xlib.h. 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
« no previous file with comments | « media/base/filters.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e61affb05926a0d6274fa1fc0425381abb3870d2 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -5,11 +5,11 @@
#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"
#include "media/base/demuxer_stream.h"
-#include "media/base/filter_host.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/pipeline.h"
@@ -212,7 +212,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(kOk, VideoFrame::CreateEmptyFrame());
return;
}
@@ -288,8 +288,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(kDecryptError, NULL);
return;
}
}
@@ -297,8 +296,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(kDecodeError, NULL);
return;
}
@@ -423,9 +421,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(kOk, video_frame);
}
void FFmpegVideoDecoder::ReleaseFFmpegResources() {
« no previous file with comments | « media/base/filters.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698