Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: video/video_receive_stream.cc

Issue 3016633002: Reland of Fix the video buffer size should take rtt into consideration (Closed)
Patch Set: Rebase Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « video/video_receive_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void VideoReceiveStream::Start() { 169 void VideoReceiveStream::Start() {
170 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); 170 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_);
171 if (decode_thread_.IsRunning()) 171 if (decode_thread_.IsRunning())
172 return; 172 return;
173 173
174 bool protected_by_fec = config_.rtp.protected_by_flexfec || 174 bool protected_by_fec = config_.rtp.protected_by_flexfec ||
175 rtp_video_stream_receiver_.IsUlpfecEnabled(); 175 rtp_video_stream_receiver_.IsUlpfecEnabled();
176 176
177 frame_buffer_->Start(); 177 frame_buffer_->Start();
178 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_); 178 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_);
179 call_stats_->RegisterStatsObserver(this);
179 180
180 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() && 181 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() &&
181 protected_by_fec) { 182 protected_by_fec) {
182 frame_buffer_->SetProtectionMode(kProtectionNackFEC); 183 frame_buffer_->SetProtectionMode(kProtectionNackFEC);
183 } 184 }
184 185
185 transport_adapter_.Enable(); 186 transport_adapter_.Enable();
186 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; 187 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
187 if (config_.renderer) { 188 if (config_.renderer) {
188 if (config_.disable_prerenderer_smoothing) { 189 if (config_.disable_prerenderer_smoothing) {
(...skipping 29 matching lines...) Expand all
218 // Start the decode thread 219 // Start the decode thread
219 decode_thread_.Start(); 220 decode_thread_.Start();
220 rtp_video_stream_receiver_.StartReceive(); 221 rtp_video_stream_receiver_.StartReceive();
221 } 222 }
222 223
223 void VideoReceiveStream::Stop() { 224 void VideoReceiveStream::Stop() {
224 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); 225 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_);
225 rtp_video_stream_receiver_.StopReceive(); 226 rtp_video_stream_receiver_.StopReceive();
226 227
227 frame_buffer_->Stop(); 228 frame_buffer_->Stop();
229 call_stats_->DeregisterStatsObserver(this);
228 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_); 230 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_);
229 process_thread_->DeRegisterModule(&video_receiver_); 231 process_thread_->DeRegisterModule(&video_receiver_);
230 232
231 if (decode_thread_.IsRunning()) { 233 if (decode_thread_.IsRunning()) {
232 // TriggerDecoderShutdown will release any waiting decoder thread and make 234 // TriggerDecoderShutdown will release any waiting decoder thread and make
233 // it stop immediately, instead of waiting for a timeout. Needs to be called 235 // it stop immediately, instead of waiting for a timeout. Needs to be called
234 // before joining the decoder thread. 236 // before joining the decoder thread.
235 video_receiver_.TriggerDecoderShutdown(); 237 video_receiver_.TriggerDecoderShutdown();
236 238
237 decode_thread_.Stop(); 239 decode_thread_.Stop();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 rtp_video_stream_receiver_.RequestKeyFrame(); 342 rtp_video_stream_receiver_.RequestKeyFrame();
341 } 343 }
342 344
343 void VideoReceiveStream::OnCompleteFrame( 345 void VideoReceiveStream::OnCompleteFrame(
344 std::unique_ptr<video_coding::FrameObject> frame) { 346 std::unique_ptr<video_coding::FrameObject> frame) {
345 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame)); 347 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame));
346 if (last_continuous_pid != -1) 348 if (last_continuous_pid != -1)
347 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid); 349 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid);
348 } 350 }
349 351
352 void VideoReceiveStream::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
353 frame_buffer_->UpdateRtt(max_rtt_ms);
354 }
355
350 int VideoReceiveStream::id() const { 356 int VideoReceiveStream::id() const {
351 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); 357 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_);
352 return config_.rtp.remote_ssrc; 358 return config_.rtp.remote_ssrc;
353 } 359 }
354 360
355 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const { 361 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
356 RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_); 362 RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_);
357 Syncable::Info info; 363 Syncable::Info info;
358 364
359 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver(); 365 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (stream_is_active && !receiving_keyframe) { 450 if (stream_is_active && !receiving_keyframe) {
445 LOG(LS_WARNING) << "No decodable frame in " << wait_ms 451 LOG(LS_WARNING) << "No decodable frame in " << wait_ms
446 << " ms, requesting keyframe."; 452 << " ms, requesting keyframe.";
447 RequestKeyFrame(); 453 RequestKeyFrame();
448 } 454 }
449 } 455 }
450 return true; 456 return true;
451 } 457 }
452 } // namespace internal 458 } // namespace internal
453 } // namespace webrtc 459 } // namespace webrtc
OLDNEW
« no previous file with comments | « video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698