| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2"; | 519 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2"; |
| 520 } | 520 } |
| 521 | 521 |
| 522 void WebRtcVideoEngine2::Init() { | 522 void WebRtcVideoEngine2::Init() { |
| 523 LOG(LS_INFO) << "WebRtcVideoEngine2::Init"; | 523 LOG(LS_INFO) << "WebRtcVideoEngine2::Init"; |
| 524 initialized_ = true; | 524 initialized_ = true; |
| 525 } | 525 } |
| 526 | 526 |
| 527 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( | 527 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( |
| 528 webrtc::Call* call, | 528 webrtc::Call* call, |
| 529 const VideoOptions& options) { | 529 const MediaChannelOptions& options, |
| 530 const VideoOptions& video_options) { |
| 530 RTC_DCHECK(initialized_); | 531 RTC_DCHECK(initialized_); |
| 531 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); | 532 LOG(LS_INFO) << "CreateChannel. Options: " << video_options.ToString(); |
| 532 return new WebRtcVideoChannel2(call, options, video_codecs_, | 533 return new WebRtcVideoChannel2(call, options, video_options, video_codecs_, |
| 533 external_encoder_factory_, external_decoder_factory_); | 534 external_encoder_factory_, |
| 535 external_decoder_factory_); |
| 534 } | 536 } |
| 535 | 537 |
| 536 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { | 538 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { |
| 537 return video_codecs_; | 539 return video_codecs_; |
| 538 } | 540 } |
| 539 | 541 |
| 540 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const { | 542 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const { |
| 541 RtpCapabilities capabilities; | 543 RtpCapabilities capabilities; |
| 542 capabilities.header_extensions.push_back( | 544 capabilities.header_extensions.push_back( |
| 543 RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, | 545 RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 0); | 614 0); |
| 613 | 615 |
| 614 AddDefaultFeedbackParams(&codec); | 616 AddDefaultFeedbackParams(&codec); |
| 615 supported_codecs.push_back(codec); | 617 supported_codecs.push_back(codec); |
| 616 } | 618 } |
| 617 return supported_codecs; | 619 return supported_codecs; |
| 618 } | 620 } |
| 619 | 621 |
| 620 WebRtcVideoChannel2::WebRtcVideoChannel2( | 622 WebRtcVideoChannel2::WebRtcVideoChannel2( |
| 621 webrtc::Call* call, | 623 webrtc::Call* call, |
| 622 const VideoOptions& options, | 624 const MediaChannelOptions& options, |
| 625 const VideoOptions& video_options, |
| 623 const std::vector<VideoCodec>& recv_codecs, | 626 const std::vector<VideoCodec>& recv_codecs, |
| 624 WebRtcVideoEncoderFactory* external_encoder_factory, | 627 WebRtcVideoEncoderFactory* external_encoder_factory, |
| 625 WebRtcVideoDecoderFactory* external_decoder_factory) | 628 WebRtcVideoDecoderFactory* external_decoder_factory) |
| 626 : call_(call), | 629 : VideoMediaChannel(options), |
| 630 call_(call), |
| 627 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), | 631 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), |
| 628 external_encoder_factory_(external_encoder_factory), | 632 external_encoder_factory_(external_encoder_factory), |
| 629 external_decoder_factory_(external_decoder_factory) { | 633 external_decoder_factory_(external_decoder_factory) { |
| 630 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 634 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 631 SetDefaultOptions(); | 635 SetDefaultOptions(); |
| 632 options_.SetAll(options); | 636 options_.SetAll(video_options); |
| 633 if (options_.cpu_overuse_detection) | 637 if (options_.cpu_overuse_detection) |
| 634 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; | 638 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; |
| 635 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; | 639 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; |
| 636 sending_ = false; | 640 sending_ = false; |
| 637 default_send_ssrc_ = 0; | 641 default_send_ssrc_ = 0; |
| 638 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); | 642 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); |
| 639 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); | 643 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); |
| 640 } | 644 } |
| 641 | 645 |
| 642 void WebRtcVideoChannel2::SetDefaultOptions() { | 646 void WebRtcVideoChannel2::SetDefaultOptions() { |
| 643 options_.cpu_overuse_detection = rtc::Optional<bool>(true); | 647 options_.cpu_overuse_detection = rtc::Optional<bool>(true); |
| 644 options_.dscp = rtc::Optional<bool>(false); | |
| 645 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false); | 648 options_.suspend_below_min_bitrate = rtc::Optional<bool>(false); |
| 646 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0); | 649 options_.screencast_min_bitrate_kbps = rtc::Optional<int>(0); |
| 647 } | 650 } |
| 648 | 651 |
| 649 WebRtcVideoChannel2::~WebRtcVideoChannel2() { | 652 WebRtcVideoChannel2::~WebRtcVideoChannel2() { |
| 650 for (auto& kv : send_streams_) | 653 for (auto& kv : send_streams_) |
| 651 delete kv.second; | 654 delete kv.second; |
| 652 for (auto& kv : receive_streams_) | 655 for (auto& kv : receive_streams_) |
| 653 delete kv.second; | 656 delete kv.second; |
| 654 } | 657 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // Handle RTCP mode. | 770 // Handle RTCP mode. |
| 768 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { | 771 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { |
| 769 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( | 772 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( |
| 770 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize | 773 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize |
| 771 : webrtc::RtcpMode::kCompound); | 774 : webrtc::RtcpMode::kCompound); |
| 772 } | 775 } |
| 773 | 776 |
| 774 return true; | 777 return true; |
| 775 } | 778 } |
| 776 | 779 |
| 780 rtc::DiffServCodePoint WebRtcVideoChannel2::MediaTypeDscpValue() const { |
| 781 return rtc::DSCP_AF41; |
| 782 } |
| 783 |
| 777 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { | 784 bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { |
| 778 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); | 785 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendParameters"); |
| 779 LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); | 786 LOG(LS_INFO) << "SetSendParameters: " << params.ToString(); |
| 780 ChangedSendParameters changed_params; | 787 ChangedSendParameters changed_params; |
| 781 if (!GetChangedSendParameters(params, &changed_params)) { | 788 if (!GetChangedSendParameters(params, &changed_params)) { |
| 782 return false; | 789 return false; |
| 783 } | 790 } |
| 784 | 791 |
| 785 bool bitrate_config_changed = false; | 792 bool bitrate_config_changed = false; |
| 786 | 793 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 826 } |
| 820 | 827 |
| 821 if (changed_params.options) { | 828 if (changed_params.options) { |
| 822 options_.SetAll(*changed_params.options); | 829 options_.SetAll(*changed_params.options); |
| 823 { | 830 { |
| 824 rtc::CritScope lock(&capturer_crit_); | 831 rtc::CritScope lock(&capturer_crit_); |
| 825 if (options_.cpu_overuse_detection) { | 832 if (options_.cpu_overuse_detection) { |
| 826 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; | 833 signal_cpu_adaptation_ = *options_.cpu_overuse_detection; |
| 827 } | 834 } |
| 828 } | 835 } |
| 829 rtc::DiffServCodePoint dscp = | |
| 830 options_.dscp.value_or(false) ? rtc::DSCP_AF41 : rtc::DSCP_DEFAULT; | |
| 831 MediaChannel::SetDscp(dscp); | |
| 832 } | 836 } |
| 833 | 837 |
| 834 { | 838 { |
| 835 rtc::CritScope stream_lock(&stream_crit_); | 839 rtc::CritScope stream_lock(&stream_crit_); |
| 836 for (auto& kv : send_streams_) { | 840 for (auto& kv : send_streams_) { |
| 837 kv.second->SetSendParameters(changed_params); | 841 kv.second->SetSendParameters(changed_params); |
| 838 } | 842 } |
| 839 if (changed_params.codec) { | 843 if (changed_params.codec) { |
| 840 // Update receive feedback parameters from new codec. | 844 // Update receive feedback parameters from new codec. |
| 841 LOG(LS_INFO) | 845 LOG(LS_INFO) |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2527 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2531 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2528 } | 2532 } |
| 2529 } | 2533 } |
| 2530 | 2534 |
| 2531 return video_codecs; | 2535 return video_codecs; |
| 2532 } | 2536 } |
| 2533 | 2537 |
| 2534 } // namespace cricket | 2538 } // namespace cricket |
| 2535 | 2539 |
| 2536 #endif // HAVE_WEBRTC_VIDEO | 2540 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |