Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1814233002: Delete default_send_ssrc_. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete ssrc==0 check in RemoveSendStream. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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) {
1047 if (default_send_ssrc_ == 0) {
1048 LOG(LS_ERROR) << "No default send stream active.";
1049 return false;
1050 }
1051
1052 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_;
1053 ssrc = default_send_ssrc_;
1054 }
1055
1056 WebRtcVideoSendStream* removed_stream; 1042 WebRtcVideoSendStream* removed_stream;
1057 { 1043 {
1058 rtc::CritScope stream_lock(&stream_crit_); 1044 rtc::CritScope stream_lock(&stream_crit_);
1059 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = 1045 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it =
1060 send_streams_.find(ssrc); 1046 send_streams_.find(ssrc);
1061 if (it == send_streams_.end()) { 1047 if (it == send_streams_.end()) {
1062 return false; 1048 return false;
1063 } 1049 }
1064 1050
1065 for (uint32_t old_ssrc : it->second->GetSsrcs()) 1051 for (uint32_t old_ssrc : it->second->GetSsrcs())
(...skipping 11 matching lines...) Expand all
1077 "previous local SSRC was removed."; 1063 "previous local SSRC was removed.";
1078 1064
1079 for (auto& kv : receive_streams_) { 1065 for (auto& kv : receive_streams_) {
1080 kv.second->SetLocalSsrc(rtcp_receiver_report_ssrc_); 1066 kv.second->SetLocalSsrc(rtcp_receiver_report_ssrc_);
1081 } 1067 }
1082 } 1068 }
1083 } 1069 }
1084 1070
1085 delete removed_stream; 1071 delete removed_stream;
1086 1072
1087 if (ssrc == default_send_ssrc_) {
1088 default_send_ssrc_ = 0;
1089 }
1090
1091 return true; 1073 return true;
1092 } 1074 }
1093 1075
1094 void WebRtcVideoChannel2::DeleteReceiveStream( 1076 void WebRtcVideoChannel2::DeleteReceiveStream(
1095 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { 1077 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) {
1096 for (uint32_t old_ssrc : stream->GetSsrcs()) 1078 for (uint32_t old_ssrc : stream->GetSsrcs())
1097 receive_ssrcs_.erase(old_ssrc); 1079 receive_ssrcs_.erase(old_ssrc);
1098 delete stream; 1080 delete stream;
1099 } 1081 }
1100 1082
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 rtx_mapping[video_codecs[i].codec.id] != 2549 rtx_mapping[video_codecs[i].codec.id] !=
2568 fec_settings.red_payload_type) { 2550 fec_settings.red_payload_type) {
2569 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2551 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2570 } 2552 }
2571 } 2553 }
2572 2554
2573 return video_codecs; 2555 return video_codecs;
2574 } 2556 }
2575 2557
2576 } // namespace cricket 2558 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698