| OLD | NEW |
| 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/command_line.h" | 8 #include "base/command_line.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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 RemoveFromVideoTrack(this, track_); | 265 RemoveFromVideoTrack(this, track_); |
| 266 } | 266 } |
| 267 | 267 |
| 268 // This static method is used to forward video frames to |frame_input|. | 268 // This static method is used to forward video frames to |frame_input|. |
| 269 static void OnVideoFrame( | 269 static void OnVideoFrame( |
| 270 // These parameters are already bound when callback is created. | 270 // These parameters are already bound when callback is created. |
| 271 const CastRtpStream::ErrorCallback& error_callback, | 271 const CastRtpStream::ErrorCallback& error_callback, |
| 272 const scoped_refptr<media::cast::VideoFrameInput> frame_input, | 272 const scoped_refptr<media::cast::VideoFrameInput> frame_input, |
| 273 // These parameters are passed for each frame. | 273 // These parameters are passed for each frame. |
| 274 const scoped_refptr<media::VideoFrame>& frame, | 274 const scoped_refptr<media::VideoFrame>& frame, |
| 275 const media::VideoCaptureFormat& format, | |
| 276 const base::TimeTicks& estimated_capture_time) { | 275 const base::TimeTicks& estimated_capture_time) { |
| 277 base::TimeTicks timestamp; | 276 base::TimeTicks timestamp; |
| 278 if (estimated_capture_time.is_null()) | 277 if (estimated_capture_time.is_null()) |
| 279 timestamp = base::TimeTicks::Now(); | 278 timestamp = base::TimeTicks::Now(); |
| 280 else | 279 else |
| 281 timestamp = estimated_capture_time; | 280 timestamp = estimated_capture_time; |
| 282 | 281 |
| 283 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 282 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
| 284 TRACE_EVENT_INSTANT2( | 283 TRACE_EVENT_INSTANT2( |
| 285 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", | 284 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 void CastRtpStream::DidEncounterError(const std::string& message) { | 568 void CastRtpStream::DidEncounterError(const std::string& message) { |
| 570 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 569 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
| 571 << (IsAudio() ? "audio" : "video"); | 570 << (IsAudio() ? "audio" : "video"); |
| 572 // Save the WeakPtr first because the error callback might delete this object. | 571 // Save the WeakPtr first because the error callback might delete this object. |
| 573 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 572 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 574 error_callback_.Run(message); | 573 error_callback_.Run(message); |
| 575 content::RenderThread::Get()->GetTaskRunner()->PostTask( | 574 content::RenderThread::Get()->GetTaskRunner()->PostTask( |
| 576 FROM_HERE, | 575 FROM_HERE, |
| 577 base::Bind(&CastRtpStream::Stop, ptr)); | 576 base::Bind(&CastRtpStream::Stop, ptr)); |
| 578 } | 577 } |
| OLD | NEW |