OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // rtc::VideoSinkInterface<cricket::VideoFrame>. | 382 // rtc::VideoSinkInterface<cricket::VideoFrame>. |
383 class WebRtcVideoReceiveStream | 383 class WebRtcVideoReceiveStream |
384 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 384 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
385 public: | 385 public: |
386 WebRtcVideoReceiveStream( | 386 WebRtcVideoReceiveStream( |
387 webrtc::Call* call, | 387 webrtc::Call* call, |
388 const StreamParams& sp, | 388 const StreamParams& sp, |
389 webrtc::VideoReceiveStream::Config config, | 389 webrtc::VideoReceiveStream::Config config, |
390 WebRtcVideoDecoderFactory* external_decoder_factory, | 390 WebRtcVideoDecoderFactory* external_decoder_factory, |
391 bool default_stream, | 391 bool default_stream, |
392 const std::vector<VideoCodecSettings>& recv_codecs, | 392 const std::vector<VideoCodecSettings>& recv_codecs); |
393 bool red_disabled_by_remote_side); | |
394 ~WebRtcVideoReceiveStream(); | 393 ~WebRtcVideoReceiveStream(); |
395 | 394 |
396 const std::vector<uint32_t>& GetSsrcs() const; | 395 const std::vector<uint32_t>& GetSsrcs() const; |
397 rtc::Optional<uint32_t> GetFirstPrimarySsrc() const; | 396 rtc::Optional<uint32_t> GetFirstPrimarySsrc() const; |
398 | 397 |
399 void SetLocalSsrc(uint32_t local_ssrc); | 398 void SetLocalSsrc(uint32_t local_ssrc); |
400 // TODO(deadbeef): Move these feedback parameters into the recv parameters. | 399 // TODO(deadbeef): Move these feedback parameters into the recv parameters. |
401 void SetFeedbackParameters(bool nack_enabled, | 400 void SetFeedbackParameters(bool nack_enabled, |
402 bool remb_enabled, | 401 bool remb_enabled, |
403 bool transport_cc_enabled, | 402 bool transport_cc_enabled, |
404 webrtc::RtcpMode rtcp_mode); | 403 webrtc::RtcpMode rtcp_mode); |
405 void SetRecvParameters(const ChangedRecvParameters& recv_params); | 404 void SetRecvParameters(const ChangedRecvParameters& recv_params); |
406 | 405 |
407 void OnFrame(const webrtc::VideoFrame& frame) override; | 406 void OnFrame(const webrtc::VideoFrame& frame) override; |
408 bool IsDefaultStream() const; | 407 bool IsDefaultStream() const; |
409 | 408 |
410 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); | 409 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); |
411 | 410 |
412 VideoReceiverInfo GetVideoReceiverInfo(bool log_stats); | 411 VideoReceiverInfo GetVideoReceiverInfo(bool log_stats); |
413 | 412 |
414 // Used to disable RED/FEC when the remote description doesn't contain those | |
415 // codecs. This is needed to be able to work around an RTX bug which is only | |
416 // happening if the remote side doesn't send RED, but the local side is | |
417 // configured to receive RED. | |
418 // TODO(holmer): Remove this after a couple of Chrome versions, M53-54 | |
419 // time frame. | |
420 void SetUlpfecDisabledRemotely(bool disable); | |
421 | |
422 private: | 413 private: |
423 struct AllocatedDecoder { | 414 struct AllocatedDecoder { |
424 AllocatedDecoder(webrtc::VideoDecoder* decoder, | 415 AllocatedDecoder(webrtc::VideoDecoder* decoder, |
425 webrtc::VideoCodecType type, | 416 webrtc::VideoCodecType type, |
426 bool external); | 417 bool external); |
427 webrtc::VideoDecoder* decoder; | 418 webrtc::VideoDecoder* decoder; |
428 // Decoder wrapped into a fallback decoder to permit software fallback. | 419 // Decoder wrapped into a fallback decoder to permit software fallback. |
429 webrtc::VideoDecoder* external_decoder; | 420 webrtc::VideoDecoder* external_decoder; |
430 webrtc::VideoCodecType type; | 421 webrtc::VideoCodecType type; |
431 bool external; | 422 bool external; |
432 }; | 423 }; |
433 | 424 |
434 void RecreateWebRtcStream(); | 425 void RecreateWebRtcStream(); |
435 | 426 |
436 void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs, | 427 void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs, |
437 std::vector<AllocatedDecoder>* old_codecs); | 428 std::vector<AllocatedDecoder>* old_codecs); |
438 AllocatedDecoder CreateOrReuseVideoDecoder( | 429 AllocatedDecoder CreateOrReuseVideoDecoder( |
439 std::vector<AllocatedDecoder>* old_decoder, | 430 std::vector<AllocatedDecoder>* old_decoder, |
440 const VideoCodec& codec); | 431 const VideoCodec& codec); |
441 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 432 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); |
442 | 433 |
443 std::string GetCodecNameFromPayloadType(int payload_type); | 434 std::string GetCodecNameFromPayloadType(int payload_type); |
444 | 435 |
445 webrtc::Call* const call_; | 436 webrtc::Call* const call_; |
446 StreamParams stream_params_; | 437 StreamParams stream_params_; |
447 | 438 |
448 webrtc::VideoReceiveStream* stream_; | 439 webrtc::VideoReceiveStream* stream_; |
449 const bool default_stream_; | 440 const bool default_stream_; |
450 webrtc::VideoReceiveStream::Config config_; | 441 webrtc::VideoReceiveStream::Config config_; |
451 bool red_disabled_by_remote_side_; | |
452 | 442 |
453 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 443 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
454 std::vector<AllocatedDecoder> allocated_decoders_; | 444 std::vector<AllocatedDecoder> allocated_decoders_; |
455 | 445 |
456 rtc::CriticalSection sink_lock_; | 446 rtc::CriticalSection sink_lock_; |
457 rtc::VideoSinkInterface<cricket::VideoFrame>* sink_ GUARDED_BY(sink_lock_); | 447 rtc::VideoSinkInterface<cricket::VideoFrame>* sink_ GUARDED_BY(sink_lock_); |
458 // Expands remote RTP timestamps to int64_t to be able to estimate how long | 448 // Expands remote RTP timestamps to int64_t to be able to estimate how long |
459 // the stream has been running. | 449 // the stream has been running. |
460 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 450 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
461 GUARDED_BY(sink_lock_); | 451 GUARDED_BY(sink_lock_); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 WebRtcVideoEncoderFactory* const external_encoder_factory_; | 504 WebRtcVideoEncoderFactory* const external_encoder_factory_; |
515 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 505 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
516 std::vector<VideoCodecSettings> recv_codecs_; | 506 std::vector<VideoCodecSettings> recv_codecs_; |
517 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 507 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
518 webrtc::Call::Config::BitrateConfig bitrate_config_; | 508 webrtc::Call::Config::BitrateConfig bitrate_config_; |
519 // TODO(deadbeef): Don't duplicate information between | 509 // TODO(deadbeef): Don't duplicate information between |
520 // send_params/recv_params, rtp_extensions, options, etc. | 510 // send_params/recv_params, rtp_extensions, options, etc. |
521 VideoSendParameters send_params_; | 511 VideoSendParameters send_params_; |
522 VideoOptions default_send_options_; | 512 VideoOptions default_send_options_; |
523 VideoRecvParameters recv_params_; | 513 VideoRecvParameters recv_params_; |
524 bool red_disabled_by_remote_side_; | |
525 int64_t last_stats_log_ms_; | 514 int64_t last_stats_log_ms_; |
526 }; | 515 }; |
527 | 516 |
528 } // namespace cricket | 517 } // namespace cricket |
529 | 518 |
530 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 519 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |