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

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

Issue 10071038: RefCounted types should not have public destructors, content/browser part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright bump Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/rtc_video_decoder.h" 5 #include "content/renderer/media/rtc_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 18 matching lines...) Expand all
29 29
30 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop, 30 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop,
31 const std::string& url) 31 const std::string& url)
32 : message_loop_(message_loop), 32 : message_loop_(message_loop),
33 visible_size_(640, 480), 33 visible_size_(640, 480),
34 url_(url), 34 url_(url),
35 state_(kUnInitialized), 35 state_(kUnInitialized),
36 got_first_frame_(false) { 36 got_first_frame_(false) {
37 } 37 }
38 38
39 RTCVideoDecoder::~RTCVideoDecoder() {}
40
41 void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
42 const PipelineStatusCB& status_cb,
43 const StatisticsCB& statistics_cb) {
44 if (MessageLoop::current() != message_loop_) {
45 message_loop_->PostTask(
46 FROM_HERE,
47 base::Bind(&RTCVideoDecoder::Initialize, this,
48 make_scoped_refptr(demuxer_stream),
49 status_cb, statistics_cb));
50 return;
51 }
52
53 DCHECK_EQ(MessageLoop::current(), message_loop_);
54 state_ = kNormal;
55 status_cb.Run(PIPELINE_OK);
56
57 // TODO(acolwell): Implement stats.
58 }
59
60 void RTCVideoDecoder::Play(const base::Closure& callback) { 39 void RTCVideoDecoder::Play(const base::Closure& callback) {
61 if (MessageLoop::current() != message_loop_) { 40 if (MessageLoop::current() != message_loop_) {
62 message_loop_->PostTask(FROM_HERE, 41 message_loop_->PostTask(FROM_HERE,
63 base::Bind(&RTCVideoDecoder::Play, this, callback)); 42 base::Bind(&RTCVideoDecoder::Play, this, callback));
64 return; 43 return;
65 } 44 }
66 45
67 DCHECK_EQ(MessageLoop::current(), message_loop_); 46 DCHECK_EQ(MessageLoop::current(), message_loop_);
68 47
69 callback.Run(); 48 callback.Run();
70 } 49 }
71 50
51 void RTCVideoDecoder::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {
52 if (MessageLoop::current() != message_loop_) {
53 message_loop_->PostTask(FROM_HERE,
54 base::Bind(&RTCVideoDecoder::Seek, this,
55 time, cb));
56 return;
57 }
58
59 DCHECK_EQ(MessageLoop::current(), message_loop_);
60 state_ = kNormal;
61 cb.Run(PIPELINE_OK);
62 }
63
72 void RTCVideoDecoder::Pause(const base::Closure& callback) { 64 void RTCVideoDecoder::Pause(const base::Closure& callback) {
73 if (MessageLoop::current() != message_loop_) { 65 if (MessageLoop::current() != message_loop_) {
74 message_loop_->PostTask(FROM_HERE, 66 message_loop_->PostTask(FROM_HERE,
75 base::Bind(&RTCVideoDecoder::Pause, 67 base::Bind(&RTCVideoDecoder::Pause,
76 this, callback)); 68 this, callback));
77 return; 69 return;
78 } 70 }
79 71
80 DCHECK_EQ(MessageLoop::current(), message_loop_); 72 DCHECK_EQ(MessageLoop::current(), message_loop_);
81 73
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return; 112 return;
121 } 113 }
122 114
123 DCHECK_EQ(MessageLoop::current(), message_loop_); 115 DCHECK_EQ(MessageLoop::current(), message_loop_);
124 116
125 state_ = kStopped; 117 state_ = kStopped;
126 118
127 VideoDecoder::Stop(callback); 119 VideoDecoder::Stop(callback);
128 } 120 }
129 121
130 void RTCVideoDecoder::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { 122 void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
123 const PipelineStatusCB& status_cb,
124 const StatisticsCB& statistics_cb) {
131 if (MessageLoop::current() != message_loop_) { 125 if (MessageLoop::current() != message_loop_) {
132 message_loop_->PostTask(FROM_HERE, 126 message_loop_->PostTask(
133 base::Bind(&RTCVideoDecoder::Seek, this, 127 FROM_HERE,
134 time, cb)); 128 base::Bind(&RTCVideoDecoder::Initialize, this,
135 return; 129 make_scoped_refptr(demuxer_stream),
130 status_cb, statistics_cb));
131 return;
136 } 132 }
137 133
138 DCHECK_EQ(MessageLoop::current(), message_loop_); 134 DCHECK_EQ(MessageLoop::current(), message_loop_);
139 state_ = kNormal; 135 state_ = kNormal;
140 cb.Run(PIPELINE_OK); 136 status_cb.Run(PIPELINE_OK);
137
138 // TODO(acolwell): Implement stats.
141 } 139 }
142 140
143 void RTCVideoDecoder::Read(const ReadCB& callback) { 141 void RTCVideoDecoder::Read(const ReadCB& callback) {
144 if (MessageLoop::current() != message_loop_) { 142 if (MessageLoop::current() != message_loop_) {
145 message_loop_->PostTask( 143 message_loop_->PostTask(
146 FROM_HERE, 144 FROM_HERE,
147 base::Bind(&RTCVideoDecoder::Read, this, callback)); 145 base::Bind(&RTCVideoDecoder::Read, this, callback));
148 return; 146 return;
149 } 147 }
150 DCHECK_EQ(MessageLoop::current(), message_loop_); 148 DCHECK_EQ(MessageLoop::current(), message_loop_);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 210
213 int y_rows = frame->GetHeight(); 211 int y_rows = frame->GetHeight();
214 int uv_rows = frame->GetHeight() / 2; // YV12 format. 212 int uv_rows = frame->GetHeight() / 2; // YV12 format.
215 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); 213 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame);
216 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); 214 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame);
217 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); 215 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame);
218 216
219 read_cb.Run(kOk, video_frame); 217 read_cb.Run(kOk, video_frame);
220 return true; 218 return true;
221 } 219 }
220
221 RTCVideoDecoder::~RTCVideoDecoder() {}
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.h ('k') | content/renderer/media/video_capture_impl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698