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

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

Issue 1247293002: Add support for transport wide sequence numbers (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase, again Created 5 years, 4 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
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
13 #include <assert.h> 13 #include <assert.h>
14 #include <math.h> 14 #include <math.h>
15 15
16 #include <map> 16 #include <map>
17 17
18 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
20 #include "webrtc/modules/pacing/include/paced_sender.h" 20 #include "webrtc/modules/pacing/include/paced_sender.h"
21 #include "webrtc/modules/pacing/include/packet_router.h"
21 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" 22 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
22 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" 23 #include "webrtc/modules/rtp_rtcp/source/bitrate.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
27 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" 28 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h"
28 29
29 #define MAX_INIT_RTP_SEQ_NUMBER 32767 // 2^15 -1. 30 #define MAX_INIT_RTP_SEQ_NUMBER 32767 // 2^15 -1.
30 31
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 }; 85 };
85 86
86 class RTPSender : public RTPSenderInterface { 87 class RTPSender : public RTPSenderInterface {
87 public: 88 public:
88 RTPSender(int32_t id, 89 RTPSender(int32_t id,
89 bool audio, 90 bool audio,
90 Clock* clock, 91 Clock* clock,
91 Transport* transport, 92 Transport* transport,
92 RtpAudioFeedback* audio_feedback, 93 RtpAudioFeedback* audio_feedback,
93 PacedSender* paced_sender, 94 PacedSender* paced_sender,
95 PacketRouter* packet_router,
96 SendTimeObserver* send_time_observer,
94 BitrateStatisticsObserver* bitrate_callback, 97 BitrateStatisticsObserver* bitrate_callback,
95 FrameCountObserver* frame_count_observer, 98 FrameCountObserver* frame_count_observer,
96 SendSideDelayObserver* send_side_delay_observer); 99 SendSideDelayObserver* send_side_delay_observer);
97 virtual ~RTPSender(); 100 virtual ~RTPSender();
98 101
99 void ProcessBitrate(); 102 void ProcessBitrate();
100 103
101 uint16_t ActualSendBitrateKbit() const override; 104 uint16_t ActualSendBitrateKbit() const override;
102 105
103 uint32_t VideoBitrateSent() const; 106 uint32_t VideoBitrateSent() const;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); 167 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type);
165 168
166 size_t RtpHeaderExtensionTotalLength() const; 169 size_t RtpHeaderExtensionTotalLength() const;
167 170
168 uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const; 171 uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const;
169 172
170 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const; 173 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const;
171 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; 174 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const;
172 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; 175 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const;
173 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; 176 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const;
174 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer) const; 177 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer,
178 uint16_t sequence_number) const;
179
180 // Verifies that the specified extension is registered, and that it is
181 // present in rtp packet. If extension is not registered kNotRegistered is
182 // returned. If extension cannot be found in the rtp header, or if it is
183 // malformed, kError is returned. Otherwise *extension_offset is set to the
184 // offset of the extension from the beginning of the rtp packet and kOk is
185 // returned.
186 enum class ExtensionStatus {
187 kNotRegistered,
188 kOk,
189 kError,
190 };
191 ExtensionStatus VerifyExtension(RTPExtensionType extension_type,
192 uint8_t* rtp_packet,
193 size_t rtp_packet_length,
194 const RTPHeader& rtp_header,
195 size_t extension_length_bytes,
196 size_t* extension_offset) const
197 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_.get());
175 198
176 bool UpdateAudioLevel(uint8_t* rtp_packet, 199 bool UpdateAudioLevel(uint8_t* rtp_packet,
177 size_t rtp_packet_length, 200 size_t rtp_packet_length,
178 const RTPHeader& rtp_header, 201 const RTPHeader& rtp_header,
179 bool is_voiced, 202 bool is_voiced,
180 uint8_t dBov) const; 203 uint8_t dBov) const;
181 204
182 virtual bool UpdateVideoRotation(uint8_t* rtp_packet, 205 virtual bool UpdateVideoRotation(uint8_t* rtp_packet,
183 size_t rtp_packet_length, 206 size_t rtp_packet_length,
184 const RTPHeader& rtp_header, 207 const RTPHeader& rtp_header,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 size_t* position) const; 361 size_t* position) const;
339 362
340 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, 363 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet,
341 size_t rtp_packet_length, 364 size_t rtp_packet_length,
342 const RTPHeader& rtp_header, 365 const RTPHeader& rtp_header,
343 int64_t time_diff_ms) const; 366 int64_t time_diff_ms) const;
344 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, 367 void UpdateAbsoluteSendTime(uint8_t* rtp_packet,
345 size_t rtp_packet_length, 368 size_t rtp_packet_length,
346 const RTPHeader& rtp_header, 369 const RTPHeader& rtp_header,
347 int64_t now_ms) const; 370 int64_t now_ms) const;
371 // Update the transport sequence number of the packet using a new sequence
372 // number allocated by PacketRouter. Returns the assigned sequence number,
373 // or 0 if extension could not be updated.
374 uint16_t UpdateTransportSequenceNumber(uint8_t* rtp_packet,
375 size_t rtp_packet_length,
376 const RTPHeader& rtp_header) const;
348 377
349 void UpdateRtpStats(const uint8_t* buffer, 378 void UpdateRtpStats(const uint8_t* buffer,
350 size_t packet_length, 379 size_t packet_length,
351 const RTPHeader& header, 380 const RTPHeader& header,
352 bool is_rtx, 381 bool is_rtx,
353 bool is_retransmit); 382 bool is_retransmit);
354 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; 383 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const;
355 384
356 Clock* clock_; 385 Clock* clock_;
357 int64_t clock_delta_ms_; 386 int64_t clock_delta_ms_;
358 387
359 rtc::scoped_ptr<BitrateAggregator> bitrates_; 388 rtc::scoped_ptr<BitrateAggregator> bitrates_;
360 Bitrate total_bitrate_sent_; 389 Bitrate total_bitrate_sent_;
361 390
362 int32_t id_; 391 int32_t id_;
363 392
364 const bool audio_configured_; 393 const bool audio_configured_;
365 rtc::scoped_ptr<RTPSenderAudio> audio_; 394 rtc::scoped_ptr<RTPSenderAudio> audio_;
366 rtc::scoped_ptr<RTPSenderVideo> video_; 395 rtc::scoped_ptr<RTPSenderVideo> video_;
367 396
368 PacedSender *paced_sender_; 397 PacedSender* const paced_sender_;
398 PacketRouter* const packet_router_;
399 SendTimeObserver* const send_time_observer_;
369 int64_t last_capture_time_ms_sent_; 400 int64_t last_capture_time_ms_sent_;
370 rtc::scoped_ptr<CriticalSectionWrapper> send_critsect_; 401 rtc::scoped_ptr<CriticalSectionWrapper> send_critsect_;
371 402
372 Transport *transport_; 403 Transport *transport_;
373 bool sending_media_ GUARDED_BY(send_critsect_); 404 bool sending_media_ GUARDED_BY(send_critsect_);
374 405
375 size_t max_payload_length_; 406 size_t max_payload_length_;
376 uint16_t packet_over_head_; 407 uint16_t packet_over_head_;
377 408
378 int8_t payload_type_ GUARDED_BY(send_critsect_); 409 int8_t payload_type_ GUARDED_BY(send_critsect_);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // SetTargetBitrateKbps or GetTargetBitrateKbps. Also remember 461 // SetTargetBitrateKbps or GetTargetBitrateKbps. Also remember
431 // that by the time the function returns there is no guarantee 462 // that by the time the function returns there is no guarantee
432 // that the target bitrate is still valid. 463 // that the target bitrate is still valid.
433 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; 464 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_;
434 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); 465 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_);
435 }; 466 };
436 467
437 } // namespace webrtc 468 } // namespace webrtc
438 469
439 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ 470 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698