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

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

Issue 1432553007: Rename Maybe to Optional (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 options_.SetAll(options); 779 options_.SetAll(options);
780 if (options_.cpu_overuse_detection) 780 if (options_.cpu_overuse_detection)
781 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; 781 signal_cpu_adaptation_ = *options_.cpu_overuse_detection;
782 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; 782 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
783 sending_ = false; 783 sending_ = false;
784 default_send_ssrc_ = 0; 784 default_send_ssrc_ = 0;
785 SetRecvCodecs(recv_codecs); 785 SetRecvCodecs(recv_codecs);
786 } 786 }
787 787
788 void WebRtcVideoChannel2::SetDefaultOptions() { 788 void WebRtcVideoChannel2::SetDefaultOptions() {
789 options_.cpu_overuse_detection = rtc::Maybe<bool>(true); 789 options_.cpu_overuse_detection = rtc::Optional<bool>(true);
790 options_.dscp = rtc::Maybe<bool>(false); 790 options_.dscp = rtc::Optional<bool>(false);
791 options_.suspend_below_min_bitrate = rtc::Maybe<bool>(false); 791 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false);
792 options_.screencast_min_bitrate = rtc::Maybe<int>(0); 792 options_.screencast_min_bitrate = rtc::Optional<int>(0);
793 } 793 }
794 794
795 WebRtcVideoChannel2::~WebRtcVideoChannel2() { 795 WebRtcVideoChannel2::~WebRtcVideoChannel2() {
796 for (auto& kv : send_streams_) 796 for (auto& kv : send_streams_)
797 delete kv.second; 797 delete kv.second;
798 for (auto& kv : receive_streams_) 798 for (auto& kv : receive_streams_)
799 delete kv.second; 799 delete kv.second;
800 } 800 }
801 801
802 bool WebRtcVideoChannel2::CodecIsExternallySupported( 802 bool WebRtcVideoChannel2::CodecIsExternallySupported(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 953
954 LOG(LS_INFO) << "Using codec: " << supported_codecs.front().codec.ToString(); 954 LOG(LS_INFO) << "Using codec: " << supported_codecs.front().codec.ToString();
955 955
956 if (send_codec_ && supported_codecs.front() == *send_codec_) { 956 if (send_codec_ && supported_codecs.front() == *send_codec_) {
957 LOG(LS_INFO) << "Ignore call to SetSendCodecs because first supported " 957 LOG(LS_INFO) << "Ignore call to SetSendCodecs because first supported "
958 "codec hasn't changed."; 958 "codec hasn't changed.";
959 // Using same codec, avoid reconfiguring. 959 // Using same codec, avoid reconfiguring.
960 return true; 960 return true;
961 } 961 }
962 962
963 send_codec_ = rtc::Maybe<WebRtcVideoChannel2::VideoCodecSettings>( 963 send_codec_ = rtc::Optional<WebRtcVideoChannel2::VideoCodecSettings>(
964 supported_codecs.front()); 964 supported_codecs.front());
965 965
966 rtc::CritScope stream_lock(&stream_crit_); 966 rtc::CritScope stream_lock(&stream_crit_);
967 LOG(LS_INFO) << "Change the send codec because SetSendCodecs has a different " 967 LOG(LS_INFO) << "Change the send codec because SetSendCodecs has a different "
968 "first supported codec."; 968 "first supported codec.";
969 for (auto& kv : send_streams_) { 969 for (auto& kv : send_streams_) {
970 RTC_DCHECK(kv.second != nullptr); 970 RTC_DCHECK(kv.second != nullptr);
971 kv.second->SetCodec(supported_codecs.front()); 971 kv.second->SetCodec(supported_codecs.front());
972 } 972 }
973 LOG(LS_INFO) << "SetNackAndRemb on all the receive streams because the send " 973 LOG(LS_INFO) << "SetNackAndRemb on all the receive streams because the send "
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 it != send_streams_.end(); ++it) { 1697 it != send_streams_.end(); ++it) {
1698 it->second->Stop(); 1698 it->second->Stop();
1699 } 1699 }
1700 } 1700 }
1701 1701
1702 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: 1702 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters::
1703 VideoSendStreamParameters( 1703 VideoSendStreamParameters(
1704 const webrtc::VideoSendStream::Config& config, 1704 const webrtc::VideoSendStream::Config& config,
1705 const VideoOptions& options, 1705 const VideoOptions& options,
1706 int max_bitrate_bps, 1706 int max_bitrate_bps,
1707 const rtc::Maybe<VideoCodecSettings>& codec_settings) 1707 const rtc::Optional<VideoCodecSettings>& codec_settings)
1708 : config(config), 1708 : config(config),
1709 options(options), 1709 options(options),
1710 max_bitrate_bps(max_bitrate_bps), 1710 max_bitrate_bps(max_bitrate_bps),
1711 codec_settings(codec_settings) {} 1711 codec_settings(codec_settings) {}
1712 1712
1713 WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder::AllocatedEncoder( 1713 WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder::AllocatedEncoder(
1714 webrtc::VideoEncoder* encoder, 1714 webrtc::VideoEncoder* encoder,
1715 webrtc::VideoCodecType type, 1715 webrtc::VideoCodecType type,
1716 bool external) 1716 bool external)
1717 : encoder(encoder), 1717 : encoder(encoder),
1718 external_encoder(nullptr), 1718 external_encoder(nullptr),
1719 type(type), 1719 type(type),
1720 external(external) { 1720 external(external) {
1721 if (external) { 1721 if (external) {
1722 external_encoder = encoder; 1722 external_encoder = encoder;
1723 this->encoder = 1723 this->encoder =
1724 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); 1724 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder);
1725 } 1725 }
1726 } 1726 }
1727 1727
1728 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( 1728 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
1729 webrtc::Call* call, 1729 webrtc::Call* call,
1730 const StreamParams& sp, 1730 const StreamParams& sp,
1731 const webrtc::VideoSendStream::Config& config, 1731 const webrtc::VideoSendStream::Config& config,
1732 WebRtcVideoEncoderFactory* external_encoder_factory, 1732 WebRtcVideoEncoderFactory* external_encoder_factory,
1733 const VideoOptions& options, 1733 const VideoOptions& options,
1734 int max_bitrate_bps, 1734 int max_bitrate_bps,
1735 const rtc::Maybe<VideoCodecSettings>& codec_settings, 1735 const rtc::Optional<VideoCodecSettings>& codec_settings,
1736 const std::vector<webrtc::RtpExtension>& rtp_extensions) 1736 const std::vector<webrtc::RtpExtension>& rtp_extensions)
1737 : ssrcs_(sp.ssrcs), 1737 : ssrcs_(sp.ssrcs),
1738 ssrc_groups_(sp.ssrc_groups), 1738 ssrc_groups_(sp.ssrc_groups),
1739 call_(call), 1739 call_(call),
1740 external_encoder_factory_(external_encoder_factory), 1740 external_encoder_factory_(external_encoder_factory),
1741 stream_(NULL), 1741 stream_(NULL),
1742 parameters_(config, options, max_bitrate_bps, codec_settings), 1742 parameters_(config, options, max_bitrate_bps, codec_settings),
1743 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), 1743 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false),
1744 capturer_(NULL), 1744 capturer_(NULL),
1745 sending_(false), 1745 sending_(false),
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 } 2040 }
2041 2041
2042 parameters_.config.rtp.nack.rtp_history_ms = 2042 parameters_.config.rtp.nack.rtp_history_ms =
2043 HasNack(codec_settings.codec) ? kNackHistoryMs : 0; 2043 HasNack(codec_settings.codec) ? kNackHistoryMs : 0;
2044 2044
2045 RTC_CHECK(options.suspend_below_min_bitrate); 2045 RTC_CHECK(options.suspend_below_min_bitrate);
2046 parameters_.config.suspend_below_min_bitrate = 2046 parameters_.config.suspend_below_min_bitrate =
2047 *options.suspend_below_min_bitrate; 2047 *options.suspend_below_min_bitrate;
2048 2048
2049 parameters_.codec_settings = 2049 parameters_.codec_settings =
2050 rtc::Maybe<WebRtcVideoChannel2::VideoCodecSettings>(codec_settings); 2050 rtc::Optional<WebRtcVideoChannel2::VideoCodecSettings>(codec_settings);
2051 parameters_.options = options; 2051 parameters_.options = options;
2052 2052
2053 LOG(LS_INFO) 2053 LOG(LS_INFO)
2054 << "RecreateWebRtcStream (send) because of SetCodecAndOptions; options=" 2054 << "RecreateWebRtcStream (send) because of SetCodecAndOptions; options="
2055 << options.ToString(); 2055 << options.ToString();
2056 RecreateWebRtcStream(); 2056 RecreateWebRtcStream();
2057 if (allocated_encoder_.encoder != new_encoder.encoder) { 2057 if (allocated_encoder_.encoder != new_encoder.encoder) {
2058 DestroyVideoEncoder(&allocated_encoder_); 2058 DestroyVideoEncoder(&allocated_encoder_);
2059 allocated_encoder_ = new_encoder; 2059 allocated_encoder_ = new_encoder;
2060 } 2060 }
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2742 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2743 } 2743 }
2744 } 2744 }
2745 2745
2746 return video_codecs; 2746 return video_codecs;
2747 } 2747 }
2748 2748
2749 } // namespace cricket 2749 } // namespace cricket
2750 2750
2751 #endif // HAVE_WEBRTC_VIDEO 2751 #endif // HAVE_WEBRTC_VIDEO
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698