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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 void VideoReceiveStream::Start() { | 260 void VideoReceiveStream::Start() { |
261 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); | 261 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); |
262 if (decode_thread_.IsRunning()) | 262 if (decode_thread_.IsRunning()) |
263 return; | 263 return; |
264 | 264 |
265 bool protected_by_fec = config_.rtp.protected_by_flexfec || | 265 bool protected_by_fec = config_.rtp.protected_by_flexfec || |
266 rtp_video_stream_receiver_.IsUlpfecEnabled(); | 266 rtp_video_stream_receiver_.IsUlpfecEnabled(); |
267 | 267 |
268 frame_buffer_->Start(); | 268 frame_buffer_->Start(); |
269 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_); | 269 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_); |
270 call_stats_->RegisterStatsObserver(this); | |
271 | 270 |
272 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() && | 271 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() && |
273 protected_by_fec) { | 272 protected_by_fec) { |
274 frame_buffer_->SetProtectionMode(kProtectionNackFEC); | 273 frame_buffer_->SetProtectionMode(kProtectionNackFEC); |
275 } | 274 } |
276 | 275 |
277 transport_adapter_.Enable(); | 276 transport_adapter_.Enable(); |
278 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; | 277 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; |
279 if (config_.renderer) { | 278 if (config_.renderer) { |
280 if (config_.disable_prerenderer_smoothing) { | 279 if (config_.disable_prerenderer_smoothing) { |
(...skipping 29 matching lines...) Expand all Loading... |
310 // Start the decode thread | 309 // Start the decode thread |
311 decode_thread_.Start(); | 310 decode_thread_.Start(); |
312 rtp_video_stream_receiver_.StartReceive(); | 311 rtp_video_stream_receiver_.StartReceive(); |
313 } | 312 } |
314 | 313 |
315 void VideoReceiveStream::Stop() { | 314 void VideoReceiveStream::Stop() { |
316 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); | 315 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); |
317 rtp_video_stream_receiver_.StopReceive(); | 316 rtp_video_stream_receiver_.StopReceive(); |
318 | 317 |
319 frame_buffer_->Stop(); | 318 frame_buffer_->Stop(); |
320 call_stats_->DeregisterStatsObserver(this); | |
321 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_); | 319 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_); |
322 process_thread_->DeRegisterModule(&video_receiver_); | 320 process_thread_->DeRegisterModule(&video_receiver_); |
323 | 321 |
324 if (decode_thread_.IsRunning()) { | 322 if (decode_thread_.IsRunning()) { |
325 // TriggerDecoderShutdown will release any waiting decoder thread and make | 323 // TriggerDecoderShutdown will release any waiting decoder thread and make |
326 // it stop immediately, instead of waiting for a timeout. Needs to be called | 324 // it stop immediately, instead of waiting for a timeout. Needs to be called |
327 // before joining the decoder thread. | 325 // before joining the decoder thread. |
328 video_receiver_.TriggerDecoderShutdown(); | 326 video_receiver_.TriggerDecoderShutdown(); |
329 | 327 |
330 decode_thread_.Stop(); | 328 decode_thread_.Stop(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 rtp_video_stream_receiver_.RequestKeyFrame(); | 436 rtp_video_stream_receiver_.RequestKeyFrame(); |
439 } | 437 } |
440 | 438 |
441 void VideoReceiveStream::OnCompleteFrame( | 439 void VideoReceiveStream::OnCompleteFrame( |
442 std::unique_ptr<video_coding::FrameObject> frame) { | 440 std::unique_ptr<video_coding::FrameObject> frame) { |
443 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame)); | 441 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame)); |
444 if (last_continuous_pid != -1) | 442 if (last_continuous_pid != -1) |
445 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid); | 443 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid); |
446 } | 444 } |
447 | 445 |
448 void VideoReceiveStream::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { | |
449 frame_buffer_->UpdateRtt(max_rtt_ms); | |
450 } | |
451 | |
452 int VideoReceiveStream::id() const { | 446 int VideoReceiveStream::id() const { |
453 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); | 447 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); |
454 return config_.rtp.remote_ssrc; | 448 return config_.rtp.remote_ssrc; |
455 } | 449 } |
456 | 450 |
457 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const { | 451 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const { |
458 RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_); | 452 RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_); |
459 Syncable::Info info; | 453 Syncable::Info info; |
460 | 454 |
461 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver(); | 455 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 if (stream_is_active && !receiving_keyframe) { | 538 if (stream_is_active && !receiving_keyframe) { |
545 LOG(LS_WARNING) << "No decodable frame in " << wait_ms | 539 LOG(LS_WARNING) << "No decodable frame in " << wait_ms |
546 << " ms, requesting keyframe."; | 540 << " ms, requesting keyframe."; |
547 RequestKeyFrame(); | 541 RequestKeyFrame(); |
548 } | 542 } |
549 } | 543 } |
550 return true; | 544 return true; |
551 } | 545 } |
552 } // namespace internal | 546 } // namespace internal |
553 } // namespace webrtc | 547 } // namespace webrtc |
OLD | NEW |