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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 110 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
111 : transport_adapter_(config.send_transport), | 111 : transport_adapter_(config.send_transport), |
112 encoded_frame_proxy_(config.post_encode_callback), | 112 encoded_frame_proxy_(config.post_encode_callback), |
113 config_(config), | 113 config_(config), |
114 suspended_ssrcs_(suspended_ssrcs), | 114 suspended_ssrcs_(suspended_ssrcs), |
115 module_process_thread_(module_process_thread), | 115 module_process_thread_(module_process_thread), |
116 channel_group_(channel_group), | 116 channel_group_(channel_group), |
117 channel_id_(channel_id), | 117 channel_id_(channel_id), |
118 use_config_bitrate_(true), | 118 use_config_bitrate_(true), |
119 stats_proxy_(Clock::GetRealTimeClock(), config) { | 119 stats_proxy_(Clock::GetRealTimeClock(), config) { |
120 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); | |
120 RTC_DCHECK(!config_.rtp.ssrcs.empty()); | 121 RTC_DCHECK(!config_.rtp.ssrcs.empty()); |
121 RTC_CHECK(channel_group->CreateSendChannel( | 122 RTC_CHECK(channel_group->CreateSendChannel( |
122 channel_id_, &transport_adapter_, &stats_proxy_, | 123 channel_id_, &transport_adapter_, &stats_proxy_, |
123 config.pre_encode_callback, num_cpu_cores, config_)); | 124 config.pre_encode_callback, num_cpu_cores, config_)); |
124 vie_channel_ = channel_group_->GetChannel(channel_id_); | 125 vie_channel_ = channel_group_->GetChannel(channel_id_); |
125 vie_encoder_ = channel_group_->GetEncoder(channel_id_); | 126 vie_encoder_ = channel_group_->GetEncoder(channel_id_); |
126 | 127 |
127 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 128 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
128 const std::string& extension = config_.rtp.extensions[i].name; | 129 const std::string& extension = config_.rtp.extensions[i].name; |
129 int id = config_.rtp.extensions[i].id; | 130 int id = config_.rtp.extensions[i].id; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 vie_encoder_->SuspendBelowMinBitrate(); | 188 vie_encoder_->SuspendBelowMinBitrate(); |
188 | 189 |
189 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_); | 190 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_); |
190 vie_channel_->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); | 191 vie_channel_->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); |
191 vie_channel_->RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); | 192 vie_channel_->RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); |
192 vie_channel_->RegisterSendBitrateObserver(&stats_proxy_); | 193 vie_channel_->RegisterSendBitrateObserver(&stats_proxy_); |
193 vie_channel_->RegisterSendFrameCountObserver(&stats_proxy_); | 194 vie_channel_->RegisterSendFrameCountObserver(&stats_proxy_); |
194 } | 195 } |
195 | 196 |
196 VideoSendStream::~VideoSendStream() { | 197 VideoSendStream::~VideoSendStream() { |
198 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); | |
197 vie_channel_->RegisterSendFrameCountObserver(nullptr); | 199 vie_channel_->RegisterSendFrameCountObserver(nullptr); |
198 vie_channel_->RegisterSendBitrateObserver(nullptr); | 200 vie_channel_->RegisterSendBitrateObserver(nullptr); |
199 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr); | 201 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr); |
200 vie_channel_->RegisterSendChannelRtpStatisticsCallback(nullptr); | 202 vie_channel_->RegisterSendChannelRtpStatisticsCallback(nullptr); |
201 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(nullptr); | 203 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(nullptr); |
202 | 204 |
203 // Remove capture input (thread) so that it's not running after the current | 205 // Remove capture input (thread) so that it's not running after the current |
204 // channel is deleted. | 206 // channel is deleted. |
205 input_.reset(); | 207 input_.reset(); |
206 | 208 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 uint32_t jitter; | 452 uint32_t jitter; |
451 int64_t rtt_ms; | 453 int64_t rtt_ms; |
452 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, | 454 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, |
453 &extended_max_sequence_number, | 455 &extended_max_sequence_number, |
454 &jitter, &rtt_ms) == 0) { | 456 &jitter, &rtt_ms) == 0) { |
455 return rtt_ms; | 457 return rtt_ms; |
456 } | 458 } |
457 return -1; | 459 return -1; |
458 } | 460 } |
459 | 461 |
462 const VideoSendStream::Config& VideoSendStream::config() const { | |
stefan-webrtc
2015/10/14 10:30:16
Not needed, right?
pbos-webrtc
2015/10/15 10:21:42
Done.
| |
463 return config_; | |
464 } | |
465 | |
460 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { | 466 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { |
461 if (video_codec.maxBitrate == 0) { | 467 if (video_codec.maxBitrate == 0) { |
462 // Unset max bitrate -> cap to one bit per pixel. | 468 // Unset max bitrate -> cap to one bit per pixel. |
463 video_codec.maxBitrate = | 469 video_codec.maxBitrate = |
464 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 470 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
465 1000; | 471 1000; |
466 } | 472 } |
467 | 473 |
468 if (video_codec.minBitrate < kViEMinCodecBitrate) | 474 if (video_codec.minBitrate < kViEMinCodecBitrate) |
469 video_codec.minBitrate = kViEMinCodecBitrate; | 475 video_codec.minBitrate = kViEMinCodecBitrate; |
(...skipping 26 matching lines...) Expand all Loading... | |
496 vie_channel_->IsSendingFecEnabled()); | 502 vie_channel_->IsSendingFecEnabled()); |
497 | 503 |
498 // Restart the media flow | 504 // Restart the media flow |
499 vie_encoder_->Restart(); | 505 vie_encoder_->Restart(); |
500 | 506 |
501 return true; | 507 return true; |
502 } | 508 } |
503 | 509 |
504 } // namespace internal | 510 } // namespace internal |
505 } // namespace webrtc | 511 } // namespace webrtc |
OLD | NEW |