Prepare the AudioSendStream to be hooked up to send-side BWE.
This CL contains three changes as a preparation for adding audio send streams to the send-side BWE: 1. Audio packets are passed through the pacer with high priority. This is needed to be able to set transport sequence numbers on the packets. 2. A feedback observer is passed to the audio stream's rtcp receiver so that the BWE can get notified of any BWE feedback being received on the audio feedback channel. 3. Support for the transport sequence number header extension is added to audio send streams. BUG=webrtc:5263,webrtc:5307 R=mflodman@webrtc.org, solenberg@webrtc.org Review URL: https://codereview.webrtc.org/1479023002 . Cr-Commit-Position: refs/heads/master@{#10909}
This commit is contained in:
@ -358,10 +358,9 @@ int32_t PacedSender::Process() {
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
int64_t elapsed_time_ms = (now_us - time_last_update_us_ + 500) / 1000;
|
||||
time_last_update_us_ = now_us;
|
||||
if (paused_)
|
||||
return 0;
|
||||
int target_bitrate_kbps = max_bitrate_kbps_;
|
||||
if (elapsed_time_ms > 0) {
|
||||
// TODO(holmer): Remove the !paused_ check when issue 5307 has been fixed.
|
||||
if (!paused_ && elapsed_time_ms > 0) {
|
||||
size_t queue_size_bytes = packets_->SizeInBytes();
|
||||
if (queue_size_bytes > 0) {
|
||||
// Assuming equal size packets and input/output rate, the average packet
|
||||
@ -389,7 +388,11 @@ int32_t PacedSender::Process() {
|
||||
// element from the priority queue but keep it in storage, so that we can
|
||||
// reinsert it if send fails.
|
||||
const paced_sender::Packet& packet = packets_->BeginPop();
|
||||
if (SendPacket(packet)) {
|
||||
|
||||
// TODO(holmer): Because of this bug issue 5307 we have to send audio
|
||||
// packets even when the pacer is paused. Here we assume audio packets are
|
||||
// always high priority and that they are the only high priority packets.
|
||||
if ((!paused_ || packet.priority == kHighPriority) && SendPacket(packet)) {
|
||||
// Send succeeded, remove it from the queue.
|
||||
packets_->FinalizePop(packet);
|
||||
if (prober_->IsProbing())
|
||||
@ -401,7 +404,8 @@ int32_t PacedSender::Process() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!packets_->Empty())
|
||||
// TODO(holmer): Remove the paused_ check when issue 5307 has been fixed.
|
||||
if (paused_ || !packets_->Empty())
|
||||
return 0;
|
||||
|
||||
size_t padding_needed;
|
||||
|
||||
@ -469,7 +469,8 @@ int32_t RTPSender::CheckPayloadType(int8_t payload_type,
|
||||
std::map<int8_t, RtpUtility::Payload*>::iterator it =
|
||||
payload_type_map_.find(payload_type);
|
||||
if (it == payload_type_map_.end()) {
|
||||
LOG(LS_WARNING) << "Payload type " << payload_type << " not registered.";
|
||||
LOG(LS_WARNING) << "Payload type " << static_cast<int>(payload_type)
|
||||
<< " not registered.";
|
||||
return -1;
|
||||
}
|
||||
SetSendPayloadType(payload_type);
|
||||
@ -512,7 +513,8 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type,
|
||||
}
|
||||
RtpVideoCodecTypes video_type = kRtpVideoGeneric;
|
||||
if (CheckPayloadType(payload_type, &video_type) != 0) {
|
||||
LOG(LS_ERROR) << "Don't send data with unknown payload type.";
|
||||
LOG(LS_ERROR) << "Don't send data with unknown payload type: "
|
||||
<< static_cast<int>(payload_type) << ".";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -725,7 +727,7 @@ int32_t RTPSender::ReSendPacket(uint16_t packet_id, int64_t min_resend_time) {
|
||||
// TickTime.
|
||||
int64_t corrected_capture_tims_ms = capture_time_ms + clock_delta_ms_;
|
||||
paced_sender_->InsertPacket(
|
||||
RtpPacketSender::kHighPriority, header.ssrc, header.sequenceNumber,
|
||||
RtpPacketSender::kNormalPriority, header.ssrc, header.sequenceNumber,
|
||||
corrected_capture_tims_ms, length - header.headerLength, true);
|
||||
|
||||
return length;
|
||||
@ -1003,7 +1005,7 @@ bool RTPSender::IsFecPacket(const uint8_t* buffer,
|
||||
}
|
||||
|
||||
size_t RTPSender::TimeToSendPadding(size_t bytes) {
|
||||
if (bytes == 0)
|
||||
if (audio_configured_ || bytes == 0)
|
||||
return 0;
|
||||
{
|
||||
CriticalSectionScoped cs(send_critsect_.get());
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -368,7 +369,8 @@ int32_t RTPSenderAudio::SendAudio(
|
||||
_rtpSender->Timestamp(), "seqnum",
|
||||
_rtpSender->SequenceNumber());
|
||||
return _rtpSender->SendToNetwork(dataBuffer, payloadSize, rtpHeaderLength,
|
||||
-1, kAllowRetransmission,
|
||||
TickTime::MillisecondTimestamp(),
|
||||
kAllowRetransmission,
|
||||
RtpPacketSender::kHighPriority);
|
||||
}
|
||||
|
||||
@ -476,9 +478,9 @@ RTPSenderAudio::SendTelephoneEventPacket(bool ended,
|
||||
"Audio::SendTelephoneEvent", "timestamp",
|
||||
dtmfTimeStamp, "seqnum",
|
||||
_rtpSender->SequenceNumber());
|
||||
retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1,
|
||||
kAllowRetransmission,
|
||||
RtpPacketSender::kHighPriority);
|
||||
retVal = _rtpSender->SendToNetwork(
|
||||
dtmfbuffer, 4, 12, TickTime::MillisecondTimestamp(),
|
||||
kAllowRetransmission, RtpPacketSender::kHighPriority);
|
||||
sendCount--;
|
||||
|
||||
}while (sendCount > 0 && retVal == 0);
|
||||
|
||||
@ -104,7 +104,7 @@ void RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer,
|
||||
StorageType storage) {
|
||||
if (_rtpSender.SendToNetwork(data_buffer, payload_length, rtp_header_length,
|
||||
capture_time_ms, storage,
|
||||
RtpPacketSender::kNormalPriority) == 0) {
|
||||
RtpPacketSender::kLowPriority) == 0) {
|
||||
_videoBitrate.Update(payload_length + rtp_header_length);
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
||||
"Video::PacketNormal", "timestamp", capture_timestamp,
|
||||
@ -150,7 +150,7 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer,
|
||||
if (_rtpSender.SendToNetwork(
|
||||
red_packet->data(), red_packet->length() - rtp_header_length,
|
||||
rtp_header_length, capture_time_ms, media_packet_storage,
|
||||
RtpPacketSender::kNormalPriority) == 0) {
|
||||
RtpPacketSender::kLowPriority) == 0) {
|
||||
_videoBitrate.Update(red_packet->length());
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
||||
"Video::PacketRed", "timestamp", capture_timestamp,
|
||||
@ -162,7 +162,7 @@ void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer,
|
||||
if (_rtpSender.SendToNetwork(
|
||||
fec_packet->data(), fec_packet->length() - rtp_header_length,
|
||||
rtp_header_length, capture_time_ms, fec_storage,
|
||||
RtpPacketSender::kNormalPriority) == 0) {
|
||||
RtpPacketSender::kLowPriority) == 0) {
|
||||
_fecOverheadRate.Update(fec_packet->length());
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
||||
"Video::PacketFec", "timestamp", capture_timestamp,
|
||||
|
||||
Reference in New Issue
Block a user