| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 ret << error << " " << desc; | 434 ret << error << " " << desc; |
| 435 return ret.str(); | 435 return ret.str(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 static std::string MakeTdErrorString(const std::string& desc) { | 438 static std::string MakeTdErrorString(const std::string& desc) { |
| 439 return MakeErrorString(kPushDownTDFailed, desc); | 439 return MakeErrorString(kPushDownTDFailed, desc); |
| 440 } | 440 } |
| 441 | 441 |
| 442 // Set |option| to the highest-priority value of |key| in the optional | 442 // Set |option| to the highest-priority value of |key| in the optional |
| 443 // constraints if the key is found and has a valid value. | 443 // constraints if the key is found and has a valid value. |
| 444 template<typename T> | 444 template <typename T> |
| 445 static void SetOptionFromOptionalConstraint( | 445 static void SetOptionFromOptionalConstraint( |
| 446 const MediaConstraintsInterface* constraints, | 446 const MediaConstraintsInterface* constraints, |
| 447 const std::string& key, cricket::Settable<T>* option) { | 447 const std::string& key, |
| 448 rtc::Maybe<T>* option) { |
| 448 if (!constraints) { | 449 if (!constraints) { |
| 449 return; | 450 return; |
| 450 } | 451 } |
| 451 std::string string_value; | 452 std::string string_value; |
| 452 T value; | 453 T value; |
| 453 if (constraints->GetOptional().FindFirst(key, &string_value)) { | 454 if (constraints->GetOptional().FindFirst(key, &string_value)) { |
| 454 if (rtc::FromString(string_value, &value)) { | 455 if (rtc::FromString(string_value, &value)) { |
| 455 option->Set(value); | 456 *option = rtc::Maybe<T>(value); |
| 456 } | 457 } |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 | 460 |
| 460 uint32_t ConvertIceTransportTypeToCandidateFilter( | 461 uint32_t ConvertIceTransportTypeToCandidateFilter( |
| 461 PeerConnectionInterface::IceTransportsType type) { | 462 PeerConnectionInterface::IceTransportsType type) { |
| 462 switch (type) { | 463 switch (type) { |
| 463 case PeerConnectionInterface::kNone: | 464 case PeerConnectionInterface::kNone: |
| 464 return cricket::CF_NONE; | 465 return cricket::CF_NONE; |
| 465 case PeerConnectionInterface::kRelay: | 466 case PeerConnectionInterface::kRelay: |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 LOG(LS_INFO) << "Allowing SCTP data engine."; | 638 LOG(LS_INFO) << "Allowing SCTP data engine."; |
| 638 data_channel_type_ = cricket::DCT_SCTP; | 639 data_channel_type_ = cricket::DCT_SCTP; |
| 639 } | 640 } |
| 640 } | 641 } |
| 641 | 642 |
| 642 // Find DSCP constraint. | 643 // Find DSCP constraint. |
| 643 if (FindConstraint( | 644 if (FindConstraint( |
| 644 constraints, | 645 constraints, |
| 645 MediaConstraintsInterface::kEnableDscp, | 646 MediaConstraintsInterface::kEnableDscp, |
| 646 &value, NULL)) { | 647 &value, NULL)) { |
| 647 audio_options_.dscp.Set(value); | 648 audio_options_.dscp = rtc::Maybe<bool>(value); |
| 648 video_options_.dscp.Set(value); | 649 video_options_.dscp = rtc::Maybe<bool>(value); |
| 649 } | 650 } |
| 650 | 651 |
| 651 // Find Suspend Below Min Bitrate constraint. | 652 // Find Suspend Below Min Bitrate constraint. |
| 652 if (FindConstraint( | 653 if (FindConstraint( |
| 653 constraints, | 654 constraints, |
| 654 MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, | 655 MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, |
| 655 &value, | 656 &value, |
| 656 NULL)) { | 657 NULL)) { |
| 657 video_options_.suspend_below_min_bitrate.Set(value); | 658 video_options_.suspend_below_min_bitrate = rtc::Maybe<bool>(value); |
| 658 } | 659 } |
| 659 | 660 |
| 660 SetOptionFromOptionalConstraint(constraints, | 661 SetOptionFromOptionalConstraint(constraints, |
| 661 MediaConstraintsInterface::kScreencastMinBitrate, | 662 MediaConstraintsInterface::kScreencastMinBitrate, |
| 662 &video_options_.screencast_min_bitrate); | 663 &video_options_.screencast_min_bitrate); |
| 663 | 664 |
| 664 // Find constraints for cpu overuse detection. | 665 // Find constraints for cpu overuse detection. |
| 665 SetOptionFromOptionalConstraint(constraints, | 666 SetOptionFromOptionalConstraint(constraints, |
| 666 MediaConstraintsInterface::kCpuUnderuseThreshold, | 667 MediaConstraintsInterface::kCpuUnderuseThreshold, |
| 667 &video_options_.cpu_underuse_threshold); | 668 &video_options_.cpu_underuse_threshold); |
| 668 SetOptionFromOptionalConstraint(constraints, | 669 SetOptionFromOptionalConstraint(constraints, |
| 669 MediaConstraintsInterface::kCpuOveruseThreshold, | 670 MediaConstraintsInterface::kCpuOveruseThreshold, |
| 670 &video_options_.cpu_overuse_threshold); | 671 &video_options_.cpu_overuse_threshold); |
| 671 SetOptionFromOptionalConstraint(constraints, | 672 SetOptionFromOptionalConstraint(constraints, |
| 672 MediaConstraintsInterface::kCpuOveruseDetection, | 673 MediaConstraintsInterface::kCpuOveruseDetection, |
| 673 &video_options_.cpu_overuse_detection); | 674 &video_options_.cpu_overuse_detection); |
| 674 SetOptionFromOptionalConstraint(constraints, | 675 SetOptionFromOptionalConstraint(constraints, |
| 675 MediaConstraintsInterface::kCpuOveruseEncodeUsage, | 676 MediaConstraintsInterface::kCpuOveruseEncodeUsage, |
| 676 &video_options_.cpu_overuse_encode_usage); | 677 &video_options_.cpu_overuse_encode_usage); |
| 677 SetOptionFromOptionalConstraint(constraints, | 678 SetOptionFromOptionalConstraint(constraints, |
| 678 MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold, | 679 MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold, |
| 679 &video_options_.cpu_underuse_encode_rsd_threshold); | 680 &video_options_.cpu_underuse_encode_rsd_threshold); |
| 680 SetOptionFromOptionalConstraint(constraints, | 681 SetOptionFromOptionalConstraint(constraints, |
| 681 MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold, | 682 MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold, |
| 682 &video_options_.cpu_overuse_encode_rsd_threshold); | 683 &video_options_.cpu_overuse_encode_rsd_threshold); |
| 683 | 684 |
| 684 SetOptionFromOptionalConstraint(constraints, | 685 SetOptionFromOptionalConstraint(constraints, |
| 685 MediaConstraintsInterface::kNumUnsignalledRecvStreams, | 686 MediaConstraintsInterface::kNumUnsignalledRecvStreams, |
| 686 &video_options_.unsignalled_recv_stream_limit); | 687 &video_options_.unsignalled_recv_stream_limit); |
| 687 if (video_options_.unsignalled_recv_stream_limit.IsSet()) { | 688 if (video_options_.unsignalled_recv_stream_limit) { |
| 688 int stream_limit; | 689 video_options_.unsignalled_recv_stream_limit = rtc::Maybe<int>( |
| 689 video_options_.unsignalled_recv_stream_limit.Get(&stream_limit); | 690 std::max(0, std::min(kMaxUnsignalledRecvStreams, |
| 690 stream_limit = std::min(kMaxUnsignalledRecvStreams, stream_limit); | 691 *video_options_.unsignalled_recv_stream_limit))); |
| 691 stream_limit = std::max(0, stream_limit); | |
| 692 video_options_.unsignalled_recv_stream_limit.Set(stream_limit); | |
| 693 } | 692 } |
| 694 | 693 |
| 695 SetOptionFromOptionalConstraint(constraints, | 694 SetOptionFromOptionalConstraint(constraints, |
| 696 MediaConstraintsInterface::kHighStartBitrate, | 695 MediaConstraintsInterface::kHighStartBitrate, |
| 697 &video_options_.video_start_bitrate); | 696 &video_options_.video_start_bitrate); |
| 698 | 697 |
| 699 SetOptionFromOptionalConstraint(constraints, | 698 SetOptionFromOptionalConstraint(constraints, |
| 700 MediaConstraintsInterface::kCombinedAudioVideoBwe, | 699 MediaConstraintsInterface::kCombinedAudioVideoBwe, |
| 701 &audio_options_.combined_audio_video_bwe); | 700 &audio_options_.combined_audio_video_bwe); |
| 702 | 701 |
| 703 audio_options_.audio_jitter_buffer_max_packets.Set( | 702 audio_options_.audio_jitter_buffer_max_packets = |
| 704 rtc_configuration.audio_jitter_buffer_max_packets); | 703 rtc::Maybe<int>(rtc_configuration.audio_jitter_buffer_max_packets); |
| 705 | 704 |
| 706 audio_options_.audio_jitter_buffer_fast_accelerate.Set( | 705 audio_options_.audio_jitter_buffer_fast_accelerate = |
| 707 rtc_configuration.audio_jitter_buffer_fast_accelerate); | 706 rtc::Maybe<bool>(rtc_configuration.audio_jitter_buffer_fast_accelerate); |
| 708 | 707 |
| 709 const cricket::VideoCodec default_codec( | 708 const cricket::VideoCodec default_codec( |
| 710 JsepSessionDescription::kDefaultVideoCodecId, | 709 JsepSessionDescription::kDefaultVideoCodecId, |
| 711 JsepSessionDescription::kDefaultVideoCodecName, | 710 JsepSessionDescription::kDefaultVideoCodecName, |
| 712 JsepSessionDescription::kMaxVideoCodecWidth, | 711 JsepSessionDescription::kMaxVideoCodecWidth, |
| 713 JsepSessionDescription::kMaxVideoCodecHeight, | 712 JsepSessionDescription::kMaxVideoCodecHeight, |
| 714 JsepSessionDescription::kDefaultVideoCodecFramerate, | 713 JsepSessionDescription::kDefaultVideoCodecFramerate, |
| 715 JsepSessionDescription::kDefaultVideoCodecPreference); | 714 JsepSessionDescription::kDefaultVideoCodecPreference); |
| 716 channel_manager_->SetDefaultVideoEncoderConfig( | 715 channel_manager_->SetDefaultVideoEncoderConfig( |
| 717 cricket::VideoEncoderConfig(default_codec)); | 716 cricket::VideoEncoderConfig(default_codec)); |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 } | 2194 } |
| 2196 } | 2195 } |
| 2197 | 2196 |
| 2198 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2197 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
| 2199 const rtc::SentPacket& sent_packet) { | 2198 const rtc::SentPacket& sent_packet) { |
| 2200 RTC_DCHECK(worker_thread()->IsCurrent()); | 2199 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2201 media_controller_->call_w()->OnSentPacket(sent_packet); | 2200 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2202 } | 2201 } |
| 2203 | 2202 |
| 2204 } // namespace webrtc | 2203 } // namespace webrtc |
| OLD | NEW |