| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 private: | 201 private: |
| 202 class Deliverer : public base::RefCountedThreadSafe<Deliverer> { | 202 class Deliverer : public base::RefCountedThreadSafe<Deliverer> { |
| 203 public: | 203 public: |
| 204 explicit Deliverer(const CastRtpStream::ErrorCallback& error_callback) | 204 explicit Deliverer(const CastRtpStream::ErrorCallback& error_callback) |
| 205 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 205 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 206 error_callback_(error_callback) {} | 206 error_callback_(error_callback) {} |
| 207 | 207 |
| 208 void WillConnectToTrack( | 208 void WillConnectToTrack( |
| 209 base::WeakPtr<CastVideoSink> sink, | 209 base::WeakPtr<CastVideoSink> sink, |
| 210 scoped_refptr<media::cast::VideoFrameInput> frame_input) { | 210 scoped_refptr<media::cast::VideoFrameInput> frame_input) { |
| 211 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); | 211 DCHECK(main_task_runner_->RunsTasksInCurrentSequence()); |
| 212 sink_ = sink; | 212 sink_ = sink; |
| 213 frame_input_ = std::move(frame_input); | 213 frame_input_ = std::move(frame_input); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 216 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 217 base::TimeTicks estimated_capture_time) { | 217 base::TimeTicks estimated_capture_time) { |
| 218 main_task_runner_->PostTask( | 218 main_task_runner_->PostTask( |
| 219 FROM_HERE, base::Bind(&CastVideoSink::DidReceiveFrame, sink_)); | 219 FROM_HERE, base::Bind(&CastVideoSink::DidReceiveFrame, sink_)); |
| 220 | 220 |
| 221 const base::TimeTicks timestamp = estimated_capture_time.is_null() | 221 const base::TimeTicks timestamp = estimated_capture_time.is_null() |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DCHECK(content::RenderThread::Get()); | 580 DCHECK(content::RenderThread::Get()); |
| 581 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message | 581 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message |
| 582 << ") = " << (is_audio_ ? "audio" : "video"); | 582 << ") = " << (is_audio_ ? "audio" : "video"); |
| 583 // Save the WeakPtr first because the error callback might delete this object. | 583 // Save the WeakPtr first because the error callback might delete this object. |
| 584 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 584 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 585 error_callback_.Run(message); | 585 error_callback_.Run(message); |
| 586 base::ThreadTaskRunnerHandle::Get()->PostTask( | 586 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 587 FROM_HERE, | 587 FROM_HERE, |
| 588 base::Bind(&CastRtpStream::Stop, ptr)); | 588 base::Bind(&CastRtpStream::Stop, ptr)); |
| 589 } | 589 } |
| OLD | NEW |