| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 VieRemb* remb) | 151 VieRemb* remb) |
| 152 : transport_adapter_(config.rtcp_send_transport), | 152 : transport_adapter_(config.rtcp_send_transport), |
| 153 encoded_frame_proxy_(config.pre_decode_callback), | 153 encoded_frame_proxy_(config.pre_decode_callback), |
| 154 config_(config), | 154 config_(config), |
| 155 process_thread_(process_thread), | 155 process_thread_(process_thread), |
| 156 clock_(Clock::GetRealTimeClock()), | 156 clock_(Clock::GetRealTimeClock()), |
| 157 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), | 157 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), |
| 158 congestion_controller_(congestion_controller), | 158 congestion_controller_(congestion_controller), |
| 159 call_stats_(call_stats), | 159 call_stats_(call_stats), |
| 160 remb_(remb), | 160 remb_(remb), |
| 161 vcm_(VideoCodingModule::Create(clock_, nullptr, nullptr)), | |
| 162 incoming_video_stream_( | 161 incoming_video_stream_( |
| 163 0, | 162 0, |
| 164 config.renderer ? config.renderer->SmoothsRenderedFrames() : false), | 163 config.renderer ? config.renderer->SmoothsRenderedFrames() : false), |
| 165 stats_proxy_(config_.rtp.remote_ssrc, clock_), | 164 stats_proxy_(config_.rtp.remote_ssrc, clock_), |
| 166 vie_channel_(&transport_adapter_, | 165 vie_channel_(&transport_adapter_, |
| 167 process_thread, | 166 process_thread, |
| 168 nullptr, | 167 nullptr, |
| 169 vcm_.get(), | |
| 170 nullptr, | 168 nullptr, |
| 171 nullptr, | 169 nullptr, |
| 172 nullptr, | 170 nullptr, |
| 173 congestion_controller_->GetRemoteBitrateEstimator( | 171 congestion_controller_->GetRemoteBitrateEstimator( |
| 174 UseSendSideBwe(config_)), | 172 UseSendSideBwe(config_)), |
| 175 call_stats_->rtcp_rtt_stats(), | 173 call_stats_->rtcp_rtt_stats(), |
| 176 congestion_controller_->pacer(), | 174 congestion_controller_->pacer(), |
| 177 congestion_controller_->packet_router(), | 175 congestion_controller_->packet_router(), |
| 178 1, | 176 1, |
| 179 false), | 177 false), |
| 180 vie_receiver_(vie_channel_.vie_receiver()), | 178 vie_receiver_(vie_channel_.vie_receiver()), |
| 179 vcm_(vie_channel_.vcm()), |
| 181 rtp_rtcp_(vie_channel_.rtp_rtcp()) { | 180 rtp_rtcp_(vie_channel_.rtp_rtcp()) { |
| 182 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); | 181 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); |
| 183 | 182 |
| 184 RTC_DCHECK(process_thread_); | 183 RTC_DCHECK(process_thread_); |
| 185 RTC_DCHECK(congestion_controller_); | 184 RTC_DCHECK(congestion_controller_); |
| 186 RTC_DCHECK(call_stats_); | 185 RTC_DCHECK(call_stats_); |
| 187 RTC_DCHECK(remb_); | 186 RTC_DCHECK(remb_); |
| 188 RTC_CHECK(vie_channel_.Init() == 0); | 187 vie_channel_.Init(); |
| 189 | 188 |
| 190 // Register the channel to receive stats updates. | 189 // Register the channel to receive stats updates. |
| 191 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); | 190 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 192 | 191 |
| 193 // TODO(pbos): This is not fine grained enough... | 192 // TODO(pbos): This is not fine grained enough... |
| 194 vie_channel_.SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, -1, | 193 vie_channel_.SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, -1, |
| 195 -1); | 194 -1); |
| 196 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) | 195 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) |
| 197 << "A stream should not be configured with RTCP disabled. This value is " | 196 << "A stream should not be configured with RTCP disabled. This value is " |
| 198 "reserved for internal usage."; | 197 "reserved for internal usage."; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 vcm_->RegisterReceiveCodec(&codec, num_cpu_cores, false)); | 294 vcm_->RegisterReceiveCodec(&codec, num_cpu_cores, false)); |
| 296 } | 295 } |
| 297 | 296 |
| 298 vcm_->SetRenderDelay(config.render_delay_ms); | 297 vcm_->SetRenderDelay(config.render_delay_ms); |
| 299 incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms); | 298 incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms); |
| 300 vcm_->RegisterPreDecodeImageCallback(this); | 299 vcm_->RegisterPreDecodeImageCallback(this); |
| 301 incoming_video_stream_.SetExternalCallback(this); | 300 incoming_video_stream_.SetExternalCallback(this); |
| 302 vie_channel_.SetIncomingVideoStream(&incoming_video_stream_); | 301 vie_channel_.SetIncomingVideoStream(&incoming_video_stream_); |
| 303 vie_channel_.RegisterPreRenderCallback(this); | 302 vie_channel_.RegisterPreRenderCallback(this); |
| 304 | 303 |
| 305 process_thread_->RegisterModule(vcm_.get()); | 304 // Registration of VCM and callbacks here is part of splitting ViEChannel and |
| 305 // moving functionality to sender/receivers instead of ViEChannel. |
| 306 RTC_CHECK_EQ(0, vcm_->RegisterReceiveCallback(&vie_channel_)); |
| 307 vcm_->RegisterFrameTypeCallback(&vie_channel_); |
| 308 vcm_->RegisterReceiveStatisticsCallback(&vie_channel_); |
| 309 vcm_->RegisterDecoderTimingCallback(&vie_channel_); |
| 310 |
| 311 process_thread_->RegisterModule(vcm_); |
| 306 } | 312 } |
| 307 | 313 |
| 308 VideoReceiveStream::~VideoReceiveStream() { | 314 VideoReceiveStream::~VideoReceiveStream() { |
| 309 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); | 315 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); |
| 310 Stop(); | 316 Stop(); |
| 311 | 317 |
| 312 process_thread_->DeRegisterModule(vcm_.get()); | 318 process_thread_->DeRegisterModule(vcm_); |
| 313 vie_channel_.RegisterPreRenderCallback(nullptr); | 319 vie_channel_.RegisterPreRenderCallback(nullptr); |
| 314 vcm_->RegisterPreDecodeImageCallback(nullptr); | 320 vcm_->RegisterPreDecodeImageCallback(nullptr); |
| 315 | 321 |
| 316 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); | 322 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); |
| 317 rtp_rtcp_->SetREMBStatus(false); | 323 rtp_rtcp_->SetREMBStatus(false); |
| 318 remb_->RemoveReceiveChannel(rtp_rtcp_); | 324 remb_->RemoveReceiveChannel(rtp_rtcp_); |
| 319 | 325 |
| 320 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_)) | 326 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_)) |
| 321 ->RemoveStream(vie_receiver_->GetRemoteSsrc()); | 327 ->RemoveStream(vie_receiver_->GetRemoteSsrc()); |
| 322 } | 328 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 376 |
| 371 // Post processing is not supported if the frame is backed by a texture. | 377 // Post processing is not supported if the frame is backed by a texture. |
| 372 if (video_frame->native_handle() == NULL) { | 378 if (video_frame->native_handle() == NULL) { |
| 373 if (config_.pre_render_callback) | 379 if (config_.pre_render_callback) |
| 374 config_.pre_render_callback->FrameCallback(video_frame); | 380 config_.pre_render_callback->FrameCallback(video_frame); |
| 375 } | 381 } |
| 376 } | 382 } |
| 377 | 383 |
| 378 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, | 384 int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/, |
| 379 const VideoFrame& video_frame) { | 385 const VideoFrame& video_frame) { |
| 380 // TODO(pbos): Wire up config_.render->IsTextureSupported() and convert if not | |
| 381 // supported. Or provide methods for converting a texture frame in | |
| 382 // VideoFrame. | |
| 383 | |
| 384 if (config_.renderer != nullptr) | 386 if (config_.renderer != nullptr) |
| 385 config_.renderer->RenderFrame( | 387 config_.renderer->RenderFrame( |
| 386 video_frame, | 388 video_frame, |
| 387 video_frame.render_time_ms() - clock_->TimeInMilliseconds()); | 389 video_frame.render_time_ms() - clock_->TimeInMilliseconds()); |
| 388 | 390 |
| 389 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); | 391 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); |
| 390 | 392 |
| 391 return 0; | 393 return 0; |
| 392 } | 394 } |
| 393 | 395 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 416 return true; | 418 return true; |
| 417 } | 419 } |
| 418 | 420 |
| 419 void VideoReceiveStream::Decode() { | 421 void VideoReceiveStream::Decode() { |
| 420 static const int kMaxDecodeWaitTimeMs = 50; | 422 static const int kMaxDecodeWaitTimeMs = 50; |
| 421 vcm_->Decode(kMaxDecodeWaitTimeMs); | 423 vcm_->Decode(kMaxDecodeWaitTimeMs); |
| 422 } | 424 } |
| 423 | 425 |
| 424 } // namespace internal | 426 } // namespace internal |
| 425 } // namespace webrtc | 427 } // namespace webrtc |
| OLD | NEW |