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

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 2649973005: Inform jitter buffer about FlexFEC protection. (Closed)
Patch Set: Take 2. Created 3 years, 10 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
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 kDefaultStartBitrate; 181 kDefaultStartBitrate;
182 182
183 return codec; 183 return codec;
184 } 184 }
185 } // namespace 185 } // namespace
186 186
187 namespace internal { 187 namespace internal {
188 188
189 VideoReceiveStream::VideoReceiveStream( 189 VideoReceiveStream::VideoReceiveStream(
190 int num_cpu_cores, 190 int num_cpu_cores,
191 bool protected_by_flexfec,
191 CongestionController* congestion_controller, 192 CongestionController* congestion_controller,
192 PacketRouter* packet_router, 193 PacketRouter* packet_router,
193 VideoReceiveStream::Config config, 194 VideoReceiveStream::Config config,
194 webrtc::VoiceEngine* voice_engine, 195 webrtc::VoiceEngine* voice_engine,
195 ProcessThread* process_thread, 196 ProcessThread* process_thread,
196 CallStats* call_stats, 197 CallStats* call_stats,
197 VieRemb* remb) 198 VieRemb* remb)
198 : transport_adapter_(config.rtcp_send_transport), 199 : transport_adapter_(config.rtcp_send_transport),
199 config_(std::move(config)), 200 config_(std::move(config)),
200 num_cpu_cores_(num_cpu_cores), 201 num_cpu_cores_(num_cpu_cores),
202 protected_by_flexfec_(protected_by_flexfec),
201 process_thread_(process_thread), 203 process_thread_(process_thread),
202 clock_(Clock::GetRealTimeClock()), 204 clock_(Clock::GetRealTimeClock()),
203 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), 205 decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
204 congestion_controller_(congestion_controller), 206 congestion_controller_(congestion_controller),
205 call_stats_(call_stats), 207 call_stats_(call_stats),
206 timing_(new VCMTiming(clock_)), 208 timing_(new VCMTiming(clock_)),
207 video_receiver_(clock_, nullptr, this, timing_.get(), this, this), 209 video_receiver_(clock_, nullptr, this, timing_.get(), this, this),
208 stats_proxy_(&config_, clock_), 210 stats_proxy_(&config_, clock_),
209 rtp_stream_receiver_( 211 rtp_stream_receiver_(congestion_controller_->GetRemoteBitrateEstimator(
210 congestion_controller_->GetRemoteBitrateEstimator( 212 UseSendSideBwe(config_)),
211 UseSendSideBwe(config_)), 213 &transport_adapter_,
212 &transport_adapter_, 214 call_stats_->rtcp_rtt_stats(),
213 call_stats_->rtcp_rtt_stats(), 215 packet_router,
214 packet_router, 216 remb,
215 remb, 217 &config_,
216 &config_, 218 &stats_proxy_,
217 &stats_proxy_, 219 process_thread_,
218 process_thread_, 220 this, // NackSender
219 this, // NackSender 221 this, // KeyFrameRequestSender
220 this, // KeyFrameRequestSender 222 this, // OnCompleteFrameCallback
221 this, // OnCompleteFrameCallback 223 timing_.get()),
222 timing_.get()),
223 rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_) { 224 rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_) {
224 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 225 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
225 226
226 RTC_DCHECK(process_thread_); 227 RTC_DCHECK(process_thread_);
227 RTC_DCHECK(congestion_controller_); 228 RTC_DCHECK(congestion_controller_);
228 RTC_DCHECK(call_stats_); 229 RTC_DCHECK(call_stats_);
229 230
230 RTC_DCHECK(!config_.decoders.empty()); 231 RTC_DCHECK(!config_.decoders.empty());
231 std::set<int> decoder_payload_types; 232 std::set<int> decoder_payload_types;
232 for (const Decoder& decoder : config_.decoders) { 233 for (const Decoder& decoder : config_.decoders) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 291 }
291 } 292 }
292 293
293 void VideoReceiveStream::Start() { 294 void VideoReceiveStream::Start() {
294 if (decode_thread_.IsRunning()) 295 if (decode_thread_.IsRunning())
295 return; 296 return;
296 297
297 frame_buffer_->Start(); 298 frame_buffer_->Start();
298 call_stats_->RegisterStatsObserver(&rtp_stream_receiver_); 299 call_stats_->RegisterStatsObserver(&rtp_stream_receiver_);
299 300
300 if (rtp_stream_receiver_.IsRetransmissionsEnabled() && 301 bool protected_by_fec =
301 rtp_stream_receiver_.IsUlpfecEnabled()) { 302 protected_by_flexfec_ || rtp_stream_receiver_.IsUlpfecEnabled();
303
304 if (rtp_stream_receiver_.IsRetransmissionsEnabled() && protected_by_fec) {
302 frame_buffer_->SetProtectionMode(kProtectionNackFEC); 305 frame_buffer_->SetProtectionMode(kProtectionNackFEC);
303 } 306 }
304 307
305 transport_adapter_.Enable(); 308 transport_adapter_.Enable();
306 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; 309 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
307 if (config_.renderer) { 310 if (config_.renderer) {
308 if (config_.disable_prerenderer_smoothing) { 311 if (config_.disable_prerenderer_smoothing) {
309 renderer = this; 312 renderer = this;
310 } else { 313 } else {
311 incoming_video_stream_.reset( 314 incoming_video_stream_.reset(
312 new IncomingVideoStream(config_.render_delay_ms, this)); 315 new IncomingVideoStream(config_.render_delay_ms, this));
313 renderer = incoming_video_stream_.get(); 316 renderer = incoming_video_stream_.get();
314 } 317 }
315 } 318 }
316 RTC_DCHECK(renderer != nullptr); 319 RTC_DCHECK(renderer != nullptr);
317 320
318 for (const Decoder& decoder : config_.decoders) { 321 for (const Decoder& decoder : config_.decoders) {
319 video_receiver_.RegisterExternalDecoder(decoder.decoder, 322 video_receiver_.RegisterExternalDecoder(decoder.decoder,
320 decoder.payload_type); 323 decoder.payload_type);
321 VideoCodec codec = CreateDecoderVideoCodec(decoder); 324 VideoCodec codec = CreateDecoderVideoCodec(decoder);
322 RTC_CHECK( 325 RTC_CHECK(
323 rtp_stream_receiver_.AddReceiveCodec(codec, decoder.codec_params)); 326 rtp_stream_receiver_.AddReceiveCodec(codec, decoder.codec_params));
324 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec( 327 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
325 &codec, num_cpu_cores_, false)); 328 &codec, num_cpu_cores_, false));
326 } 329 }
327 330
328 video_stream_decoder_.reset(new VideoStreamDecoder( 331 video_stream_decoder_.reset(new VideoStreamDecoder(
329 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_, 332 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_,
330 rtp_stream_receiver_.IsRetransmissionsEnabled(), 333 rtp_stream_receiver_.IsRetransmissionsEnabled(), protected_by_fec,
331 rtp_stream_receiver_.IsUlpfecEnabled(), &stats_proxy_, renderer, 334 &stats_proxy_, renderer, config_.pre_render_callback));
332 config_.pre_render_callback));
333 // Register the channel to receive stats updates. 335 // Register the channel to receive stats updates.
334 call_stats_->RegisterStatsObserver(video_stream_decoder_.get()); 336 call_stats_->RegisterStatsObserver(video_stream_decoder_.get());
335 // Start the decode thread 337 // Start the decode thread
336 decode_thread_.Start(); 338 decode_thread_.Start();
337 decode_thread_.SetPriority(rtc::kHighestPriority); 339 decode_thread_.SetPriority(rtc::kHighestPriority);
338 rtp_stream_receiver_.StartReceive(); 340 rtp_stream_receiver_.StartReceive();
339 } 341 }
340 342
341 void VideoReceiveStream::Stop() { 343 void VideoReceiveStream::Stop() {
342 rtp_stream_receiver_.StopReceive(); 344 rtp_stream_receiver_.StopReceive();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 rtp_stream_receiver_.FrameDecoded(frame->picture_id); 473 rtp_stream_receiver_.FrameDecoded(frame->picture_id);
472 } else { 474 } else {
473 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs 475 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
474 << " ms, requesting keyframe."; 476 << " ms, requesting keyframe.";
475 RequestKeyFrame(); 477 RequestKeyFrame();
476 } 478 }
477 } 479 }
478 480
479 } // namespace internal 481 } // namespace internal
480 } // namespace webrtc 482 } // namespace webrtc
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.cc ('K') | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698