| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ChannelGroup* channel_group, | 132 ChannelGroup* channel_group, |
| 133 int channel_id, | 133 int channel_id, |
| 134 const VideoReceiveStream::Config& config, | 134 const VideoReceiveStream::Config& config, |
| 135 webrtc::VoiceEngine* voice_engine) | 135 webrtc::VoiceEngine* voice_engine) |
| 136 : transport_adapter_(config.rtcp_send_transport), | 136 : transport_adapter_(config.rtcp_send_transport), |
| 137 encoded_frame_proxy_(config.pre_decode_callback), | 137 encoded_frame_proxy_(config.pre_decode_callback), |
| 138 config_(config), | 138 config_(config), |
| 139 clock_(Clock::GetRealTimeClock()), | 139 clock_(Clock::GetRealTimeClock()), |
| 140 channel_group_(channel_group), | 140 channel_group_(channel_group), |
| 141 channel_id_(channel_id) { | 141 channel_id_(channel_id) { |
| 142 CHECK(channel_group_->CreateReceiveChannel( | 142 RTC_CHECK(channel_group_->CreateReceiveChannel( |
| 143 channel_id_, 0, &transport_adapter_, num_cpu_cores)); | 143 channel_id_, 0, &transport_adapter_, num_cpu_cores)); |
| 144 | 144 |
| 145 vie_channel_ = channel_group_->GetChannel(channel_id_); | 145 vie_channel_ = channel_group_->GetChannel(channel_id_); |
| 146 | 146 |
| 147 // TODO(pbos): This is not fine grained enough... | 147 // TODO(pbos): This is not fine grained enough... |
| 148 vie_channel_->SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, | 148 vie_channel_->SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, |
| 149 -1, -1); | 149 -1, -1); |
| 150 vie_channel_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); | 150 vie_channel_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); |
| 151 SetRtcpMode(config_.rtp.rtcp_mode); | 151 SetRtcpMode(config_.rtp.rtcp_mode); |
| 152 | 152 |
| 153 DCHECK(config_.rtp.remote_ssrc != 0); | 153 RTC_DCHECK(config_.rtp.remote_ssrc != 0); |
| 154 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? | 154 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? |
| 155 DCHECK(config_.rtp.local_ssrc != 0); | 155 RTC_DCHECK(config_.rtp.local_ssrc != 0); |
| 156 DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); | 156 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); |
| 157 | 157 |
| 158 vie_channel_->SetSSRC(config_.rtp.local_ssrc, kViEStreamTypeNormal, 0); | 158 vie_channel_->SetSSRC(config_.rtp.local_ssrc, kViEStreamTypeNormal, 0); |
| 159 // TODO(pbos): Support multiple RTX, per video payload. | 159 // TODO(pbos): Support multiple RTX, per video payload. |
| 160 Config::Rtp::RtxMap::const_iterator it = config_.rtp.rtx.begin(); | 160 Config::Rtp::RtxMap::const_iterator it = config_.rtp.rtx.begin(); |
| 161 for (; it != config_.rtp.rtx.end(); ++it) { | 161 for (; it != config_.rtp.rtx.end(); ++it) { |
| 162 DCHECK(it->second.ssrc != 0); | 162 RTC_DCHECK(it->second.ssrc != 0); |
| 163 DCHECK(it->second.payload_type != 0); | 163 RTC_DCHECK(it->second.payload_type != 0); |
| 164 | 164 |
| 165 vie_channel_->SetRemoteSSRCType(kViEStreamTypeRtx, it->second.ssrc); | 165 vie_channel_->SetRemoteSSRCType(kViEStreamTypeRtx, it->second.ssrc); |
| 166 vie_channel_->SetRtxReceivePayloadType(it->second.payload_type, it->first); | 166 vie_channel_->SetRtxReceivePayloadType(it->second.payload_type, it->first); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // TODO(pbos): Remove channel_group_ usage from VideoReceiveStream. This | 169 // TODO(pbos): Remove channel_group_ usage from VideoReceiveStream. This |
| 170 // should be configured in call.cc. | 170 // should be configured in call.cc. |
| 171 channel_group_->SetChannelRembStatus(false, config_.rtp.remb, vie_channel_); | 171 channel_group_->SetChannelRembStatus(false, config_.rtp.remb, vie_channel_); |
| 172 | 172 |
| 173 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 173 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
| 174 const std::string& extension = config_.rtp.extensions[i].name; | 174 const std::string& extension = config_.rtp.extensions[i].name; |
| 175 int id = config_.rtp.extensions[i].id; | 175 int id = config_.rtp.extensions[i].id; |
| 176 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 176 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 177 DCHECK_GE(id, 1); | 177 RTC_DCHECK_GE(id, 1); |
| 178 DCHECK_LE(id, 14); | 178 RTC_DCHECK_LE(id, 14); |
| 179 if (extension == RtpExtension::kTOffset) { | 179 if (extension == RtpExtension::kTOffset) { |
| 180 CHECK_EQ(0, vie_channel_->SetReceiveTimestampOffsetStatus(true, id)); | 180 RTC_CHECK_EQ(0, vie_channel_->SetReceiveTimestampOffsetStatus(true, id)); |
| 181 } else if (extension == RtpExtension::kAbsSendTime) { | 181 } else if (extension == RtpExtension::kAbsSendTime) { |
| 182 CHECK_EQ(0, vie_channel_->SetReceiveAbsoluteSendTimeStatus(true, id)); | 182 RTC_CHECK_EQ(0, vie_channel_->SetReceiveAbsoluteSendTimeStatus(true, id)); |
| 183 } else if (extension == RtpExtension::kVideoRotation) { | 183 } else if (extension == RtpExtension::kVideoRotation) { |
| 184 CHECK_EQ(0, vie_channel_->SetReceiveVideoRotationStatus(true, id)); | 184 RTC_CHECK_EQ(0, vie_channel_->SetReceiveVideoRotationStatus(true, id)); |
| 185 } else if (extension == RtpExtension::kTransportSequenceNumber) { | 185 } else if (extension == RtpExtension::kTransportSequenceNumber) { |
| 186 CHECK_EQ(0, vie_channel_->SetReceiveTransportSequenceNumber(true, id)); | 186 RTC_CHECK_EQ(0, |
| 187 vie_channel_->SetReceiveTransportSequenceNumber(true, id)); |
| 187 } else { | 188 } else { |
| 188 RTC_NOTREACHED() << "Unsupported RTP extension."; | 189 RTC_NOTREACHED() << "Unsupported RTP extension."; |
| 189 } | 190 } |
| 190 } | 191 } |
| 191 | 192 |
| 192 if (config_.rtp.fec.ulpfec_payload_type != -1) { | 193 if (config_.rtp.fec.ulpfec_payload_type != -1) { |
| 193 // ULPFEC without RED doesn't make sense. | 194 // ULPFEC without RED doesn't make sense. |
| 194 DCHECK(config_.rtp.fec.red_payload_type != -1); | 195 RTC_DCHECK(config_.rtp.fec.red_payload_type != -1); |
| 195 VideoCodec codec; | 196 VideoCodec codec; |
| 196 memset(&codec, 0, sizeof(codec)); | 197 memset(&codec, 0, sizeof(codec)); |
| 197 codec.codecType = kVideoCodecULPFEC; | 198 codec.codecType = kVideoCodecULPFEC; |
| 198 strcpy(codec.plName, "ulpfec"); | 199 strcpy(codec.plName, "ulpfec"); |
| 199 codec.plType = config_.rtp.fec.ulpfec_payload_type; | 200 codec.plType = config_.rtp.fec.ulpfec_payload_type; |
| 200 CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 201 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); |
| 201 } | 202 } |
| 202 if (config_.rtp.fec.red_payload_type != -1) { | 203 if (config_.rtp.fec.red_payload_type != -1) { |
| 203 VideoCodec codec; | 204 VideoCodec codec; |
| 204 memset(&codec, 0, sizeof(codec)); | 205 memset(&codec, 0, sizeof(codec)); |
| 205 codec.codecType = kVideoCodecRED; | 206 codec.codecType = kVideoCodecRED; |
| 206 strcpy(codec.plName, "red"); | 207 strcpy(codec.plName, "red"); |
| 207 codec.plType = config_.rtp.fec.red_payload_type; | 208 codec.plType = config_.rtp.fec.red_payload_type; |
| 208 CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 209 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); |
| 209 if (config_.rtp.fec.red_rtx_payload_type != -1) { | 210 if (config_.rtp.fec.red_rtx_payload_type != -1) { |
| 210 vie_channel_->SetRtxReceivePayloadType( | 211 vie_channel_->SetRtxReceivePayloadType( |
| 211 config_.rtp.fec.red_rtx_payload_type, | 212 config_.rtp.fec.red_rtx_payload_type, |
| 212 config_.rtp.fec.red_payload_type); | 213 config_.rtp.fec.red_payload_type); |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 | 216 |
| 216 if (config.rtp.rtcp_xr.receiver_reference_time_report) | 217 if (config.rtp.rtcp_xr.receiver_reference_time_report) |
| 217 vie_channel_->SetRtcpXrRrtrStatus(true); | 218 vie_channel_->SetRtcpXrRrtrStatus(true); |
| 218 | 219 |
| 219 stats_proxy_.reset( | 220 stats_proxy_.reset( |
| 220 new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, clock_)); | 221 new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, clock_)); |
| 221 | 222 |
| 222 vie_channel_->RegisterReceiveStatisticsProxy(stats_proxy_.get()); | 223 vie_channel_->RegisterReceiveStatisticsProxy(stats_proxy_.get()); |
| 223 vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback( | 224 vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback( |
| 224 stats_proxy_.get()); | 225 stats_proxy_.get()); |
| 225 vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(stats_proxy_.get()); | 226 vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(stats_proxy_.get()); |
| 226 vie_channel_->RegisterRtcpPacketTypeCounterObserver(stats_proxy_.get()); | 227 vie_channel_->RegisterRtcpPacketTypeCounterObserver(stats_proxy_.get()); |
| 227 | 228 |
| 228 DCHECK(!config_.decoders.empty()); | 229 RTC_DCHECK(!config_.decoders.empty()); |
| 229 for (size_t i = 0; i < config_.decoders.size(); ++i) { | 230 for (size_t i = 0; i < config_.decoders.size(); ++i) { |
| 230 const Decoder& decoder = config_.decoders[i]; | 231 const Decoder& decoder = config_.decoders[i]; |
| 231 CHECK_EQ(0, vie_channel_->RegisterExternalDecoder( | 232 RTC_CHECK_EQ(0, |
| 232 decoder.payload_type, decoder.decoder, decoder.is_renderer, | 233 vie_channel_->RegisterExternalDecoder( |
| 233 decoder.is_renderer ? decoder.expected_delay_ms | 234 decoder.payload_type, decoder.decoder, decoder.is_renderer, |
| 234 : config.render_delay_ms)); | 235 decoder.is_renderer ? decoder.expected_delay_ms |
| 236 : config.render_delay_ms)); |
| 235 | 237 |
| 236 VideoCodec codec = CreateDecoderVideoCodec(decoder); | 238 VideoCodec codec = CreateDecoderVideoCodec(decoder); |
| 237 | 239 |
| 238 CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 240 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); |
| 239 } | 241 } |
| 240 | 242 |
| 241 incoming_video_stream_.reset(new IncomingVideoStream(0)); | 243 incoming_video_stream_.reset(new IncomingVideoStream(0)); |
| 242 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms); | 244 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms); |
| 243 incoming_video_stream_->SetExternalCallback(this); | 245 incoming_video_stream_->SetExternalCallback(this); |
| 244 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get()); | 246 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get()); |
| 245 | 247 |
| 246 if (config.pre_decode_callback) | 248 if (config.pre_decode_callback) |
| 247 vie_channel_->RegisterPreDecodeImageCallback(&encoded_frame_proxy_); | 249 vie_channel_->RegisterPreDecodeImageCallback(&encoded_frame_proxy_); |
| 248 vie_channel_->RegisterPreRenderCallback(this); | 250 vie_channel_->RegisterPreRenderCallback(this); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 case newapi::kRtcpCompound: | 336 case newapi::kRtcpCompound: |
| 335 vie_channel_->SetRTCPMode(kRtcpCompound); | 337 vie_channel_->SetRTCPMode(kRtcpCompound); |
| 336 break; | 338 break; |
| 337 case newapi::kRtcpReducedSize: | 339 case newapi::kRtcpReducedSize: |
| 338 vie_channel_->SetRTCPMode(kRtcpNonCompound); | 340 vie_channel_->SetRTCPMode(kRtcpNonCompound); |
| 339 break; | 341 break; |
| 340 } | 342 } |
| 341 } | 343 } |
| 342 } // namespace internal | 344 } // namespace internal |
| 343 } // namespace webrtc | 345 } // namespace webrtc |
| OLD | NEW |