OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 vie_channel_.RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); | 255 vie_channel_.RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); |
256 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); | 256 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); |
257 vie_channel_.RegisterSendBitrateObserver(&stats_proxy_); | 257 vie_channel_.RegisterSendBitrateObserver(&stats_proxy_); |
258 vie_channel_.RegisterSendFrameCountObserver(&stats_proxy_); | 258 vie_channel_.RegisterSendFrameCountObserver(&stats_proxy_); |
259 | 259 |
260 module_process_thread_->RegisterModule(&overuse_detector_); | 260 module_process_thread_->RegisterModule(&overuse_detector_); |
261 } | 261 } |
262 | 262 |
263 VideoSendStream::~VideoSendStream() { | 263 VideoSendStream::~VideoSendStream() { |
264 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); | 264 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); |
| 265 Stop(); |
| 266 |
265 module_process_thread_->DeRegisterModule(&overuse_detector_); | 267 module_process_thread_->DeRegisterModule(&overuse_detector_); |
266 // Remove vcm_protection_callback (part of vie_channel_) before destroying | 268 // Remove vcm_protection_callback (part of vie_channel_) before destroying |
267 // ViEChannel. vcm_ is owned by ViEEncoder and the registered callback does | 269 // ViEChannel. vcm_ is owned by ViEEncoder and the registered callback does |
268 // not outlive it. | 270 // not outlive it. |
269 vcm_->RegisterProtectionCallback(nullptr); | 271 vcm_->RegisterProtectionCallback(nullptr); |
270 vie_channel_.RegisterSendFrameCountObserver(nullptr); | 272 vie_channel_.RegisterSendFrameCountObserver(nullptr); |
271 vie_channel_.RegisterSendBitrateObserver(nullptr); | 273 vie_channel_.RegisterSendBitrateObserver(nullptr); |
272 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); | 274 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); |
273 vie_channel_.RegisterSendChannelRtpStatisticsCallback(nullptr); | 275 vie_channel_.RegisterSendChannelRtpStatisticsCallback(nullptr); |
274 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(nullptr); | 276 vie_channel_.RegisterSendChannelRtcpStatisticsCallback(nullptr); |
(...skipping 20 matching lines...) Expand all Loading... |
295 } | 297 } |
296 | 298 |
297 void VideoSendStream::Start() { | 299 void VideoSendStream::Start() { |
298 transport_adapter_.Enable(); | 300 transport_adapter_.Enable(); |
299 vie_encoder_.Pause(); | 301 vie_encoder_.Pause(); |
300 if (vie_channel_.StartSend() == 0) { | 302 if (vie_channel_.StartSend() == 0) { |
301 // Was not already started, trigger a keyframe. | 303 // Was not already started, trigger a keyframe. |
302 vie_encoder_.SendKeyFrame(); | 304 vie_encoder_.SendKeyFrame(); |
303 } | 305 } |
304 vie_encoder_.Restart(); | 306 vie_encoder_.Restart(); |
305 vie_channel_.StartReceive(); | 307 vie_receiver_->StartReceive(); |
306 } | 308 } |
307 | 309 |
308 void VideoSendStream::Stop() { | 310 void VideoSendStream::Stop() { |
309 // TODO(pbos): Make sure the encoder stops here. | 311 // TODO(pbos): Make sure the encoder stops here. |
310 vie_channel_.StopSend(); | 312 vie_channel_.StopSend(); |
311 vie_channel_.StopReceive(); | 313 vie_receiver_->StopReceive(); |
312 transport_adapter_.Disable(); | 314 transport_adapter_.Disable(); |
313 } | 315 } |
314 | 316 |
315 bool VideoSendStream::ReconfigureVideoEncoder( | 317 bool VideoSendStream::ReconfigureVideoEncoder( |
316 const VideoEncoderConfig& config) { | 318 const VideoEncoderConfig& config) { |
317 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); | 319 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); |
318 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); | 320 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); |
319 const std::vector<VideoStream>& streams = config.streams; | 321 const std::vector<VideoStream>& streams = config.streams; |
320 RTC_DCHECK(!streams.empty()); | 322 RTC_DCHECK(!streams.empty()); |
321 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), streams.size()); | 323 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), streams.size()); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); | 598 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); |
597 vie_encoder_.SetSsrcs(used_ssrcs); | 599 vie_encoder_.SetSsrcs(used_ssrcs); |
598 | 600 |
599 // Restart the media flow | 601 // Restart the media flow |
600 vie_encoder_.Restart(); | 602 vie_encoder_.Restart(); |
601 | 603 |
602 return true; | 604 return true; |
603 } | 605 } |
604 } // namespace internal | 606 } // namespace internal |
605 } // namespace webrtc | 607 } // namespace webrtc |
OLD | NEW |