Chromium Code Reviews| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 webrtc::VoiceEngine* voice_engine, | 146 webrtc::VoiceEngine* voice_engine, |
| 147 ProcessThread* process_thread, | 147 ProcessThread* process_thread, |
| 148 CallStats* call_stats) | 148 CallStats* call_stats) |
| 149 : transport_adapter_(config.rtcp_send_transport), | 149 : transport_adapter_(config.rtcp_send_transport), |
| 150 encoded_frame_proxy_(config.pre_decode_callback), | 150 encoded_frame_proxy_(config.pre_decode_callback), |
| 151 config_(config), | 151 config_(config), |
| 152 process_thread_(process_thread), | 152 process_thread_(process_thread), |
| 153 clock_(Clock::GetRealTimeClock()), | 153 clock_(Clock::GetRealTimeClock()), |
| 154 congestion_controller_(congestion_controller), | 154 congestion_controller_(congestion_controller), |
| 155 call_stats_(call_stats), | 155 call_stats_(call_stats), |
| 156 vcm_(VideoCodingModule::Create(clock_, nullptr, nullptr)) { | 156 vcm_(VideoCodingModule::Create(clock_, nullptr, nullptr)), |
| 157 incoming_video_stream_( | |
| 158 0, | |
| 159 config.renderer ? config.renderer->SmoothsRenderedFrames() : false), | |
| 160 stats_proxy_(config_.rtp.remote_ssrc, clock_), | |
| 161 vie_channel_(num_cpu_cores, | |
| 162 &transport_adapter_, | |
| 163 process_thread, | |
| 164 nullptr, | |
| 165 vcm_.get(), | |
| 166 nullptr, | |
| 167 nullptr, | |
| 168 nullptr, | |
| 169 GetRemoteBitrateEstimator(), | |
| 170 call_stats_->rtcp_rtt_stats(), | |
| 171 congestion_controller_->pacer(), | |
| 172 congestion_controller_->packet_router(), | |
| 173 1, | |
| 174 false) { | |
| 157 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); | 175 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); |
| 158 | 176 |
| 159 bool send_side_bwe = | 177 RTC_CHECK(vie_channel_.Init() == 0); |
| 160 config.rtp.transport_cc && UseSendSideBwe(config_.rtp.extensions); | |
| 161 | |
| 162 RemoteBitrateEstimator* bitrate_estimator = | |
| 163 congestion_controller_->GetRemoteBitrateEstimator(send_side_bwe); | |
| 164 | |
| 165 vie_channel_.reset(new ViEChannel( | |
| 166 num_cpu_cores, &transport_adapter_, process_thread, nullptr, vcm_.get(), | |
| 167 nullptr, nullptr, nullptr, bitrate_estimator, | |
| 168 call_stats_->rtcp_rtt_stats(), congestion_controller_->pacer(), | |
| 169 congestion_controller_->packet_router(), 1, false)); | |
| 170 | |
| 171 RTC_CHECK(vie_channel_->Init() == 0); | |
| 172 | 178 |
| 173 // Register the channel to receive stats updates. | 179 // Register the channel to receive stats updates. |
| 174 call_stats_->RegisterStatsObserver(vie_channel_->GetStatsObserver()); | 180 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 175 | 181 |
| 176 // TODO(pbos): This is not fine grained enough... | 182 // TODO(pbos): This is not fine grained enough... |
| 177 vie_channel_->SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, | 183 vie_channel_.SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, |
| 178 -1, -1); | 184 -1, -1); |
| 179 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) | 185 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) |
| 180 << "A stream should not be configured with RTCP disabled. This value is " | 186 << "A stream should not be configured with RTCP disabled. This value is " |
| 181 "reserved for internal usage."; | 187 "reserved for internal usage."; |
| 182 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); | 188 vie_channel_.SetRTCPMode(config_.rtp.rtcp_mode); |
| 183 | 189 |
| 184 RTC_DCHECK(config_.rtp.remote_ssrc != 0); | 190 RTC_DCHECK(config_.rtp.remote_ssrc != 0); |
| 185 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? | 191 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? |
| 186 RTC_DCHECK(config_.rtp.local_ssrc != 0); | 192 RTC_DCHECK(config_.rtp.local_ssrc != 0); |
| 187 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); | 193 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); |
| 188 | 194 |
| 189 vie_channel_->SetSSRC(config_.rtp.local_ssrc, kViEStreamTypeNormal, 0); | 195 vie_channel_.SetSSRC(config_.rtp.local_ssrc, kViEStreamTypeNormal, 0); |
| 190 // TODO(pbos): Support multiple RTX, per video payload. | 196 // TODO(pbos): Support multiple RTX, per video payload. |
| 191 Config::Rtp::RtxMap::const_iterator it = config_.rtp.rtx.begin(); | 197 Config::Rtp::RtxMap::const_iterator it = config_.rtp.rtx.begin(); |
| 192 for (; it != config_.rtp.rtx.end(); ++it) { | 198 for (; it != config_.rtp.rtx.end(); ++it) { |
| 193 RTC_DCHECK(it->second.ssrc != 0); | 199 RTC_DCHECK(it->second.ssrc != 0); |
| 194 RTC_DCHECK(it->second.payload_type != 0); | 200 RTC_DCHECK(it->second.payload_type != 0); |
| 195 | 201 |
| 196 vie_channel_->SetRemoteSSRCType(kViEStreamTypeRtx, it->second.ssrc); | 202 vie_channel_.SetRemoteSSRCType(kViEStreamTypeRtx, it->second.ssrc); |
| 197 vie_channel_->SetRtxReceivePayloadType(it->second.payload_type, it->first); | 203 vie_channel_.SetRtxReceivePayloadType(it->second.payload_type, it->first); |
| 198 } | 204 } |
| 199 // TODO(holmer): When Chrome no longer depends on this being false by default, | 205 // TODO(holmer): When Chrome no longer depends on this being false by default, |
| 200 // always use the mapping and remove this whole codepath. | 206 // always use the mapping and remove this whole codepath. |
| 201 vie_channel_->SetUseRtxPayloadMappingOnRestore( | 207 vie_channel_.SetUseRtxPayloadMappingOnRestore( |
| 202 config_.rtp.use_rtx_payload_mapping_on_restore); | 208 config_.rtp.use_rtx_payload_mapping_on_restore); |
| 203 | 209 |
| 204 congestion_controller_->SetChannelRembStatus(false, config_.rtp.remb, | 210 congestion_controller_->SetChannelRembStatus(false, config_.rtp.remb, |
| 205 vie_channel_->rtp_rtcp()); | 211 vie_channel_.rtp_rtcp()); |
| 206 | 212 |
| 207 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { | 213 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { |
| 208 const std::string& extension = config_.rtp.extensions[i].name; | 214 const std::string& extension = config_.rtp.extensions[i].name; |
| 209 int id = config_.rtp.extensions[i].id; | 215 int id = config_.rtp.extensions[i].id; |
| 210 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 216 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 211 RTC_DCHECK_GE(id, 1); | 217 RTC_DCHECK_GE(id, 1); |
| 212 RTC_DCHECK_LE(id, 14); | 218 RTC_DCHECK_LE(id, 14); |
| 213 if (extension == RtpExtension::kTOffset) { | 219 if (extension == RtpExtension::kTOffset) { |
| 214 RTC_CHECK_EQ(0, vie_channel_->SetReceiveTimestampOffsetStatus(true, id)); | 220 RTC_CHECK_EQ(0, vie_channel_.SetReceiveTimestampOffsetStatus(true, id)); |
| 215 } else if (extension == RtpExtension::kAbsSendTime) { | 221 } else if (extension == RtpExtension::kAbsSendTime) { |
| 216 RTC_CHECK_EQ(0, vie_channel_->SetReceiveAbsoluteSendTimeStatus(true, id)); | 222 RTC_CHECK_EQ(0, vie_channel_.SetReceiveAbsoluteSendTimeStatus(true, id)); |
| 217 } else if (extension == RtpExtension::kVideoRotation) { | 223 } else if (extension == RtpExtension::kVideoRotation) { |
| 218 RTC_CHECK_EQ(0, vie_channel_->SetReceiveVideoRotationStatus(true, id)); | 224 RTC_CHECK_EQ(0, vie_channel_.SetReceiveVideoRotationStatus(true, id)); |
| 219 } else if (extension == RtpExtension::kTransportSequenceNumber) { | 225 } else if (extension == RtpExtension::kTransportSequenceNumber) { |
| 220 RTC_CHECK_EQ(0, | 226 RTC_CHECK_EQ(0, |
| 221 vie_channel_->SetReceiveTransportSequenceNumber(true, id)); | 227 vie_channel_.SetReceiveTransportSequenceNumber(true, id)); |
| 222 } else { | 228 } else { |
| 223 RTC_NOTREACHED() << "Unsupported RTP extension."; | 229 RTC_NOTREACHED() << "Unsupported RTP extension."; |
| 224 } | 230 } |
| 225 } | 231 } |
| 226 | 232 |
| 227 if (config_.rtp.fec.ulpfec_payload_type != -1) { | 233 if (config_.rtp.fec.ulpfec_payload_type != -1) { |
| 228 // ULPFEC without RED doesn't make sense. | 234 // ULPFEC without RED doesn't make sense. |
| 229 RTC_DCHECK(config_.rtp.fec.red_payload_type != -1); | 235 RTC_DCHECK(config_.rtp.fec.red_payload_type != -1); |
| 230 VideoCodec codec; | 236 VideoCodec codec; |
| 231 memset(&codec, 0, sizeof(codec)); | 237 memset(&codec, 0, sizeof(codec)); |
| 232 codec.codecType = kVideoCodecULPFEC; | 238 codec.codecType = kVideoCodecULPFEC; |
| 233 strncpy(codec.plName, "ulpfec", sizeof(codec.plName)); | 239 strncpy(codec.plName, "ulpfec", sizeof(codec.plName)); |
| 234 codec.plType = config_.rtp.fec.ulpfec_payload_type; | 240 codec.plType = config_.rtp.fec.ulpfec_payload_type; |
| 235 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 241 RTC_CHECK_EQ(0, vie_channel_.SetReceiveCodec(codec)); |
| 236 } | 242 } |
| 237 if (config_.rtp.fec.red_payload_type != -1) { | 243 if (config_.rtp.fec.red_payload_type != -1) { |
| 238 VideoCodec codec; | 244 VideoCodec codec; |
| 239 memset(&codec, 0, sizeof(codec)); | 245 memset(&codec, 0, sizeof(codec)); |
| 240 codec.codecType = kVideoCodecRED; | 246 codec.codecType = kVideoCodecRED; |
| 241 strncpy(codec.plName, "red", sizeof(codec.plName)); | 247 strncpy(codec.plName, "red", sizeof(codec.plName)); |
| 242 codec.plType = config_.rtp.fec.red_payload_type; | 248 codec.plType = config_.rtp.fec.red_payload_type; |
| 243 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 249 RTC_CHECK_EQ(0, vie_channel_.SetReceiveCodec(codec)); |
| 244 if (config_.rtp.fec.red_rtx_payload_type != -1) { | 250 if (config_.rtp.fec.red_rtx_payload_type != -1) { |
| 245 vie_channel_->SetRtxReceivePayloadType( | 251 vie_channel_.SetRtxReceivePayloadType( |
| 246 config_.rtp.fec.red_rtx_payload_type, | 252 config_.rtp.fec.red_rtx_payload_type, |
| 247 config_.rtp.fec.red_payload_type); | 253 config_.rtp.fec.red_payload_type); |
| 248 } | 254 } |
| 249 } | 255 } |
| 250 | 256 |
| 251 if (config.rtp.rtcp_xr.receiver_reference_time_report) | 257 if (config.rtp.rtcp_xr.receiver_reference_time_report) |
| 252 vie_channel_->SetRtcpXrRrtrStatus(true); | 258 vie_channel_.SetRtcpXrRrtrStatus(true); |
| 253 | 259 |
| 254 stats_proxy_.reset( | 260 vie_channel_.RegisterReceiveStatisticsProxy(&stats_proxy_); |
| 255 new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, clock_)); | 261 vie_channel_.RegisterReceiveChannelRtcpStatisticsCallback(&stats_proxy_); |
| 256 | 262 vie_channel_.RegisterReceiveChannelRtpStatisticsCallback(&stats_proxy_); |
| 257 vie_channel_->RegisterReceiveStatisticsProxy(stats_proxy_.get()); | 263 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); |
| 258 vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback( | |
| 259 stats_proxy_.get()); | |
| 260 vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(stats_proxy_.get()); | |
| 261 vie_channel_->RegisterRtcpPacketTypeCounterObserver(stats_proxy_.get()); | |
| 262 | 264 |
| 263 RTC_DCHECK(!config_.decoders.empty()); | 265 RTC_DCHECK(!config_.decoders.empty()); |
| 264 std::set<int> decoder_payload_types; | 266 std::set<int> decoder_payload_types; |
| 265 for (size_t i = 0; i < config_.decoders.size(); ++i) { | 267 for (size_t i = 0; i < config_.decoders.size(); ++i) { |
| 266 const Decoder& decoder = config_.decoders[i]; | 268 const Decoder& decoder = config_.decoders[i]; |
| 267 RTC_CHECK(decoder.decoder); | 269 RTC_CHECK(decoder.decoder); |
| 268 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == | 270 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == |
| 269 decoder_payload_types.end()) | 271 decoder_payload_types.end()) |
| 270 << "Duplicate payload type (" << decoder.payload_type | 272 << "Duplicate payload type (" << decoder.payload_type |
| 271 << ") for different decoders."; | 273 << ") for different decoders."; |
| 272 decoder_payload_types.insert(decoder.payload_type); | 274 decoder_payload_types.insert(decoder.payload_type); |
| 273 vie_channel_->RegisterExternalDecoder(decoder.payload_type, | 275 vie_channel_.RegisterExternalDecoder(decoder.payload_type, |
| 274 decoder.decoder); | 276 decoder.decoder); |
| 275 | 277 |
| 276 VideoCodec codec = CreateDecoderVideoCodec(decoder); | 278 VideoCodec codec = CreateDecoderVideoCodec(decoder); |
| 277 | 279 |
| 278 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); | 280 RTC_CHECK_EQ(0, vie_channel_.SetReceiveCodec(codec)); |
| 279 } | 281 } |
| 280 | 282 |
| 281 incoming_video_stream_.reset(new IncomingVideoStream( | 283 incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms); |
| 282 0, config.renderer ? config.renderer->SmoothsRenderedFrames() : false)); | 284 vie_channel_.SetExpectedRenderDelay(config.render_delay_ms); |
| 283 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms); | 285 incoming_video_stream_.SetExternalCallback(this); |
| 284 vie_channel_->SetExpectedRenderDelay(config.render_delay_ms); | 286 vie_channel_.SetIncomingVideoStream(&incoming_video_stream_); |
| 285 incoming_video_stream_->SetExternalCallback(this); | |
| 286 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get()); | |
| 287 | 287 |
| 288 vie_channel_->RegisterPreDecodeImageCallback(this); | 288 vie_channel_.RegisterPreDecodeImageCallback(this); |
| 289 vie_channel_->RegisterPreRenderCallback(this); | 289 vie_channel_.RegisterPreRenderCallback(this); |
| 290 | 290 |
| 291 process_thread_->RegisterModule(vcm_.get()); | 291 process_thread_->RegisterModule(vcm_.get()); |
| 292 } | 292 } |
| 293 | 293 |
| 294 VideoReceiveStream::~VideoReceiveStream() { | 294 VideoReceiveStream::~VideoReceiveStream() { |
| 295 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); | 295 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); |
| 296 incoming_video_stream_->Stop(); | 296 incoming_video_stream_.Stop(); |
| 297 process_thread_->DeRegisterModule(vcm_.get()); | 297 process_thread_->DeRegisterModule(vcm_.get()); |
| 298 vie_channel_->RegisterPreRenderCallback(nullptr); | 298 vie_channel_.RegisterPreRenderCallback(nullptr); |
| 299 vie_channel_->RegisterPreDecodeImageCallback(nullptr); | 299 vie_channel_.RegisterPreDecodeImageCallback(nullptr); |
| 300 | 300 |
| 301 call_stats_->DeregisterStatsObserver(vie_channel_->GetStatsObserver()); | 301 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 302 congestion_controller_->SetChannelRembStatus(false, false, | 302 congestion_controller_->SetChannelRembStatus(false, false, |
| 303 vie_channel_->rtp_rtcp()); | 303 vie_channel_.rtp_rtcp()); |
| 304 | 304 |
| 305 uint32_t remote_ssrc = vie_channel_->GetRemoteSSRC(); | 305 uint32_t remote_ssrc = vie_channel_.GetRemoteSSRC(); |
| 306 bool send_side_bwe = UseSendSideBwe(config_.rtp.extensions); | 306 GetRemoteBitrateEstimator()->RemoveStream(remote_ssrc); |
| 307 congestion_controller_->GetRemoteBitrateEstimator(send_side_bwe)-> | |
| 308 RemoveStream(remote_ssrc); | |
| 309 } | 307 } |
| 310 | 308 |
| 311 void VideoReceiveStream::Start() { | 309 void VideoReceiveStream::Start() { |
| 312 transport_adapter_.Enable(); | 310 transport_adapter_.Enable(); |
| 313 incoming_video_stream_->Start(); | 311 incoming_video_stream_.Start(); |
| 314 vie_channel_->StartReceive(); | 312 vie_channel_.StartReceive(); |
| 315 } | 313 } |
| 316 | 314 |
| 317 void VideoReceiveStream::Stop() { | 315 void VideoReceiveStream::Stop() { |
| 318 incoming_video_stream_->Stop(); | 316 incoming_video_stream_.Stop(); |
| 319 vie_channel_->StopReceive(); | 317 vie_channel_.StopReceive(); |
| 320 transport_adapter_.Disable(); | 318 transport_adapter_.Disable(); |
| 321 } | 319 } |
| 322 | 320 |
| 323 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine, | 321 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine, |
| 324 int audio_channel_id) { | 322 int audio_channel_id) { |
| 325 if (voice_engine != nullptr && audio_channel_id != -1) { | 323 if (voice_engine != nullptr && audio_channel_id != -1) { |
| 326 VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine); | 324 VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine); |
| 327 vie_channel_->SetVoiceChannel(audio_channel_id, voe_sync_interface); | 325 vie_channel_.SetVoiceChannel(audio_channel_id, voe_sync_interface); |
| 328 voe_sync_interface->Release(); | 326 voe_sync_interface->Release(); |
| 329 } else { | 327 } else { |
| 330 vie_channel_->SetVoiceChannel(-1, nullptr); | 328 vie_channel_.SetVoiceChannel(-1, nullptr); |
| 331 } | 329 } |
| 332 } | 330 } |
| 333 | 331 |
| 334 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { | 332 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { |
| 335 return stats_proxy_->GetStats(); | 333 return stats_proxy_.GetStats(); |
| 336 } | 334 } |
| 337 | 335 |
| 338 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 336 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 339 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0; | 337 return vie_channel_.ReceivedRTCPPacket(packet, length) == 0; |
| 340 } | 338 } |
| 341 | 339 |
| 342 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, | 340 bool VideoReceiveStream::DeliverRtp(const uint8_t* packet, |
| 343 size_t length, | 341 size_t length, |
| 344 const PacketTime& packet_time) { | 342 const PacketTime& packet_time) { |
| 345 return vie_channel_->ReceivedRTPPacket(packet, length, packet_time) == 0; | 343 return vie_channel_.ReceivedRTPPacket(packet, length, packet_time) == 0; |
| 346 } | 344 } |
| 347 | 345 |
| 348 void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) { | 346 void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) { |
| 349 stats_proxy_->OnDecodedFrame(); | 347 stats_proxy_.OnDecodedFrame(); |
| 350 | 348 |
| 351 // Post processing is not supported if the frame is backed by a texture. | 349 // Post processing is not supported if the frame is backed by a texture. |
| 352 if (video_frame->native_handle() == NULL) { | 350 if (video_frame->native_handle() == NULL) { |
| 353 if (config_.pre_render_callback) | 351 if (config_.pre_render_callback) |
| 354 config_.pre_render_callback->FrameCallback(video_frame); | 352 config_.pre_render_callback->FrameCallback(video_frame); |
| 355 } | 353 } |
| 356 } | 354 } |
| 357 | 355 |
| 358 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, | 356 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, |
| 359 const VideoFrame& video_frame) { | 357 const VideoFrame& video_frame) { |
| 360 // TODO(pbos): Wire up config_.render->IsTextureSupported() and convert if not | 358 // TODO(pbos): Wire up config_.render->IsTextureSupported() and convert if not |
| 361 // supported. Or provide methods for converting a texture frame in | 359 // supported. Or provide methods for converting a texture frame in |
| 362 // VideoFrame. | 360 // VideoFrame. |
| 363 | 361 |
| 364 if (config_.renderer != nullptr) | 362 if (config_.renderer != nullptr) |
| 365 config_.renderer->RenderFrame( | 363 config_.renderer->RenderFrame( |
| 366 video_frame, | 364 video_frame, |
| 367 video_frame.render_time_ms() - clock_->TimeInMilliseconds()); | 365 video_frame.render_time_ms() - clock_->TimeInMilliseconds()); |
| 368 | 366 |
| 369 stats_proxy_->OnRenderedFrame(video_frame.width(), video_frame.height()); | 367 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); |
| 370 | 368 |
| 371 return 0; | 369 return 0; |
| 372 } | 370 } |
| 373 | 371 |
| 374 // TODO(asapersson): Consider moving callback from video_encoder.h or | 372 // TODO(asapersson): Consider moving callback from video_encoder.h or |
| 375 // creating a different callback. | 373 // creating a different callback. |
| 376 int32_t VideoReceiveStream::Encoded( | 374 int32_t VideoReceiveStream::Encoded( |
| 377 const EncodedImage& encoded_image, | 375 const EncodedImage& encoded_image, |
| 378 const CodecSpecificInfo* codec_specific_info, | 376 const CodecSpecificInfo* codec_specific_info, |
| 379 const RTPFragmentationHeader* fragmentation) { | 377 const RTPFragmentationHeader* fragmentation) { |
| 380 stats_proxy_->OnPreDecode(encoded_image, codec_specific_info); | 378 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); |
| 381 if (config_.pre_decode_callback) { | 379 if (config_.pre_decode_callback) { |
| 382 // TODO(asapersson): Remove EncodedFrameCallbackAdapter. | 380 // TODO(asapersson): Remove EncodedFrameCallbackAdapter. |
| 383 encoded_frame_proxy_.Encoded( | 381 encoded_frame_proxy_.Encoded( |
| 384 encoded_image, codec_specific_info, fragmentation); | 382 encoded_image, codec_specific_info, fragmentation); |
| 385 } | 383 } |
| 386 return 0; | 384 return 0; |
| 387 } | 385 } |
| 388 | 386 |
| 389 void VideoReceiveStream::SignalNetworkState(NetworkState state) { | 387 void VideoReceiveStream::SignalNetworkState(NetworkState state) { |
| 390 vie_channel_->SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode | 388 vie_channel_.SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode |
| 391 : RtcpMode::kOff); | 389 : RtcpMode::kOff); |
| 392 } | 390 } |
| 393 | 391 |
| 392 RemoteBitrateEstimator* VideoReceiveStream::GetRemoteBitrateEstimator() const { | |
| 393 bool send_side_bwe = | |
| 394 config_.rtp.transport_cc && UseSendSideBwe(config_.rtp.extensions); | |
| 395 | |
| 396 return congestion_controller_->GetRemoteBitrateEstimator(send_side_bwe); | |
| 397 } | |
|
stefan-webrtc
2016/02/05 12:50:36
Remove this and change UseSendSideBwe() to also ch
pbos-webrtc
2016/02/05 12:58:04
Done.
| |
| 398 | |
| 394 } // namespace internal | 399 } // namespace internal |
| 395 } // namespace webrtc | 400 } // namespace webrtc |
| OLD | NEW |