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

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2.cc

Issue 1646253004: Split out dscp option from VideoOptions to new struct MediaChannelOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rename DscpValue --> MediaTypeDscpValue. Created 4 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 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2"; 513 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2";
514 } 514 }
515 515
516 void WebRtcVideoEngine2::Init() { 516 void WebRtcVideoEngine2::Init() {
517 LOG(LS_INFO) << "WebRtcVideoEngine2::Init"; 517 LOG(LS_INFO) << "WebRtcVideoEngine2::Init";
518 initialized_ = true; 518 initialized_ = true;
519 } 519 }
520 520
521 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( 521 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
522 webrtc::Call* call, 522 webrtc::Call* call,
523 const VideoOptions& options) { 523 const MediaChannelOptions& options,
524 const VideoOptions& video_options) {
524 RTC_DCHECK(initialized_); 525 RTC_DCHECK(initialized_);
525 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); 526 LOG(LS_INFO) << "CreateChannel. Options: " << video_options.ToString();
526 return new WebRtcVideoChannel2(call, options, video_codecs_, 527 return new WebRtcVideoChannel2(call, options, video_options, video_codecs_,
527 external_encoder_factory_, external_decoder_factory_); 528 external_encoder_factory_,
529 external_decoder_factory_);
528 } 530 }
529 531
530 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { 532 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const {
531 return video_codecs_; 533 return video_codecs_;
532 } 534 }
533 535
534 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const { 536 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const {
535 RtpCapabilities capabilities; 537 RtpCapabilities capabilities;
536 capabilities.header_extensions.push_back( 538 capabilities.header_extensions.push_back(
537 RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, 539 RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 0); 634 0);
633 635
634 AddDefaultFeedbackParams(&codec); 636 AddDefaultFeedbackParams(&codec);
635 supported_codecs.push_back(codec); 637 supported_codecs.push_back(codec);
636 } 638 }
637 return supported_codecs; 639 return supported_codecs;
638 } 640 }
639 641
640 WebRtcVideoChannel2::WebRtcVideoChannel2( 642 WebRtcVideoChannel2::WebRtcVideoChannel2(
641 webrtc::Call* call, 643 webrtc::Call* call,
642 const VideoOptions& options, 644 const MediaChannelOptions& options,
645 const VideoOptions& video_options,
643 const std::vector<VideoCodec>& recv_codecs, 646 const std::vector<VideoCodec>& recv_codecs,
644 WebRtcVideoEncoderFactory* external_encoder_factory, 647 WebRtcVideoEncoderFactory* external_encoder_factory,
645 WebRtcVideoDecoderFactory* external_decoder_factory) 648 WebRtcVideoDecoderFactory* external_decoder_factory)
646 : call_(call), 649 : VideoMediaChannel(options),
650 call_(call),
647 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), 651 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
648 external_encoder_factory_(external_encoder_factory), 652 external_encoder_factory_(external_encoder_factory),
649 external_decoder_factory_(external_decoder_factory) { 653 external_decoder_factory_(external_decoder_factory) {
650 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 654 RTC_DCHECK(thread_checker_.CalledOnValidThread());
651 SetDefaultOptions(); 655 SetDefaultOptions();
652 options_.SetAll(options); 656 options_.SetAll(video_options);
653 if (options_.cpu_overuse_detection) 657 if (options_.cpu_overuse_detection)
654 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; 658 signal_cpu_adaptation_ = *options_.cpu_overuse_detection;
655 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; 659 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
656 sending_ = false; 660 sending_ = false;
657 default_send_ssrc_ = 0; 661 default_send_ssrc_ = 0;
658 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); 662 RTC_DCHECK(ValidateCodecFormats(recv_codecs));
659 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); 663 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs));
660 } 664 }
661 665
662 void WebRtcVideoChannel2::SetDefaultOptions() { 666 void WebRtcVideoChannel2::SetDefaultOptions() {
663 options_.cpu_overuse_detection = rtc::Optional<bool>(true); 667 options_.cpu_overuse_detection = rtc::Optional<bool>(true);
664 options_.dscp = rtc::Optional<bool>(false);
665 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false); 668 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false);
666 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0); 669 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0);
667 } 670 }
668 671
669 WebRtcVideoChannel2::~WebRtcVideoChannel2() { 672 WebRtcVideoChannel2::~WebRtcVideoChannel2() {
670 for (auto& kv : send_streams_) 673 for (auto& kv : send_streams_)
671 delete kv.second; 674 delete kv.second;
672 for (auto& kv : receive_streams_) 675 for (auto& kv : receive_streams_)
673 delete kv.second; 676 delete kv.second;
674 } 677 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // Handle RTCP mode. 790 // Handle RTCP mode.
788 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { 791 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) {
789 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( 792 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>(
790 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize 793 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize
791 : webrtc::RtcpMode::kCompound); 794 : webrtc::RtcpMode::kCompound);
792 } 795 }
793 796
794 return true; 797 return true;
795 } 798 }
796 799
800 rtc::DiffServCodePoint WebRtcVideoChannel2::MediaTypeDscpValue() const {
801 return rtc::DSCP_AF41;
802 }
803
797 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { 804 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) {
798 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); 805 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters");
799 LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); 806 LOG(LS_INFO) << "SetSendParameters: " << params.ToString();
800 ChangedSendParameters changed_params; 807 ChangedSendParameters changed_params;
801 if (!GetChangedSendParameters(params, &changed_params)) { 808 if (!GetChangedSendParameters(params, &changed_params)) {
802 return false; 809 return false;
803 } 810 }
804 811
805 bool bitrate_config_changed = false; 812 bool bitrate_config_changed = false;
806 813
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 } 846 }
840 847
841 if (changed_params.options) { 848 if (changed_params.options) {
842 options_.SetAll(*changed_params.options); 849 options_.SetAll(*changed_params.options);
843 { 850 {
844 rtc::CritScope lock(&capturer_crit_); 851 rtc::CritScope lock(&capturer_crit_);
845 if (options_.cpu_overuse_detection) { 852 if (options_.cpu_overuse_detection) {
846 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; 853 signal_cpu_adaptation_ = *options_.cpu_overuse_detection;
847 } 854 }
848 } 855 }
849 rtc::DiffServCodePoint dscp =
850 options_.dscp.value_or(false) ? rtc::DSCP_AF41 : rtc::DSCP_DEFAULT;
851 MediaChannel::SetDscp(dscp);
852 } 856 }
853 857
854 { 858 {
855 rtc::CritScope stream_lock(&stream_crit_); 859 rtc::CritScope stream_lock(&stream_crit_);
856 for (auto& kv : send_streams_) { 860 for (auto& kv : send_streams_) {
857 kv.second->SetSendParameters(changed_params); 861 kv.second->SetSendParameters(changed_params);
858 } 862 }
859 if (changed_params.codec) { 863 if (changed_params.codec) {
860 // Update receive feedback parameters from new codec. 864 // Update receive feedback parameters from new codec.
861 LOG(LS_INFO) 865 LOG(LS_INFO)
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2609 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2606 } 2610 }
2607 } 2611 }
2608 2612
2609 return video_codecs; 2613 return video_codecs;
2610 } 2614 }
2611 2615
2612 } // namespace cricket 2616 } // namespace cricket
2613 2617
2614 #endif // HAVE_WEBRTC_VIDEO 2618 #endif // HAVE_WEBRTC_VIDEO
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698