Add MID sending to RTPSender

This CL adds the ability to configure RTPSender to include the
MID header extension when sending packets. The MID will be
included on every packet at the start of the stream until an RTCP
acknoledgment is received for that SSRC at which point it will
stop being included. The MID will be included on regular RTP
streams as well as RTX streams.

Bug: webrtc:4050
Change-Id: Ie27ebee1cd00a67f2b931f5363788f523e3e684f
Reviewed-on: https://webrtc-review.googlesource.com/60582
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22574}
This commit is contained in:
Steve Anton
2018-03-22 15:17:27 -07:00
committed by Commit Bot
parent ba2a9237da
commit 296a0ce4c7
12 changed files with 269 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
@ -23,6 +24,7 @@
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/mid_oracle.h"
#include "modules/rtp_rtcp/source/playout_delay_oracle.h"
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_config.h"
@ -92,6 +94,8 @@ class RTPSender {
void SetSSRC(uint32_t ssrc);
void SetMid(const std::string& mid);
uint16_t SequenceNumber() const;
void SetSequenceNumber(uint16_t seq);
@ -134,7 +138,8 @@ class RTPSender {
int32_t ReSendPacket(uint16_t packet_id);
// Feedback to decide when to stop sending playout delay.
// Feedback to decide when to stop sending the playout delay and MID header
// extensions.
void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks);
// RTX.
@ -316,6 +321,7 @@ class RTPSender {
// Must be explicitly set by the application, use of rtc::Optional
// only to keep track of correct use.
rtc::Optional<uint32_t> ssrc_ RTC_GUARDED_BY(send_critsect_);
std::unique_ptr<MidOracle> mid_oracle_ RTC_GUARDED_BY(send_critsect_);
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(send_critsect_);
int64_t capture_time_ms_ RTC_GUARDED_BY(send_critsect_);
int64_t last_timestamp_time_ms_ RTC_GUARDED_BY(send_critsect_);
@ -324,6 +330,7 @@ class RTPSender {
std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(send_critsect_);
int rtx_ RTC_GUARDED_BY(send_critsect_);
rtc::Optional<uint32_t> ssrc_rtx_ RTC_GUARDED_BY(send_critsect_);
std::unique_ptr<MidOracle> mid_oracle_rtx_ RTC_GUARDED_BY(send_critsect_);
// Mapping rtx_payload_type_map_[associated] = rtx.
std::map<int8_t, int8_t> rtx_payload_type_map_ RTC_GUARDED_BY(send_critsect_);
size_t rtp_overhead_bytes_per_packet_ RTC_GUARDED_BY(send_critsect_);