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

Side by Side Diff: content/renderer/media/ipc_video_decoder.cc

Issue 6969026: Convert Filter::Seek() to use new callback system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More CR fixes Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/ipc_video_decoder.h ('k') | media/base/composite_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/ipc_video_decoder.h" 5 #include "content/renderer/media/ipc_video_decoder.h"
6 6
7 #include "base/task.h" 7 #include "base/task.h"
8 #include "content/common/child_process.h" 8 #include "content/common/child_process.h"
9 #include "content/renderer/renderer_gl_context.h" 9 #include "content/renderer/renderer_gl_context.h"
10 #include "media/base/callback.h" 10 #include "media/base/callback.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 callback->Run(); 95 callback->Run();
96 delete callback; 96 delete callback;
97 } 97 }
98 98
99 void IpcVideoDecoder::Flush(media::FilterCallback* callback) { 99 void IpcVideoDecoder::Flush(media::FilterCallback* callback) {
100 flush_callback_.reset(callback); 100 flush_callback_.reset(callback);
101 decode_engine_->Flush(); 101 decode_engine_->Flush();
102 } 102 }
103 103
104 void IpcVideoDecoder::Seek(base::TimeDelta time, 104 void IpcVideoDecoder::Seek(base::TimeDelta time,
105 media::FilterCallback* callback) { 105 const media::FilterStatusCB& cb) {
106 seek_callback_.reset(callback); 106 seek_cb_ = cb;
107 decode_engine_->Seek(); 107 decode_engine_->Seek();
108 } 108 }
109 109
110 void IpcVideoDecoder::OnInitializeComplete(const media::VideoCodecInfo& info) { 110 void IpcVideoDecoder::OnInitializeComplete(const media::VideoCodecInfo& info) {
111 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current()); 111 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current());
112 112
113 if (info.success) { 113 if (info.success) {
114 media_format_.SetAsInteger(media::MediaFormat::kSurfaceType, 114 media_format_.SetAsInteger(media::MediaFormat::kSurfaceType,
115 media::VideoFrame::TYPE_GL_TEXTURE); 115 media::VideoFrame::TYPE_GL_TEXTURE);
116 media_format_.SetAsInteger(media::MediaFormat::kSurfaceFormat, 116 media_format_.SetAsInteger(media::MediaFormat::kSurfaceFormat,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void IpcVideoDecoder::OnFlushComplete() { 150 void IpcVideoDecoder::OnFlushComplete() {
151 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current()); 151 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current());
152 flush_callback_->Run(); 152 flush_callback_->Run();
153 flush_callback_.reset(); 153 flush_callback_.reset();
154 } 154 }
155 155
156 void IpcVideoDecoder::OnSeekComplete() { 156 void IpcVideoDecoder::OnSeekComplete() {
157 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current()); 157 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current());
158 seek_callback_->Run(); 158 ResetAndRunCB(&seek_cb_, media::PIPELINE_OK);
159 seek_callback_.reset();
160 } 159 }
161 160
162 void IpcVideoDecoder::OnError() { 161 void IpcVideoDecoder::OnError() {
163 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current()); 162 DCHECK_EQ(ChildProcess::current()->io_message_loop(), MessageLoop::current());
164 host()->SetError(media::PIPELINE_ERROR_DECODE); 163 host()->SetError(media::PIPELINE_ERROR_DECODE);
165 } 164 }
166 165
167 // This methid is called by Demuxer after a demuxed packet is produced. 166 // This methid is called by Demuxer after a demuxed packet is produced.
168 void IpcVideoDecoder::OnReadComplete(media::Buffer* buffer) { 167 void IpcVideoDecoder::OnReadComplete(media::Buffer* buffer) {
169 decode_engine_->ConsumeVideoSample(buffer); 168 decode_engine_->ConsumeVideoSample(buffer);
(...skipping 24 matching lines...) Expand all
194 statistics_callback_->Run(statistics); 193 statistics_callback_->Run(statistics);
195 194
196 VideoFrameReady(video_frame); 195 VideoFrameReady(video_frame);
197 } 196 }
198 197
199 // This method is called by VideoDecodeEngine to request a video frame. The 198 // This method is called by VideoDecodeEngine to request a video frame. The
200 // request is passed to demuxer. 199 // request is passed to demuxer.
201 void IpcVideoDecoder::ProduceVideoSample(scoped_refptr<media::Buffer> buffer) { 200 void IpcVideoDecoder::ProduceVideoSample(scoped_refptr<media::Buffer> buffer) {
202 demuxer_stream_->Read(base::Bind(&IpcVideoDecoder::OnReadComplete, this)); 201 demuxer_stream_->Read(base::Bind(&IpcVideoDecoder::OnReadComplete, this));
203 } 202 }
OLDNEW
« no previous file with comments | « content/renderer/media/ipc_video_decoder.h ('k') | media/base/composite_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698