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

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

Issue 2303283002: Introduce helpers to RtpSender to propagate RtpPacketToSend. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: nit Created 4 years, 3 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) 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1065
1066 uint16_t len = 1066 uint16_t len =
1067 BuildRtpHeaderExtension(header + rtp_header_length, marker_bit); 1067 BuildRtpHeaderExtension(header + rtp_header_length, marker_bit);
1068 if (len > 0) { 1068 if (len > 0) {
1069 header[0] |= 0x10; // Set extension bit. 1069 header[0] |= 0x10; // Set extension bit.
1070 rtp_header_length += len; 1070 rtp_header_length += len;
1071 } 1071 }
1072 return rtp_header_length; 1072 return rtp_header_length;
1073 } 1073 }
1074 1074
1075 std::unique_ptr<RtpPacketToSend> RTPSender::AllocatePacket() const {
1076 rtc::CritScope lock(&send_critsect_);
1077 std::unique_ptr<RtpPacketToSend> packet(
1078 new RtpPacketToSend(&rtp_header_extension_map_, max_payload_length_));
1079 packet->SetSsrc(ssrc_);
1080 packet->SetCsrcs(csrcs_);
1081 // Reserve extensions, if registered, RtpSender set in SendToNetwork.
1082 packet->ReserveExtension<AbsoluteSendTime>();
1083 packet->ReserveExtension<TransmissionOffset>();
1084 packet->ReserveExtension<TransportSequenceNumber>();
1085 return packet;
1086 }
1087
1088 bool RTPSender::AssignSequenceNumber(RtpPacketToSend* packet) {
1089 rtc::CritScope lock(&send_critsect_);
1090 if (!sending_media_)
1091 return false;
1092 RTC_DCHECK_EQ(packet->Ssrc(), ssrc_);
1093 packet->SetSequenceNumber(sequence_number_++);
1094
1095 // Remember marker bit to determine if padding can be inserted with
1096 // sequence number following |packet|.
1097 last_packet_marker_bit_ = packet->Marker();
1098 // Save timestamps to generate timestamp field and extensions for the padding.
1099 last_rtp_timestamp_ = packet->Timestamp();
1100 last_timestamp_time_ms_ = clock_->TimeInMilliseconds();
1101 capture_time_ms_ = packet->capture_time_ms();
1102 return true;
1103 }
1104
1075 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, 1105 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer,
1076 int8_t payload_type, 1106 int8_t payload_type,
1077 bool marker_bit, 1107 bool marker_bit,
1078 uint32_t capture_timestamp, 1108 uint32_t capture_timestamp,
1079 int64_t capture_time_ms, 1109 int64_t capture_time_ms,
1080 bool timestamp_provided, 1110 bool timestamp_provided,
1081 bool inc_sequence_number) { 1111 bool inc_sequence_number) {
1082 return BuildRtpHeader(data_buffer, payload_type, marker_bit, 1112 return BuildRtpHeader(data_buffer, payload_type, marker_bit,
1083 capture_timestamp, capture_time_ms); 1113 capture_timestamp, capture_time_ms);
1084 } 1114 }
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 rtc::CritScope lock(&send_critsect_); 1751 rtc::CritScope lock(&send_critsect_);
1722 1752
1723 RtpState state; 1753 RtpState state;
1724 state.sequence_number = sequence_number_rtx_; 1754 state.sequence_number = sequence_number_rtx_;
1725 state.start_timestamp = timestamp_offset_; 1755 state.start_timestamp = timestamp_offset_;
1726 1756
1727 return state; 1757 return state;
1728 } 1758 }
1729 1759
1730 } // namespace webrtc 1760 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698