| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 WebRtcVideoDecoderFactory* external_decoder_factory) | 775 WebRtcVideoDecoderFactory* external_decoder_factory) |
| 776 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), | 776 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), |
| 777 voice_channel_(voice_channel), | 777 voice_channel_(voice_channel), |
| 778 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1), | 778 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1), |
| 779 external_encoder_factory_(external_encoder_factory), | 779 external_encoder_factory_(external_encoder_factory), |
| 780 external_decoder_factory_(external_decoder_factory) { | 780 external_decoder_factory_(external_decoder_factory) { |
| 781 DCHECK(thread_checker_.CalledOnValidThread()); | 781 DCHECK(thread_checker_.CalledOnValidThread()); |
| 782 SetDefaultOptions(); | 782 SetDefaultOptions(); |
| 783 options_.SetAll(options); | 783 options_.SetAll(options); |
| 784 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); | 784 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); |
| 785 webrtc::Call::Config config(this); | 785 webrtc::Call::Config config; |
| 786 config.overuse_callback = this; | 786 config.overuse_callback = this; |
| 787 if (voice_engine != NULL) { | 787 if (voice_engine != NULL) { |
| 788 config.voice_engine = voice_engine->voe()->engine(); | 788 config.voice_engine = voice_engine->voe()->engine(); |
| 789 } | 789 } |
| 790 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 790 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
| 791 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 791 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
| 792 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 792 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
| 793 call_.reset(call_factory->CreateCall(config)); | 793 call_.reset(call_factory->CreateCall(config)); |
| 794 if (voice_channel_) { | 794 if (voice_channel_) { |
| 795 voice_channel_->SetCall(call_.get()); | 795 voice_channel_->SetCall(call_.get()); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 rtc::CritScope stream_lock(&stream_crit_); | 1106 rtc::CritScope stream_lock(&stream_crit_); |
| 1107 | 1107 |
| 1108 if (!ValidateSendSsrcAvailability(sp)) | 1108 if (!ValidateSendSsrcAvailability(sp)) |
| 1109 return false; | 1109 return false; |
| 1110 | 1110 |
| 1111 for (uint32 used_ssrc : sp.ssrcs) | 1111 for (uint32 used_ssrc : sp.ssrcs) |
| 1112 send_ssrcs_.insert(used_ssrc); | 1112 send_ssrcs_.insert(used_ssrc); |
| 1113 | 1113 |
| 1114 WebRtcVideoSendStream* stream = | 1114 WebRtcVideoSendStream* stream = |
| 1115 new WebRtcVideoSendStream(call_.get(), | 1115 new WebRtcVideoSendStream(call_.get(), |
| 1116 sp, |
| 1117 webrtc::VideoSendStream::Config(this), |
| 1116 external_encoder_factory_, | 1118 external_encoder_factory_, |
| 1117 options_, | 1119 options_, |
| 1118 bitrate_config_.max_bitrate_bps, | 1120 bitrate_config_.max_bitrate_bps, |
| 1119 send_codec_, | 1121 send_codec_, |
| 1120 sp, | |
| 1121 send_rtp_extensions_); | 1122 send_rtp_extensions_); |
| 1122 | 1123 |
| 1123 uint32 ssrc = sp.first_ssrc(); | 1124 uint32 ssrc = sp.first_ssrc(); |
| 1124 DCHECK(ssrc != 0); | 1125 DCHECK(ssrc != 0); |
| 1125 send_streams_[ssrc] = stream; | 1126 send_streams_[ssrc] = stream; |
| 1126 | 1127 |
| 1127 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1128 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
| 1128 rtcp_receiver_report_ssrc_ = ssrc; | 1129 rtcp_receiver_report_ssrc_ = ssrc; |
| 1129 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1130 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
| 1130 "a send stream."; | 1131 "a send stream."; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 DeleteReceiveStream(prev_stream->second); | 1215 DeleteReceiveStream(prev_stream->second); |
| 1215 receive_streams_.erase(prev_stream); | 1216 receive_streams_.erase(prev_stream); |
| 1216 } | 1217 } |
| 1217 | 1218 |
| 1218 if (!ValidateReceiveSsrcAvailability(sp)) | 1219 if (!ValidateReceiveSsrcAvailability(sp)) |
| 1219 return false; | 1220 return false; |
| 1220 | 1221 |
| 1221 for (uint32 used_ssrc : sp.ssrcs) | 1222 for (uint32 used_ssrc : sp.ssrcs) |
| 1222 receive_ssrcs_.insert(used_ssrc); | 1223 receive_ssrcs_.insert(used_ssrc); |
| 1223 | 1224 |
| 1224 webrtc::VideoReceiveStream::Config config; | 1225 webrtc::VideoReceiveStream::Config config(this); |
| 1225 ConfigureReceiverRtp(&config, sp); | 1226 ConfigureReceiverRtp(&config, sp); |
| 1226 | 1227 |
| 1227 // Set up A/V sync group based on sync label. | 1228 // Set up A/V sync group based on sync label. |
| 1228 config.sync_group = sp.sync_label; | 1229 config.sync_group = sp.sync_label; |
| 1229 | 1230 |
| 1230 config.rtp.remb = false; | 1231 config.rtp.remb = false; |
| 1231 VideoCodecSettings send_codec; | 1232 VideoCodecSettings send_codec; |
| 1232 if (send_codec_.Get(&send_codec)) { | 1233 if (send_codec_.Get(&send_codec)) { |
| 1233 config.rtp.remb = HasRemb(send_codec.codec); | 1234 config.rtp.remb = HasRemb(send_codec.codec); |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1236 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( | 1237 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( |
| 1237 call_.get(), sp, external_decoder_factory_, default_stream, config, | 1238 call_.get(), sp, config, external_decoder_factory_, default_stream, |
| 1238 recv_codecs_); | 1239 recv_codecs_); |
| 1239 | 1240 |
| 1240 return true; | 1241 return true; |
| 1241 } | 1242 } |
| 1242 | 1243 |
| 1243 void WebRtcVideoChannel2::ConfigureReceiverRtp( | 1244 void WebRtcVideoChannel2::ConfigureReceiverRtp( |
| 1244 webrtc::VideoReceiveStream::Config* config, | 1245 webrtc::VideoReceiveStream::Config* config, |
| 1245 const StreamParams& sp) const { | 1246 const StreamParams& sp) const { |
| 1246 uint32 ssrc = sp.first_ssrc(); | 1247 uint32 ssrc = sp.first_ssrc(); |
| 1247 | 1248 |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 external(external) { | 1720 external(external) { |
| 1720 if (external) { | 1721 if (external) { |
| 1721 external_encoder = encoder; | 1722 external_encoder = encoder; |
| 1722 this->encoder = | 1723 this->encoder = |
| 1723 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); | 1724 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); |
| 1724 } | 1725 } |
| 1725 } | 1726 } |
| 1726 | 1727 |
| 1727 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( | 1728 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( |
| 1728 webrtc::Call* call, | 1729 webrtc::Call* call, |
| 1730 const StreamParams& sp, |
| 1731 const webrtc::VideoSendStream::Config& config, |
| 1729 WebRtcVideoEncoderFactory* external_encoder_factory, | 1732 WebRtcVideoEncoderFactory* external_encoder_factory, |
| 1730 const VideoOptions& options, | 1733 const VideoOptions& options, |
| 1731 int max_bitrate_bps, | 1734 int max_bitrate_bps, |
| 1732 const Settable<VideoCodecSettings>& codec_settings, | 1735 const Settable<VideoCodecSettings>& codec_settings, |
| 1733 const StreamParams& sp, | |
| 1734 const std::vector<webrtc::RtpExtension>& rtp_extensions) | 1736 const std::vector<webrtc::RtpExtension>& rtp_extensions) |
| 1735 : ssrcs_(sp.ssrcs), | 1737 : ssrcs_(sp.ssrcs), |
| 1736 ssrc_groups_(sp.ssrc_groups), | 1738 ssrc_groups_(sp.ssrc_groups), |
| 1737 call_(call), | 1739 call_(call), |
| 1738 external_encoder_factory_(external_encoder_factory), | 1740 external_encoder_factory_(external_encoder_factory), |
| 1739 stream_(NULL), | 1741 stream_(NULL), |
| 1740 parameters_(webrtc::VideoSendStream::Config(), | 1742 parameters_(config, options, max_bitrate_bps, codec_settings), |
| 1741 options, | |
| 1742 max_bitrate_bps, | |
| 1743 codec_settings), | |
| 1744 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), | 1743 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), |
| 1745 capturer_(NULL), | 1744 capturer_(NULL), |
| 1746 sending_(false), | 1745 sending_(false), |
| 1747 muted_(false), | 1746 muted_(false), |
| 1748 old_adapt_changes_(0), | 1747 old_adapt_changes_(0), |
| 1749 first_frame_timestamp_ms_(0), | 1748 first_frame_timestamp_ms_(0), |
| 1750 last_frame_timestamp_ms_(0) { | 1749 last_frame_timestamp_ms_(0) { |
| 1751 parameters_.config.rtp.max_packet_size = kVideoMtu; | 1750 parameters_.config.rtp.max_packet_size = kVideoMtu; |
| 1752 | 1751 |
| 1753 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); | 1752 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 parameters_.encoder_config.encoder_specific_settings = NULL; | 2313 parameters_.encoder_config.encoder_specific_settings = NULL; |
| 2315 | 2314 |
| 2316 if (sending_) { | 2315 if (sending_) { |
| 2317 stream_->Start(); | 2316 stream_->Start(); |
| 2318 } | 2317 } |
| 2319 } | 2318 } |
| 2320 | 2319 |
| 2321 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( | 2320 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( |
| 2322 webrtc::Call* call, | 2321 webrtc::Call* call, |
| 2323 const StreamParams& sp, | 2322 const StreamParams& sp, |
| 2323 const webrtc::VideoReceiveStream::Config& config, |
| 2324 WebRtcVideoDecoderFactory* external_decoder_factory, | 2324 WebRtcVideoDecoderFactory* external_decoder_factory, |
| 2325 bool default_stream, | 2325 bool default_stream, |
| 2326 const webrtc::VideoReceiveStream::Config& config, | |
| 2327 const std::vector<VideoCodecSettings>& recv_codecs) | 2326 const std::vector<VideoCodecSettings>& recv_codecs) |
| 2328 : call_(call), | 2327 : call_(call), |
| 2329 ssrcs_(sp.ssrcs), | 2328 ssrcs_(sp.ssrcs), |
| 2330 ssrc_groups_(sp.ssrc_groups), | 2329 ssrc_groups_(sp.ssrc_groups), |
| 2331 stream_(NULL), | 2330 stream_(NULL), |
| 2332 default_stream_(default_stream), | 2331 default_stream_(default_stream), |
| 2333 config_(config), | 2332 config_(config), |
| 2334 external_decoder_factory_(external_decoder_factory), | 2333 external_decoder_factory_(external_decoder_factory), |
| 2335 renderer_(NULL), | 2334 renderer_(NULL), |
| 2336 last_width_(-1), | 2335 last_width_(-1), |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2717 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2719 } | 2718 } |
| 2720 } | 2719 } |
| 2721 | 2720 |
| 2722 return video_codecs; | 2721 return video_codecs; |
| 2723 } | 2722 } |
| 2724 | 2723 |
| 2725 } // namespace cricket | 2724 } // namespace cricket |
| 2726 | 2725 |
| 2727 #endif // HAVE_WEBRTC_VIDEO | 2726 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |