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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 2660253002: Do not regenerate ssrc on SetSendingStatus (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 return false; 1035 return false;
1036 1036
1037 *packet_id = transport_sequence_number_allocator_->AllocateSequenceNumber(); 1037 *packet_id = transport_sequence_number_allocator_->AllocateSequenceNumber();
1038 1038
1039 if (!packet->SetExtension<TransportSequenceNumber>(*packet_id)) 1039 if (!packet->SetExtension<TransportSequenceNumber>(*packet_id))
1040 return false; 1040 return false;
1041 1041
1042 return true; 1042 return true;
1043 } 1043 }
1044 1044
1045 void RTPSender::SetSendingStatus(bool enabled) {
1046 if (!enabled) {
1047 rtc::CritScope lock(&send_critsect_);
1048 if (!ssrc_forced_) {
1049 // Generate a new SSRC.
1050 ssrc_db_->ReturnSSRC(ssrc_);
1051 ssrc_ = ssrc_db_->CreateSSRC();
1052 RTC_DCHECK(ssrc_ != 0);
1053 }
1054 // Don't initialize seq number if SSRC passed externally.
1055 if (!sequence_number_forced_ && !ssrc_forced_) {
1056 // Generate a new sequence number.
1057 sequence_number_ = random_.Rand(1, kMaxInitRtpSeqNumber);
1058 }
1059 }
1060 }
1061
1062 void RTPSender::SetSendingMediaStatus(bool enabled) { 1045 void RTPSender::SetSendingMediaStatus(bool enabled) {
1063 rtc::CritScope lock(&send_critsect_); 1046 rtc::CritScope lock(&send_critsect_);
1064 sending_media_ = enabled; 1047 sending_media_ = enabled;
1065 } 1048 }
1066 1049
1067 bool RTPSender::SendingMedia() const { 1050 bool RTPSender::SendingMedia() const {
1068 rtc::CritScope lock(&send_critsect_); 1051 rtc::CritScope lock(&send_critsect_);
1069 return sending_media_; 1052 return sending_media_;
1070 } 1053 }
1071 1054
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { 1277 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) {
1295 return; 1278 return;
1296 } 1279 }
1297 rtp_overhead_bytes_per_packet_ = packet.headers_size(); 1280 rtp_overhead_bytes_per_packet_ = packet.headers_size();
1298 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; 1281 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_;
1299 } 1282 }
1300 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); 1283 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet);
1301 } 1284 }
1302 1285
1303 } // namespace webrtc 1286 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698