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

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

Issue 10832087: Remove VideoDecoderConfig.frame_rate_xxx() & VideoFrame:Get/SetDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address more CR comments. 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
« no previous file with comments | « no previous file | content/renderer/media/rtc_video_decoder.cc » ('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) 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/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 "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "content/renderer/media/video_capture_impl_manager.h" 9 #include "content/renderer/media/video_capture_impl_manager.h"
10 #include "media/base/demuxer_stream.h" 10 #include "media/base/demuxer_stream.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 got_first_frame_ = true; 235 got_first_frame_ = true;
236 } 236 }
237 237
238 // Always allocate a new frame. 238 // Always allocate a new frame.
239 // 239 //
240 // TODO(scherkus): migrate this to proper buffer recycling. 240 // TODO(scherkus): migrate this to proper buffer recycling.
241 scoped_refptr<media::VideoFrame> video_frame = 241 scoped_refptr<media::VideoFrame> video_frame =
242 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, 242 media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
243 natural_size_.width(), 243 natural_size_.width(),
244 natural_size_.height(), 244 natural_size_.height(),
245 buf->timestamp - start_time_, 245 buf->timestamp - start_time_);
246 base::TimeDelta::FromMilliseconds(0));
247 246
248 last_frame_timestamp_ = buf->timestamp; 247 last_frame_timestamp_ = buf->timestamp;
249 uint8* buffer = buf->memory_pointer; 248 uint8* buffer = buf->memory_pointer;
250 249
251 // Assume YV12 format. Note that camera gives YUV and media pipeline video 250 // Assume YV12 format. Note that camera gives YUV and media pipeline video
252 // renderer asks for YVU. The following code did the conversion. 251 // renderer asks for YVU. The following code did the conversion.
253 DCHECK_EQ(capability_.color, media::VideoCaptureCapability::kI420); 252 DCHECK_EQ(capability_.color, media::VideoCaptureCapability::kI420);
254 int y_width = buf->width; 253 int y_width = buf->width;
255 int y_height = buf->height; 254 int y_height = buf->height;
256 int uv_width = buf->width / 2; 255 int uv_width = buf->width / 2;
257 int uv_height = buf->height / 2; // YV12 format. 256 int uv_height = buf->height / 2; // YV12 format.
258 CopyYPlane(buffer, y_width, y_height, video_frame); 257 CopyYPlane(buffer, y_width, y_height, video_frame);
259 buffer += y_width * y_height; 258 buffer += y_width * y_height;
260 CopyUPlane(buffer, uv_width, uv_height, video_frame); 259 CopyUPlane(buffer, uv_width, uv_height, video_frame);
261 buffer += uv_width * uv_height; 260 buffer += uv_width * uv_height;
262 CopyVPlane(buffer, uv_width, uv_height, video_frame); 261 CopyVPlane(buffer, uv_width, uv_height, video_frame);
263 262
264 DeliverFrame(video_frame); 263 DeliverFrame(video_frame);
265 capture->FeedBuffer(buf); 264 capture->FeedBuffer(buf);
266 } 265 }
267 266
268 void CaptureVideoDecoder::DeliverFrame( 267 void CaptureVideoDecoder::DeliverFrame(
269 const scoped_refptr<media::VideoFrame>& video_frame) { 268 const scoped_refptr<media::VideoFrame>& video_frame) {
270 // Reset the callback before running to protect against reentrancy. 269 // Reset the callback before running to protect against reentrancy.
271 base::ResetAndReturn(&read_cb_).Run(kOk, video_frame); 270 base::ResetAndReturn(&read_cb_).Run(kOk, video_frame);
272 } 271 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/rtc_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698