| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.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 base::TimeTicks& estimated_capture_time) { | 275 base::TimeTicks estimated_capture_time) { |
| 276 const base::TimeTicks timestamp = estimated_capture_time.is_null() | 276 const base::TimeTicks timestamp = estimated_capture_time.is_null() |
| 277 ? base::TimeTicks::Now() | 277 ? base::TimeTicks::Now() |
| 278 : estimated_capture_time; | 278 : estimated_capture_time; |
| 279 | 279 |
| 280 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 280 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
| 281 TRACE_EVENT_INSTANT2( | 281 TRACE_EVENT_INSTANT2( |
| 282 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", | 282 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", |
| 283 TRACE_EVENT_SCOPE_THREAD, | 283 TRACE_EVENT_SCOPE_THREAD, |
| 284 "timestamp", timestamp.ToInternalValue(), | 284 "timestamp", timestamp.ToInternalValue(), |
| 285 "time_delta", frame->timestamp().ToInternalValue()); | 285 "time_delta", frame->timestamp().ToInternalValue()); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 DCHECK(content::RenderThread::Get()); | 575 DCHECK(content::RenderThread::Get()); |
| 576 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 576 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
| 577 << (IsAudio() ? "audio" : "video"); | 577 << (IsAudio() ? "audio" : "video"); |
| 578 // Save the WeakPtr first because the error callback might delete this object. | 578 // Save the WeakPtr first because the error callback might delete this object. |
| 579 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 579 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 580 error_callback_.Run(message); | 580 error_callback_.Run(message); |
| 581 base::ThreadTaskRunnerHandle::Get()->PostTask( | 581 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 582 FROM_HERE, | 582 FROM_HERE, |
| 583 base::Bind(&CastRtpStream::Stop, ptr)); | 583 base::Bind(&CastRtpStream::Stop, ptr)); |
| 584 } | 584 } |
| OLD | NEW |