OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/protocol/webrtc_video_stream.h" | 5 #include "remoting/protocol/webrtc_video_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 struct WebrtcVideoStream::EncodedFrameWithStats { | 45 struct WebrtcVideoStream::EncodedFrameWithStats { |
46 std::unique_ptr<WebrtcVideoEncoder::EncodedFrame> frame; | 46 std::unique_ptr<WebrtcVideoEncoder::EncodedFrame> frame; |
47 std::unique_ptr<FrameStats> stats; | 47 std::unique_ptr<FrameStats> stats; |
48 }; | 48 }; |
49 | 49 |
50 WebrtcVideoStream::WebrtcVideoStream() | 50 WebrtcVideoStream::WebrtcVideoStream() |
51 : video_stats_dispatcher_(kStreamLabel), weak_factory_(this) {} | 51 : video_stats_dispatcher_(kStreamLabel), weak_factory_(this) {} |
52 | 52 |
53 WebrtcVideoStream::~WebrtcVideoStream() { | 53 WebrtcVideoStream::~WebrtcVideoStream() { |
| 54 DCHECK(thread_checker_.CalledOnValidThread()); |
54 if (stream_) { | 55 if (stream_) { |
55 for (const auto& track : stream_->GetVideoTracks()) { | 56 for (const auto& track : stream_->GetVideoTracks()) { |
56 stream_->RemoveTrack(track.get()); | 57 stream_->RemoveTrack(track.get()); |
57 } | 58 } |
58 peer_connection_->RemoveStream(stream_.get()); | 59 peer_connection_->RemoveStream(stream_.get()); |
59 } | 60 } |
60 encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release()); | 61 encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release()); |
61 } | 62 } |
62 | 63 |
63 void WebrtcVideoStream::Start( | 64 void WebrtcVideoStream::Start( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 encoder_ = WebrtcVideoEncoderVpx::CreateForVP8(); | 275 encoder_ = WebrtcVideoEncoderVpx::CreateForVP8(); |
275 } else if (codec_type == webrtc::kVideoCodecVP9) { | 276 } else if (codec_type == webrtc::kVideoCodecVP9) { |
276 encoder_ = WebrtcVideoEncoderVpx::CreateForVP9(); | 277 encoder_ = WebrtcVideoEncoderVpx::CreateForVP9(); |
277 } else { | 278 } else { |
278 LOG(FATAL) << "Unknown codec type: " << codec_type; | 279 LOG(FATAL) << "Unknown codec type: " << codec_type; |
279 } | 280 } |
280 } | 281 } |
281 | 282 |
282 } // namespace protocol | 283 } // namespace protocol |
283 } // namespace remoting | 284 } // namespace remoting |
OLD | NEW |