| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 : call_(call), |
| 647 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), | 650 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), |
| 648 external_encoder_factory_(external_encoder_factory), | 651 external_encoder_factory_(external_encoder_factory), |
| 649 external_decoder_factory_(external_decoder_factory) { | 652 external_decoder_factory_(external_decoder_factory) { |
| 650 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 653 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 651 SetDefaultOptions(); | 654 SetDefaultOptions(); |
| 652 options_.SetAll(options); | 655 options_.SetAll(video_options); |
| 653 if (options_.cpu_overuse_detection) | 656 if (options_.cpu_overuse_detection) |
| 654 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; | 657 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; |
| 655 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; | 658 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; |
| 656 sending_ = false; | 659 sending_ = false; |
| 657 default_send_ssrc_ = 0; | 660 default_send_ssrc_ = 0; |
| 658 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); | 661 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); |
| 659 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); | 662 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); |
| 660 } | 663 } |
| 661 | 664 |
| 662 void WebRtcVideoChannel2::SetDefaultOptions() { | 665 void WebRtcVideoChannel2::SetDefaultOptions() { |
| 663 options_.cpu_overuse_detection = rtc::Optional<bool>(true); | 666 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); | 667 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false); |
| 666 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0); | 668 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0); |
| 667 } | 669 } |
| 668 | 670 |
| 669 WebRtcVideoChannel2::~WebRtcVideoChannel2() { | 671 WebRtcVideoChannel2::~WebRtcVideoChannel2() { |
| 670 for (auto& kv : send_streams_) | 672 for (auto& kv : send_streams_) |
| 671 delete kv.second; | 673 delete kv.second; |
| 672 for (auto& kv : receive_streams_) | 674 for (auto& kv : receive_streams_) |
| 673 delete kv.second; | 675 delete kv.second; |
| 674 } | 676 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 // Handle RTCP mode. | 789 // Handle RTCP mode. |
| 788 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { | 790 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { |
| 789 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( | 791 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( |
| 790 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize | 792 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize |
| 791 : webrtc::RtcpMode::kCompound); | 793 : webrtc::RtcpMode::kCompound); |
| 792 } | 794 } |
| 793 | 795 |
| 794 return true; | 796 return true; |
| 795 } | 797 } |
| 796 | 798 |
| 799 rtc::DiffServCodePoint WebRtcVideoChannel2::DscpValue() const { |
| 800 return rtc::DSCP_AF41; |
| 801 } |
| 802 |
| 797 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { | 803 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { |
| 798 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); | 804 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); |
| 799 LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); | 805 LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); |
| 800 ChangedSendParameters changed_params; | 806 ChangedSendParameters changed_params; |
| 801 if (!GetChangedSendParameters(params, &changed_params)) { | 807 if (!GetChangedSendParameters(params, &changed_params)) { |
| 802 return false; | 808 return false; |
| 803 } | 809 } |
| 804 | 810 |
| 805 bool bitrate_config_changed = false; | 811 bool bitrate_config_changed = false; |
| 806 | 812 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 845 } |
| 840 | 846 |
| 841 if (changed_params.options) { | 847 if (changed_params.options) { |
| 842 options_.SetAll(*changed_params.options); | 848 options_.SetAll(*changed_params.options); |
| 843 { | 849 { |
| 844 rtc::CritScope lock(&capturer_crit_); | 850 rtc::CritScope lock(&capturer_crit_); |
| 845 if (options_.cpu_overuse_detection) { | 851 if (options_.cpu_overuse_detection) { |
| 846 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; | 852 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; |
| 847 } | 853 } |
| 848 } | 854 } |
| 849 rtc::DiffServCodePoint dscp = | |
| 850 options_.dscp.value_or(false) ? rtc::DSCP_AF41 : rtc::DSCP_DEFAULT; | |
| 851 MediaChannel::SetDscp(dscp); | |
| 852 } | 855 } |
| 853 | 856 |
| 854 { | 857 { |
| 855 rtc::CritScope stream_lock(&stream_crit_); | 858 rtc::CritScope stream_lock(&stream_crit_); |
| 856 for (auto& kv : send_streams_) { | 859 for (auto& kv : send_streams_) { |
| 857 kv.second->SetSendParameters(changed_params); | 860 kv.second->SetSendParameters(changed_params); |
| 858 } | 861 } |
| 859 if (changed_params.codec) { | 862 if (changed_params.codec) { |
| 860 // Update receive feedback parameters from new codec. | 863 // Update receive feedback parameters from new codec. |
| 861 LOG(LS_INFO) | 864 LOG(LS_INFO) |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2608 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2606 } | 2609 } |
| 2607 } | 2610 } |
| 2608 | 2611 |
| 2609 return video_codecs; | 2612 return video_codecs; |
| 2610 } | 2613 } |
| 2611 | 2614 |
| 2612 } // namespace cricket | 2615 } // namespace cricket |
| 2613 | 2616 |
| 2614 #endif // HAVE_WEBRTC_VIDEO | 2617 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |