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

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

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 4 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (!video_decoder_thread_->RunsTasksOnCurrentThread()) { 95 if (!video_decoder_thread_->RunsTasksOnCurrentThread()) {
96 video_decoder_thread_->PostTask( 96 video_decoder_thread_->PostTask(
97 FROM_HERE, base::Bind(&RTCVideoDecoder::Stop, this, closure)); 97 FROM_HERE, base::Bind(&RTCVideoDecoder::Stop, this, closure));
98 return; 98 return;
99 } 99 }
100 100
101 state_ = kStopped; 101 state_ = kStopped;
102 closure.Run(); 102 closure.Run();
103 } 103 }
104 104
105 const gfx::Size& RTCVideoDecoder::natural_size() {
106 // TODO(vrk): Return natural size when aspect ratio support is implemented.
107 return visible_size_;
108 }
109
110 void RTCVideoDecoder::PrepareForShutdownHack() { 105 void RTCVideoDecoder::PrepareForShutdownHack() {
111 if (!video_decoder_thread_->RunsTasksOnCurrentThread()) { 106 if (!video_decoder_thread_->RunsTasksOnCurrentThread()) {
112 video_decoder_thread_->PostTask( 107 video_decoder_thread_->PostTask(
113 FROM_HERE, base::Bind(&RTCVideoDecoder::PrepareForShutdownHack, 108 FROM_HERE, base::Bind(&RTCVideoDecoder::PrepareForShutdownHack,
114 this)); 109 this));
115 return; 110 return;
116 } 111 }
117 shutting_down_ = true; 112 shutting_down_ = true;
118 CancelPendingRead(); 113 CancelPendingRead();
119 } 114 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (!got_first_frame_) { 147 if (!got_first_frame_) {
153 start_time_ = timestamp; 148 start_time_ = timestamp;
154 got_first_frame_ = true; 149 got_first_frame_ = true;
155 } 150 }
156 151
157 // Always allocate a new frame. 152 // Always allocate a new frame.
158 // 153 //
159 // TODO(scherkus): migrate this to proper buffer recycling. 154 // TODO(scherkus): migrate this to proper buffer recycling.
160 scoped_refptr<media::VideoFrame> video_frame = 155 scoped_refptr<media::VideoFrame> video_frame =
161 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, 156 media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
162 visible_size_.width(), 157 visible_size_,
163 visible_size_.height(), 158 visible_size_,
164 timestamp - start_time_); 159 timestamp - start_time_);
165 last_frame_timestamp_ = timestamp; 160 last_frame_timestamp_ = timestamp;
166 161
167 // Aspect ratio unsupported; DCHECK when there are non-square pixels. 162 // Aspect ratio unsupported; DCHECK when there are non-square pixels.
168 DCHECK_EQ(frame->GetPixelWidth(), 1u); 163 DCHECK_EQ(frame->GetPixelWidth(), 1u);
169 DCHECK_EQ(frame->GetPixelHeight(), 1u); 164 DCHECK_EQ(frame->GetPixelHeight(), 1u);
170 165
171 int y_rows = frame->GetHeight(); 166 int y_rows = frame->GetHeight();
172 int uv_rows = frame->GetHeight() / 2; // YV12 format. 167 int uv_rows = frame->GetHeight() / 2; // YV12 format.
173 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); 168 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame);
(...skipping 26 matching lines...) Expand all
200 DCHECK(main_thread_->RunsTasksOnCurrentThread()); 195 DCHECK(main_thread_->RunsTasksOnCurrentThread());
201 if (video_track_) { 196 if (video_track_) {
202 video_track_->RemoveRenderer(this); 197 video_track_->RemoveRenderer(this);
203 video_track_ = NULL; 198 video_track_ = NULL;
204 } 199 }
205 } 200 }
206 201
207 RTCVideoDecoder::~RTCVideoDecoder() { 202 RTCVideoDecoder::~RTCVideoDecoder() {
208 DCHECK_NE(kNormal, state_); 203 DCHECK_NE(kNormal, state_);
209 } 204 }
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.h ('k') | content/renderer/media/rtc_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698