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

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

Issue 1945773002: RtpPacketHistory rewritten to use RtpPacket class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 15 matching lines...) Expand all
26 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" 26 #include "webrtc/modules/rtp_rtcp/source/bitrate.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
31 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" 31 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h"
32 #include "webrtc/transport.h" 32 #include "webrtc/transport.h"
33 33
34 namespace webrtc { 34 namespace webrtc {
35 35
36 class RtcEventLog;
37 class RtpPacketToSend;
36 class RTPSenderAudio; 38 class RTPSenderAudio;
37 class RTPSenderVideo; 39 class RTPSenderVideo;
38 class RtcEventLog;
39 40
40 class RTPSenderInterface { 41 class RTPSenderInterface {
41 public: 42 public:
42 RTPSenderInterface() {} 43 RTPSenderInterface() {}
43 virtual ~RTPSenderInterface() {} 44 virtual ~RTPSenderInterface() {}
44 45
45 enum CVOMode { 46 enum CVOMode {
46 kCVONone, 47 kCVONone,
47 kCVOInactive, // CVO rtp header extension is registered but haven't 48 kCVOInactive, // CVO rtp header extension is registered but haven't
48 // received any frame with rotation pending. 49 // received any frame with rotation pending.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 const bool inc_sequence_number = true) override; 249 const bool inc_sequence_number = true) override;
249 250
250 size_t RTPHeaderLength() const override; 251 size_t RTPHeaderLength() const override;
251 uint16_t AllocateSequenceNumber(uint16_t packets_to_send) override; 252 uint16_t AllocateSequenceNumber(uint16_t packets_to_send) override;
252 size_t MaxPayloadLength() const override; 253 size_t MaxPayloadLength() const override;
253 254
254 // Current timestamp. 255 // Current timestamp.
255 uint32_t Timestamp() const override; 256 uint32_t Timestamp() const override;
256 uint32_t SSRC() const override; 257 uint32_t SSRC() const override;
257 258
259 // Deprecated. Create RtpPacketToSend instead and use next function.
258 int32_t SendToNetwork(uint8_t* data_buffer, 260 int32_t SendToNetwork(uint8_t* data_buffer,
259 size_t payload_length, 261 size_t payload_length,
260 size_t rtp_header_length, 262 size_t rtp_header_length,
261 int64_t capture_time_ms, 263 int64_t capture_time_ms,
262 StorageType storage, 264 StorageType storage,
263 RtpPacketSender::Priority priority) override; 265 RtpPacketSender::Priority priority) override;
266 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
267 StorageType storage,
268 RtpPacketSender::Priority priority);
264 269
265 // Audio. 270 // Audio.
266 271
267 // Send a DTMF tone using RFC 2833 (4733). 272 // Send a DTMF tone using RFC 2833 (4733).
268 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); 273 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level);
269 274
270 // Set audio packet size, used to determine when it's time to send a DTMF 275 // Set audio packet size, used to determine when it's time to send a DTMF
271 // packet in silence (CNG). 276 // packet in silence (CNG).
272 int32_t SetAudioPacketSize(uint16_t packet_size_samples); 277 int32_t SetAudioPacketSize(uint16_t packet_size_samples);
273 278
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 size_t CreateRtpHeader(uint8_t* header, 331 size_t CreateRtpHeader(uint8_t* header,
327 int8_t payload_type, 332 int8_t payload_type,
328 uint32_t ssrc, 333 uint32_t ssrc,
329 bool marker_bit, 334 bool marker_bit,
330 uint32_t timestamp, 335 uint32_t timestamp,
331 uint16_t sequence_number, 336 uint16_t sequence_number,
332 const std::vector<uint32_t>& csrcs) const; 337 const std::vector<uint32_t>& csrcs) const;
333 338
334 void UpdateNACKBitRate(uint32_t bytes, int64_t now); 339 void UpdateNACKBitRate(uint32_t bytes, int64_t now);
335 340
336 bool PrepareAndSendPacket(uint8_t* buffer, 341 bool PrepareAndSendPacket(std::unique_ptr<RtpPacketToSend> packet,
337 size_t length,
338 int64_t capture_time_ms,
339 bool send_over_rtx, 342 bool send_over_rtx,
340 bool is_retransmit); 343 bool is_retransmit);
341 344
342 // Return the number of bytes sent. Note that both of these functions may 345 // Return the number of bytes sent. Note that both of these functions may
343 // return a larger value that their argument. 346 // return a larger value that their argument.
344 size_t TrySendRedundantPayloads(size_t bytes); 347 size_t TrySendRedundantPayloads(size_t bytes);
345 348
346 void BuildPaddingPacket(uint8_t* packet, 349 std::unique_ptr<RtpPacketToSend> BuildRtxPacket(
347 size_t header_length, 350 const RtpPacketToSend& packet);
348 size_t padding_length);
349 351
350 void BuildRtxPacket(uint8_t* buffer, size_t* length, 352 bool SendPacketToNetwork(const RtpPacketToSend& packet,
351 uint8_t* buffer_rtx);
352
353 bool SendPacketToNetwork(const uint8_t* packet,
354 size_t size,
355 const PacketOptions& options); 353 const PacketOptions& options);
356 354
357 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); 355 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms);
358 void UpdateOnSendPacket(int packet_id, 356 void UpdateOnSendPacket(int packet_id,
359 int64_t capture_time_ms, 357 int64_t capture_time_ms,
360 uint32_t ssrc); 358 uint32_t ssrc);
361 359
362 // Find the byte position of the RTP extension as indicated by |type| in 360 // Find the byte position of the RTP extension as indicated by |type| in
363 // |rtp_packet|. Return false if such extension doesn't exist. 361 // |rtp_packet|. Return false if such extension doesn't exist.
364 bool FindHeaderExtensionPosition(RTPExtensionType type, 362 bool FindHeaderExtensionPosition(RTPExtensionType type,
365 const uint8_t* rtp_packet, 363 const uint8_t* rtp_packet,
366 size_t rtp_packet_length, 364 size_t rtp_packet_length,
367 const RTPHeader& rtp_header, 365 const RTPHeader& rtp_header,
368 size_t* position) const; 366 size_t* position) const;
369 367
370 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet,
371 size_t rtp_packet_length,
372 const RTPHeader& rtp_header,
373 int64_t time_diff_ms) const;
374 void UpdateAbsoluteSendTime(uint8_t* rtp_packet,
375 size_t rtp_packet_length,
376 const RTPHeader& rtp_header,
377 int64_t now_ms) const;
378
379 bool UpdateTransportSequenceNumber(uint16_t sequence_number,
380 uint8_t* rtp_packet,
381 size_t rtp_packet_length,
382 const RTPHeader& rtp_header) const;
383
384 bool AllocateTransportSequenceNumber(int* packet_id) const; 368 bool AllocateTransportSequenceNumber(int* packet_id) const;
385 369
386 void UpdateRtpStats(const uint8_t* buffer, 370 void UpdateRtpStats(const RtpPacketToSend& packet,
387 size_t packet_length,
388 const RTPHeader& header,
389 bool is_rtx, 371 bool is_rtx,
390 bool is_retransmit); 372 bool is_retransmit);
391 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; 373 bool IsFecPacket(const RtpPacketToSend& packet) const;
392 374
393 class BitrateAggregator { 375 class BitrateAggregator {
394 public: 376 public:
395 explicit BitrateAggregator(BitrateStatisticsObserver* bitrate_callback); 377 explicit BitrateAggregator(BitrateStatisticsObserver* bitrate_callback);
396 378
397 void OnStatsUpdated() const; 379 void OnStatsUpdated() const;
398 380
399 Bitrate::Observer* total_bitrate_observer(); 381 Bitrate::Observer* total_bitrate_observer();
400 Bitrate::Observer* retransmit_bitrate_observer(); 382 Bitrate::Observer* retransmit_bitrate_observer();
401 void set_ssrc(uint32_t ssrc); 383 void set_ssrc(uint32_t ssrc);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 uint32_t absolute_send_time_; 434 uint32_t absolute_send_time_;
453 VideoRotation rotation_; 435 VideoRotation rotation_;
454 CVOMode cvo_mode_; 436 CVOMode cvo_mode_;
455 uint16_t transport_sequence_number_; 437 uint16_t transport_sequence_number_;
456 438
457 // NACK 439 // NACK
458 uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE]; 440 uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE];
459 size_t nack_byte_count_[NACK_BYTECOUNT_SIZE]; 441 size_t nack_byte_count_[NACK_BYTECOUNT_SIZE];
460 Bitrate nack_bitrate_; 442 Bitrate nack_bitrate_;
461 443
462 RTPPacketHistory packet_history_; 444 RtpPacketHistory packet_history_;
463 445
464 // Statistics 446 // Statistics
465 rtc::CriticalSection statistics_crit_; 447 rtc::CriticalSection statistics_crit_;
466 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); 448 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_);
467 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); 449 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_);
468 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); 450 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_);
469 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); 451 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_);
470 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); 452 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_);
471 FrameCountObserver* const frame_count_observer_; 453 FrameCountObserver* const frame_count_observer_;
472 SendSideDelayObserver* const send_side_delay_observer_; 454 SendSideDelayObserver* const send_side_delay_observer_;
(...skipping 27 matching lines...) Expand all
500 // that the target bitrate is still valid. 482 // that the target bitrate is still valid.
501 rtc::CriticalSection target_bitrate_critsect_; 483 rtc::CriticalSection target_bitrate_critsect_;
502 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); 484 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_);
503 485
504 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); 486 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender);
505 }; 487 };
506 488
507 } // namespace webrtc 489 } // namespace webrtc
508 490
509 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ 491 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698