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

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

Issue 287313002: Pass a TimeTicks along video capture pipeline to represent capture time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/media_stream_video_source.h" 5 #include "content/renderer/media/media_stream_video_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 DCHECK(thread_checker().CalledOnValidThread()); 302 DCHECK(thread_checker().CalledOnValidThread());
303 io_message_loop()->PostTask( 303 io_message_loop()->PostTask(
304 FROM_HERE, 304 FROM_HERE,
305 base::Bind( 305 base::Bind(
306 &FrameDeliverer::AddCallbackWithResolutionOnIO, 306 &FrameDeliverer::AddCallbackWithResolutionOnIO,
307 this, id, callback, max_frame_output_size)); 307 this, id, callback, max_frame_output_size));
308 } 308 }
309 309
310 virtual void DeliverFrameOnIO( 310 virtual void DeliverFrameOnIO(
311 const scoped_refptr<media::VideoFrame>& frame, 311 const scoped_refptr<media::VideoFrame>& frame,
312 const media::VideoCaptureFormat& format) OVERRIDE { 312 const media::VideoCaptureFormat& format,
313 const base::TimeTicks& start_ticks) OVERRIDE {
313 DCHECK(io_message_loop()->BelongsToCurrentThread()); 314 DCHECK(io_message_loop()->BelongsToCurrentThread());
314 TRACE_EVENT0("video", "MediaStreamVideoSource::DeliverFrameOnIO"); 315 TRACE_EVENT0("video", "MediaStreamVideoSource::DeliverFrameOnIO");
315 if (max_output_size_.IsEmpty()) 316 if (max_output_size_.IsEmpty())
316 return; // Frame received before the output has been decided. 317 return; // Frame received before the output has been decided.
317 318
318 scoped_refptr<media::VideoFrame> video_frame(frame); 319 scoped_refptr<media::VideoFrame> video_frame(frame);
319 const gfx::Size& visible_size = frame->visible_rect().size(); 320 const gfx::Size& visible_size = frame->visible_rect().size();
320 if (visible_size.width() > max_output_size_.width() || 321 if (visible_size.width() > max_output_size_.width() ||
321 visible_size.height() > max_output_size_.height()) { 322 visible_size.height() > max_output_size_.height()) {
322 // If |frame| is not the size that is expected, we need to crop it by 323 // If |frame| is not the size that is expected, we need to crop it by
323 // providing a new |visible_rect|. The new visible rect must be within the 324 // providing a new |visible_rect|. The new visible rect must be within the
324 // original |visible_rect|. 325 // original |visible_rect|.
325 gfx::Rect output_rect = frame->visible_rect(); 326 gfx::Rect output_rect = frame->visible_rect();
326 output_rect.ClampToCenteredSize(max_output_size_); 327 output_rect.ClampToCenteredSize(max_output_size_);
327 // TODO(perkj): Allow cropping of textures once http://crbug/362521 is 328 // TODO(perkj): Allow cropping of textures once http://crbug/362521 is
328 // fixed. 329 // fixed.
329 if (frame->format() != media::VideoFrame::NATIVE_TEXTURE) { 330 if (frame->format() != media::VideoFrame::NATIVE_TEXTURE) {
330 video_frame = media::VideoFrame::WrapVideoFrame( 331 video_frame = media::VideoFrame::WrapVideoFrame(
331 frame, 332 frame,
332 output_rect, 333 output_rect,
333 output_rect.size(), 334 output_rect.size(),
334 base::Bind(&ReleaseOriginalFrame, frame)); 335 base::Bind(&ReleaseOriginalFrame, frame));
335 } 336 }
336 } 337 }
337 VideoFrameDeliverer::DeliverFrameOnIO(video_frame, format); 338 VideoFrameDeliverer::DeliverFrameOnIO(video_frame, format, start_ticks);
338 } 339 }
339 340
340 protected: 341 protected:
341 virtual ~FrameDeliverer() { 342 virtual ~FrameDeliverer() {
342 } 343 }
343 344
344 void AddCallbackWithResolutionOnIO( 345 void AddCallbackWithResolutionOnIO(
345 void* id, 346 void* id,
346 const VideoCaptureDeliverFrameCB& callback, 347 const VideoCaptureDeliverFrameCB& callback,
347 const gfx::Size& max_frame_output_size) { 348 const gfx::Size& max_frame_output_size) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 : track(track), 596 : track(track),
596 frame_callback(frame_callback), 597 frame_callback(frame_callback),
597 constraints(constraints), 598 constraints(constraints),
598 callback(callback) { 599 callback(callback) {
599 } 600 }
600 601
601 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { 602 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() {
602 } 603 }
603 604
604 } // namespace content 605 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698