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

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

Issue 1674963004: Always append the BYE packet type at the end (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed Comment Created 4 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 | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 828
829 // We need to send our NTP even if we haven't received any reports. 829 // We need to send our NTP even if we haven't received any reports.
830 uint32_t ntp_sec; 830 uint32_t ntp_sec;
831 uint32_t ntp_frac; 831 uint32_t ntp_frac;
832 clock_->CurrentNtp(ntp_sec, ntp_frac); 832 clock_->CurrentNtp(ntp_sec, ntp_frac);
833 RtcpContext context(feedback_state, nack_size, nack_list, repeat, pictureID, 833 RtcpContext context(feedback_state, nack_size, nack_list, repeat, pictureID,
834 ntp_sec, ntp_frac, &container); 834 ntp_sec, ntp_frac, &container);
835 835
836 PrepareReport(packet_types, feedback_state); 836 PrepareReport(packet_types, feedback_state);
837 837
838 rtc::scoped_ptr<rtcp::RtcpPacket> packet_bye;
839
838 auto it = report_flags_.begin(); 840 auto it = report_flags_.begin();
839 while (it != report_flags_.end()) { 841 while (it != report_flags_.end()) {
840 auto builder_it = builders_.find(it->type); 842 auto builder_it = builders_.find(it->type);
841 RTC_DCHECK(builder_it != builders_.end()); 843 RTC_DCHECK(builder_it != builders_.end());
842 if (it->is_volatile) { 844 if (it->is_volatile) {
843 report_flags_.erase(it++); 845 report_flags_.erase(it++);
844 } else { 846 } else {
845 ++it; 847 ++it;
846 } 848 }
847 849
848 BuilderFunc func = builder_it->second; 850 BuilderFunc func = builder_it->second;
849 rtc::scoped_ptr<rtcp::RtcpPacket> packet = (this->*func)(context); 851 rtc::scoped_ptr<rtcp::RtcpPacket> packet = (this->*func)(context);
850 if (packet.get() == nullptr) 852 if (packet.get() == nullptr)
851 return -1; 853 return -1;
852 container.Append(packet.release()); 854 // If there is a BYE, don't append now - save it and append it
855 // at the end later.
856 if (builder_it->first == kRtcpBye) {
857 packet_bye = std::move(packet);
858 } else {
859 container.Append(packet.release());
860 }
861 }
862
863 // Append the BYE now at the end
864 if (packet_bye) {
865 container.Append(packet_bye.release());
853 } 866 }
854 867
855 if (packet_type_counter_observer_ != nullptr) { 868 if (packet_type_counter_observer_ != nullptr) {
856 packet_type_counter_observer_->RtcpPacketTypesCounterUpdated( 869 packet_type_counter_observer_->RtcpPacketTypesCounterUpdated(
857 remote_ssrc_, packet_type_counter_); 870 remote_ssrc_, packet_type_counter_);
858 } 871 }
859 872
860 RTC_DCHECK(AllVolatileFlagsConsumed()); 873 RTC_DCHECK(AllVolatileFlagsConsumed());
861 } 874 }
862 875
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); 1094 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender);
1082 // but we can't because of an incorrect warning (C4822) in MVS 2013. 1095 // but we can't because of an incorrect warning (C4822) in MVS 2013.
1083 } sender(transport_, event_log_); 1096 } sender(transport_, event_log_);
1084 1097
1085 uint8_t buffer[IP_PACKET_SIZE]; 1098 uint8_t buffer[IP_PACKET_SIZE];
1086 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && 1099 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
1087 !sender.send_failure_; 1100 !sender.send_failure_;
1088 } 1101 }
1089 1102
1090 } // namespace webrtc 1103 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698