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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 595 } |
596 | 596 |
597 return true; | 597 return true; |
598 } | 598 } |
599 | 599 |
600 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( | 600 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( |
601 webrtc::Call* call, | 601 webrtc::Call* call, |
602 const VideoOptions& options) { | 602 const VideoOptions& options) { |
603 RTC_DCHECK(initialized_); | 603 RTC_DCHECK(initialized_); |
604 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); | 604 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); |
605 WebRtcVideoChannel2* channel = new WebRtcVideoChannel2(call, options, | 605 return new WebRtcVideoChannel2(call, options, video_codecs_, |
606 external_encoder_factory_, external_decoder_factory_); | 606 external_encoder_factory_, external_decoder_factory_); |
607 channel->SetRecvCodecs(video_codecs_); | |
608 return channel; | |
609 } | 607 } |
610 | 608 |
611 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { | 609 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { |
612 return video_codecs_; | 610 return video_codecs_; |
613 } | 611 } |
614 | 612 |
615 const std::vector<RtpHeaderExtension>& | 613 const std::vector<RtpHeaderExtension>& |
616 WebRtcVideoEngine2::rtp_header_extensions() const { | 614 WebRtcVideoEngine2::rtp_header_extensions() const { |
617 return rtp_header_extensions_; | 615 return rtp_header_extensions_; |
618 } | 616 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 755 |
758 AddDefaultFeedbackParams(&codec); | 756 AddDefaultFeedbackParams(&codec); |
759 supported_codecs.push_back(codec); | 757 supported_codecs.push_back(codec); |
760 } | 758 } |
761 return supported_codecs; | 759 return supported_codecs; |
762 } | 760 } |
763 | 761 |
764 WebRtcVideoChannel2::WebRtcVideoChannel2( | 762 WebRtcVideoChannel2::WebRtcVideoChannel2( |
765 webrtc::Call* call, | 763 webrtc::Call* call, |
766 const VideoOptions& options, | 764 const VideoOptions& options, |
| 765 const std::vector<VideoCodec>& recv_codecs, |
767 WebRtcVideoEncoderFactory* external_encoder_factory, | 766 WebRtcVideoEncoderFactory* external_encoder_factory, |
768 WebRtcVideoDecoderFactory* external_decoder_factory) | 767 WebRtcVideoDecoderFactory* external_decoder_factory) |
769 : call_(call), | 768 : call_(call), |
770 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), | 769 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), |
771 external_encoder_factory_(external_encoder_factory), | 770 external_encoder_factory_(external_encoder_factory), |
772 external_decoder_factory_(external_decoder_factory) { | 771 external_decoder_factory_(external_decoder_factory) { |
773 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 772 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
774 SetDefaultOptions(); | 773 SetDefaultOptions(); |
775 options_.SetAll(options); | 774 options_.SetAll(options); |
776 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); | 775 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); |
777 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; | 776 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; |
778 sending_ = false; | 777 sending_ = false; |
779 default_send_ssrc_ = 0; | 778 default_send_ssrc_ = 0; |
| 779 SetRecvCodecs(recv_codecs); |
780 } | 780 } |
781 | 781 |
782 void WebRtcVideoChannel2::SetDefaultOptions() { | 782 void WebRtcVideoChannel2::SetDefaultOptions() { |
783 options_.cpu_overuse_detection.Set(true); | 783 options_.cpu_overuse_detection.Set(true); |
784 options_.dscp.Set(false); | 784 options_.dscp.Set(false); |
785 options_.suspend_below_min_bitrate.Set(false); | 785 options_.suspend_below_min_bitrate.Set(false); |
786 options_.video_noise_reduction.Set(true); | 786 options_.video_noise_reduction.Set(true); |
787 options_.screencast_min_bitrate.Set(0); | 787 options_.screencast_min_bitrate.Set(0); |
788 } | 788 } |
789 | 789 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 // raise bitrates above the 2000k default bitrate cap. | 1567 // raise bitrates above the 2000k default bitrate cap. |
1568 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { | 1568 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { |
1569 // TODO(pbos): Figure out whether b=AS means max bitrate for this | 1569 // TODO(pbos): Figure out whether b=AS means max bitrate for this |
1570 // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), in | 1570 // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), in |
1571 // which case this should not set a Call::BitrateConfig but rather reconfigure | 1571 // which case this should not set a Call::BitrateConfig but rather reconfigure |
1572 // all senders. | 1572 // all senders. |
1573 LOG(LS_INFO) << "SetMaxSendBandwidth: " << max_bitrate_bps << "bps."; | 1573 LOG(LS_INFO) << "SetMaxSendBandwidth: " << max_bitrate_bps << "bps."; |
1574 if (max_bitrate_bps == bitrate_config_.max_bitrate_bps) | 1574 if (max_bitrate_bps == bitrate_config_.max_bitrate_bps) |
1575 return true; | 1575 return true; |
1576 | 1576 |
1577 if (max_bitrate_bps <= 0) { | 1577 if (max_bitrate_bps < 0) { |
| 1578 // Option not set. |
| 1579 return true; |
| 1580 } |
| 1581 if (max_bitrate_bps == 0) { |
1578 // Unsetting max bitrate. | 1582 // Unsetting max bitrate. |
1579 max_bitrate_bps = -1; | 1583 max_bitrate_bps = -1; |
1580 } | 1584 } |
1581 bitrate_config_.start_bitrate_bps = -1; | 1585 bitrate_config_.start_bitrate_bps = -1; |
1582 bitrate_config_.max_bitrate_bps = max_bitrate_bps; | 1586 bitrate_config_.max_bitrate_bps = max_bitrate_bps; |
1583 if (max_bitrate_bps > 0 && | 1587 if (max_bitrate_bps > 0 && |
1584 bitrate_config_.min_bitrate_bps > max_bitrate_bps) { | 1588 bitrate_config_.min_bitrate_bps > max_bitrate_bps) { |
1585 bitrate_config_.min_bitrate_bps = max_bitrate_bps; | 1589 bitrate_config_.min_bitrate_bps = max_bitrate_bps; |
1586 } | 1590 } |
1587 call_->SetBitrateConfig(bitrate_config_); | 1591 call_->SetBitrateConfig(bitrate_config_); |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2745 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2742 } | 2746 } |
2743 } | 2747 } |
2744 | 2748 |
2745 return video_codecs; | 2749 return video_codecs; |
2746 } | 2750 } |
2747 | 2751 |
2748 } // namespace cricket | 2752 } // namespace cricket |
2749 | 2753 |
2750 #endif // HAVE_WEBRTC_VIDEO | 2754 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |