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

Side by Side Diff: chrome/renderer/media/cast_rtp_stream.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: comments Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/media/cast_rtp_stream.h" 5 #include "chrome/renderer/media/cast_rtp_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 // This static method is used to forward video frames to |frame_input|. 227 // This static method is used to forward video frames to |frame_input|.
228 static void OnVideoFrame( 228 static void OnVideoFrame(
229 // These parameters are already bound when callback is created. 229 // These parameters are already bound when callback is created.
230 const gfx::Size& expected_coded_size, 230 const gfx::Size& expected_coded_size,
231 const CastRtpStream::ErrorCallback& error_callback, 231 const CastRtpStream::ErrorCallback& error_callback,
232 const scoped_refptr<media::cast::VideoFrameInput> frame_input, 232 const scoped_refptr<media::cast::VideoFrameInput> frame_input,
233 // These parameters are passed for each frame. 233 // These parameters are passed for each frame.
234 const scoped_refptr<media::VideoFrame>& frame, 234 const scoped_refptr<media::VideoFrame>& frame,
235 const media::VideoCaptureFormat& format) { 235 const media::VideoCaptureFormat& format,
236 const base::TimeTicks& estimated_capture_time) {
236 if (frame->coded_size() != expected_coded_size) { 237 if (frame->coded_size() != expected_coded_size) {
237 error_callback.Run("Video frame resolution does not match config."); 238 error_callback.Run("Video frame resolution does not match config.");
238 return; 239 return;
239 } 240 }
240 241
241 const base::TimeTicks now = base::TimeTicks::Now(); 242 base::TimeTicks timestamp = base::TimeTicks::Now();
miu 2014/05/31 02:37:26 nit: Avoid unnecessary probing of system clock wit
243 if (!estimated_capture_time.is_null())
244 timestamp = estimated_capture_time;
242 245
243 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc 246 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
244 TRACE_EVENT_INSTANT2( 247 TRACE_EVENT_INSTANT2(
245 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", 248 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame",
246 TRACE_EVENT_SCOPE_THREAD, 249 TRACE_EVENT_SCOPE_THREAD,
247 "timestamp", now.ToInternalValue(), 250 "timestamp", timestamp.ToInternalValue(),
248 "time_delta", frame->timestamp().ToInternalValue()); 251 "time_delta", frame->timestamp().ToInternalValue());
249 frame_input->InsertRawVideoFrame(frame, now); 252 frame_input->InsertRawVideoFrame(frame, timestamp);
250 } 253 }
251 254
252 // Attach this sink to a video track represented by |track_|. 255 // Attach this sink to a video track represented by |track_|.
253 // Data received from the track will be submitted to |frame_input|. 256 // Data received from the track will be submitted to |frame_input|.
254 void AddToTrack( 257 void AddToTrack(
255 const scoped_refptr<media::cast::VideoFrameInput>& frame_input) { 258 const scoped_refptr<media::cast::VideoFrameInput>& frame_input) {
256 DCHECK(!sink_added_); 259 DCHECK(!sink_added_);
257 sink_added_ = true; 260 sink_added_ = true;
258 AddToVideoTrack( 261 AddToVideoTrack(
259 this, 262 this,
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 537 }
535 538
536 void CastRtpStream::DidEncounterError(const std::string& message) { 539 void CastRtpStream::DidEncounterError(const std::string& message) {
537 // Save the WeakPtr first because the error callback might delete this object. 540 // Save the WeakPtr first because the error callback might delete this object.
538 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); 541 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr();
539 error_callback_.Run(message); 542 error_callback_.Run(message);
540 content::RenderThread::Get()->GetMessageLoop()->PostTask( 543 content::RenderThread::Get()->GetMessageLoop()->PostTask(
541 FROM_HERE, 544 FROM_HERE,
542 base::Bind(&CastRtpStream::Stop, ptr)); 545 base::Bind(&CastRtpStream::Stop, ptr));
543 } 546 }
OLDNEW
« no previous file with comments | « no previous file | content/common/media/video_capture.h » ('j') | content/renderer/media/webrtc/media_stream_remote_video_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698