Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 call_(call), | 612 call_(call), |
| 613 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), | 613 unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), |
| 614 video_config_(config.video), | 614 video_config_(config.video), |
| 615 external_encoder_factory_(external_encoder_factory), | 615 external_encoder_factory_(external_encoder_factory), |
| 616 external_decoder_factory_(external_decoder_factory), | 616 external_decoder_factory_(external_decoder_factory), |
| 617 default_send_options_(options) { | 617 default_send_options_(options) { |
| 618 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 618 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 619 | 619 |
| 620 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; | 620 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; |
| 621 sending_ = false; | 621 sending_ = false; |
| 622 default_send_ssrc_ = 0; | |
| 623 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); | 622 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); |
| 624 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); | 623 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); |
| 625 } | 624 } |
| 626 | 625 |
| 627 WebRtcVideoChannel2::~WebRtcVideoChannel2() { | 626 WebRtcVideoChannel2::~WebRtcVideoChannel2() { |
| 628 for (auto& kv : send_streams_) | 627 for (auto& kv : send_streams_) |
| 629 delete kv.second; | 628 delete kv.second; |
| 630 for (auto& kv : receive_streams_) | 629 for (auto& kv : receive_streams_) |
| 631 delete kv.second; | 630 delete kv.second; |
| 632 } | 631 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 RTC_DCHECK(ssrc != 0); | 1022 RTC_DCHECK(ssrc != 0); |
| 1024 send_streams_[ssrc] = stream; | 1023 send_streams_[ssrc] = stream; |
| 1025 | 1024 |
| 1026 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1025 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
| 1027 rtcp_receiver_report_ssrc_ = ssrc; | 1026 rtcp_receiver_report_ssrc_ = ssrc; |
| 1028 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1027 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
| 1029 "a send stream."; | 1028 "a send stream."; |
| 1030 for (auto& kv : receive_streams_) | 1029 for (auto& kv : receive_streams_) |
| 1031 kv.second->SetLocalSsrc(ssrc); | 1030 kv.second->SetLocalSsrc(ssrc); |
| 1032 } | 1031 } |
| 1033 if (default_send_ssrc_ == 0) { | |
| 1034 default_send_ssrc_ = ssrc; | |
| 1035 } | |
| 1036 if (sending_) { | 1032 if (sending_) { |
| 1037 stream->Start(); | 1033 stream->Start(); |
| 1038 } | 1034 } |
| 1039 | 1035 |
| 1040 return true; | 1036 return true; |
| 1041 } | 1037 } |
| 1042 | 1038 |
| 1043 bool WebRtcVideoChannel2::RemoveSendStream(uint32_t ssrc) { | 1039 bool WebRtcVideoChannel2::RemoveSendStream(uint32_t ssrc) { |
| 1044 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; | 1040 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; |
| 1045 | 1041 |
| 1046 if (ssrc == 0) { | 1042 // TODO(nisse): ssrc == 0 is technically valid, but currently not |
| 1047 if (default_send_ssrc_ == 0) { | 1043 // supported. |
| 1048 LOG(LS_ERROR) << "No default send stream active."; | 1044 if (ssrc == 0) |
| 1049 return false; | 1045 return false; |
|
pthatcher1
2016/03/22 21:30:28
{}s please.
pthatcher1
2016/03/22 21:31:38
We don't need this here, because what will be pass
nisse-webrtc
2016/03/23 07:42:23
Ok, deleted this check and comment.
| |
| 1050 } | |
| 1051 | |
| 1052 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; | |
| 1053 ssrc = default_send_ssrc_; | |
| 1054 } | |
| 1055 | 1046 |
| 1056 WebRtcVideoSendStream* removed_stream; | 1047 WebRtcVideoSendStream* removed_stream; |
| 1057 { | 1048 { |
| 1058 rtc::CritScope stream_lock(&stream_crit_); | 1049 rtc::CritScope stream_lock(&stream_crit_); |
| 1059 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = | 1050 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
| 1060 send_streams_.find(ssrc); | 1051 send_streams_.find(ssrc); |
| 1061 if (it == send_streams_.end()) { | 1052 if (it == send_streams_.end()) { |
| 1062 return false; | 1053 return false; |
| 1063 } | 1054 } |
| 1064 | 1055 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1077 "previous local SSRC was removed."; | 1068 "previous local SSRC was removed."; |
| 1078 | 1069 |
| 1079 for (auto& kv : receive_streams_) { | 1070 for (auto& kv : receive_streams_) { |
| 1080 kv.second->SetLocalSsrc(rtcp_receiver_report_ssrc_); | 1071 kv.second->SetLocalSsrc(rtcp_receiver_report_ssrc_); |
| 1081 } | 1072 } |
| 1082 } | 1073 } |
| 1083 } | 1074 } |
| 1084 | 1075 |
| 1085 delete removed_stream; | 1076 delete removed_stream; |
| 1086 | 1077 |
| 1087 if (ssrc == default_send_ssrc_) { | |
| 1088 default_send_ssrc_ = 0; | |
| 1089 } | |
| 1090 | |
| 1091 return true; | 1078 return true; |
| 1092 } | 1079 } |
| 1093 | 1080 |
| 1094 void WebRtcVideoChannel2::DeleteReceiveStream( | 1081 void WebRtcVideoChannel2::DeleteReceiveStream( |
| 1095 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { | 1082 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { |
| 1096 for (uint32_t old_ssrc : stream->GetSsrcs()) | 1083 for (uint32_t old_ssrc : stream->GetSsrcs()) |
| 1097 receive_ssrcs_.erase(old_ssrc); | 1084 receive_ssrcs_.erase(old_ssrc); |
| 1098 delete stream; | 1085 delete stream; |
| 1099 } | 1086 } |
| 1100 | 1087 |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2567 rtx_mapping[video_codecs[i].codec.id] != | 2554 rtx_mapping[video_codecs[i].codec.id] != |
| 2568 fec_settings.red_payload_type) { | 2555 fec_settings.red_payload_type) { |
| 2569 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2556 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2570 } | 2557 } |
| 2571 } | 2558 } |
| 2572 | 2559 |
| 2573 return video_codecs; | 2560 return video_codecs; |
| 2574 } | 2561 } |
| 2575 | 2562 |
| 2576 } // namespace cricket | 2563 } // namespace cricket |
| OLD | NEW |