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

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

Issue 8922010: <video> decode in hardware! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years 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
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/capture_video_decoder.h" 5 #include "content/renderer/media/capture_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/renderer/media/video_capture_impl_manager.h" 8 #include "content/renderer/media/video_capture_impl_manager.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
(...skipping 15 matching lines...) Expand all
26 state_(kUnInitialized), 26 state_(kUnInitialized),
27 video_stream_id_(video_stream_id), 27 video_stream_id_(video_stream_id),
28 capture_engine_(NULL) { 28 capture_engine_(NULL) {
29 DCHECK(vc_manager); 29 DCHECK(vc_manager);
30 } 30 }
31 31
32 CaptureVideoDecoder::~CaptureVideoDecoder() {} 32 CaptureVideoDecoder::~CaptureVideoDecoder() {}
33 33
34 void CaptureVideoDecoder::Initialize( 34 void CaptureVideoDecoder::Initialize(
35 media::DemuxerStream* demuxer_stream, 35 media::DemuxerStream* demuxer_stream,
36 const base::Closure& filter_callback, 36 const media::PipelineStatusCB& filter_callback,
37 const media::StatisticsCallback& stat_callback) { 37 const media::StatisticsCallback& stat_callback) {
38 message_loop_proxy_->PostTask( 38 message_loop_proxy_->PostTask(
39 FROM_HERE, 39 FROM_HERE,
40 base::Bind(&CaptureVideoDecoder::InitializeOnDecoderThread, 40 base::Bind(&CaptureVideoDecoder::InitializeOnDecoderThread,
41 this, make_scoped_refptr(demuxer_stream), 41 this, make_scoped_refptr(demuxer_stream),
42 filter_callback, stat_callback)); 42 filter_callback, stat_callback));
43 } 43 }
44 44
45 void CaptureVideoDecoder::Read(const ReadCB& callback) { 45 void CaptureVideoDecoder::Read(const ReadCB& callback) {
46 message_loop_proxy_->PostTask( 46 message_loop_proxy_->PostTask(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 media::VideoCapture* capture, 127 media::VideoCapture* capture,
128 const media::VideoCaptureParams& device_info) { 128 const media::VideoCaptureParams& device_info) {
129 message_loop_proxy_->PostTask( 129 message_loop_proxy_->PostTask(
130 FROM_HERE, 130 FROM_HERE,
131 base::Bind(&CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread, 131 base::Bind(&CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread,
132 this, capture, device_info)); 132 this, capture, device_info));
133 } 133 }
134 134
135 void CaptureVideoDecoder::InitializeOnDecoderThread( 135 void CaptureVideoDecoder::InitializeOnDecoderThread(
136 media::DemuxerStream* demuxer_stream, 136 media::DemuxerStream* demuxer_stream,
137 const base::Closure& filter_callback, 137 const media::PipelineStatusCB& filter_callback,
138 const media::StatisticsCallback& stat_callback) { 138 const media::StatisticsCallback& stat_callback) {
139 DVLOG(1) << "InitializeOnDecoderThread"; 139 DVLOG(1) << "InitializeOnDecoderThread";
140 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 140 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
141 141
142 capture_engine_ = vc_manager_->AddDevice(video_stream_id_, this); 142 capture_engine_ = vc_manager_->AddDevice(video_stream_id_, this);
143 143
144 statistics_callback_ = stat_callback; 144 statistics_callback_ = stat_callback;
145 filter_callback.Run(); 145 filter_callback.Run(media::PIPELINE_OK);
146 state_ = kNormal; 146 state_ = kNormal;
147 } 147 }
148 148
149 void CaptureVideoDecoder::ReadOnDecoderThread(const ReadCB& callback) { 149 void CaptureVideoDecoder::ReadOnDecoderThread(const ReadCB& callback) {
150 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 150 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
151 CHECK(read_cb_.is_null()); 151 CHECK(read_cb_.is_null());
152 read_cb_ = callback; 152 read_cb_ = callback;
153 } 153 }
154 154
155 void CaptureVideoDecoder::PlayOnDecoderThread(const base::Closure& callback) { 155 void CaptureVideoDecoder::PlayOnDecoderThread(const base::Closure& callback) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 capture->FeedBuffer(buf); 263 capture->FeedBuffer(buf);
264 } 264 }
265 265
266 void CaptureVideoDecoder::DeliverFrame( 266 void CaptureVideoDecoder::DeliverFrame(
267 const scoped_refptr<media::VideoFrame>& video_frame) { 267 const scoped_refptr<media::VideoFrame>& video_frame) {
268 // Reset the callback before running to protect against reentrancy. 268 // Reset the callback before running to protect against reentrancy.
269 ReadCB read_cb = read_cb_; 269 ReadCB read_cb = read_cb_;
270 read_cb_.Reset(); 270 read_cb_.Reset();
271 read_cb.Run(video_frame); 271 read_cb.Run(video_frame);
272 } 272 }
OLDNEW
« no previous file with comments | « content/renderer/media/capture_video_decoder.h ('k') | content/renderer/media/capture_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698