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

Unified Diff: media/filters/vpx_video_decoder.cc

Issue 297553002: Add callback in VideoDecoder and AudioDecoder to return decoded frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/filters/vpx_video_decoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/vpx_video_decoder.cc
diff --git a/media/filters/vpx_video_decoder.cc b/media/filters/vpx_video_decoder.cc
index 23a90b2f1c2b4f4d2cd87c27329b5ddbe185c21d..5cec72913b6f56a0c4fea861957bbf9d894d71ff 100644
--- a/media/filters/vpx_video_decoder.cc
+++ b/media/filters/vpx_video_decoder.cc
@@ -215,7 +215,8 @@ VpxVideoDecoder::~VpxVideoDecoder() {
void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool low_delay,
- const PipelineStatusCB& status_cb) {
+ const PipelineStatusCB& status_cb,
+ const OutputCB& output_cb) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(config.IsValidConfig());
DCHECK(!config.is_encrypted());
@@ -229,6 +230,7 @@ void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config,
// Success!
config_ = config;
state_ = kNormal;
+ output_cb_ = BindToCurrentLoop(output_cb);
status_cb.Run(PIPELINE_OK);
}
@@ -314,13 +316,13 @@ void VpxVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
decode_cb_ = BindToCurrentLoop(decode_cb);
if (state_ == kError) {
- base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL);
+ base::ResetAndReturn(&decode_cb_).Run(kDecodeError);
return;
}
// Return empty frames if decoding has finished.
if (state_ == kDecodeFinished) {
- base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEOSFrame());
+ base::ResetAndReturn(&decode_cb_).Run(kOk);
return;
}
@@ -352,24 +354,22 @@ void VpxVideoDecoder::DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer) {
// Transition to kDecodeFinished on the first end of stream buffer.
if (state_ == kNormal && buffer->end_of_stream()) {
state_ = kDecodeFinished;
- base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEOSFrame());
+ output_cb_.Run(VideoFrame::CreateEOSFrame());
+ base::ResetAndReturn(&decode_cb_).Run(kOk);
return;
}
scoped_refptr<VideoFrame> video_frame;
if (!VpxDecode(buffer, &video_frame)) {
state_ = kError;
- base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL);
+ base::ResetAndReturn(&decode_cb_).Run(kDecodeError);
return;
}
- // If we didn't get a frame we need more data.
- if (!video_frame.get()) {
- base::ResetAndReturn(&decode_cb_).Run(kNotEnoughData, NULL);
- return;
- }
+ base::ResetAndReturn(&decode_cb_).Run(kOk);
- base::ResetAndReturn(&decode_cb_).Run(kOk, video_frame);
+ if (video_frame)
+ output_cb_.Run(video_frame);
}
bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer,
« no previous file with comments | « media/filters/vpx_video_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698