Allow VideoTimingExtension to be used with FEC

This CL allows for FEC protection of packets with VideoTimingExtension by
zero-ing out data, which is changed after FEC protection is generated (i.e
in the pacer or by the SFU).

Actual FEC protection of these packets would be enabled later, when all
modern receivers have this change.

Bug: webrtc:10750
Change-Id: If4785392204d68cb8527629727b5c062f9fb6600
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143760
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28396}
This commit is contained in:
Ilya Nikolaevskiy
2019-06-26 14:39:36 +02:00
committed by Commit Bot
parent e4ac723bdc
commit 2d821c3cbc
12 changed files with 100 additions and 131 deletions

View File

@ -14,21 +14,28 @@
#include <memory>
#include <utility>
#include "absl/memory/memory.h"
#include "api/scoped_refptr.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "rtc_base/logging.h"
#include "rtc_base/time_utils.h"
namespace webrtc {
UlpfecReceiver* UlpfecReceiver::Create(uint32_t ssrc,
RecoveredPacketReceiver* callback) {
return new UlpfecReceiverImpl(ssrc, callback);
std::unique_ptr<UlpfecReceiver> UlpfecReceiver::Create(
uint32_t ssrc,
RecoveredPacketReceiver* callback,
rtc::ArrayView<const RtpExtension> extensions) {
return absl::make_unique<UlpfecReceiverImpl>(ssrc, callback, extensions);
}
UlpfecReceiverImpl::UlpfecReceiverImpl(uint32_t ssrc,
RecoveredPacketReceiver* callback)
UlpfecReceiverImpl::UlpfecReceiverImpl(
uint32_t ssrc,
RecoveredPacketReceiver* callback,
rtc::ArrayView<const RtpExtension> extensions)
: ssrc_(ssrc),
extensions_(extensions),
recovered_packet_callback_(callback),
fec_(ForwardErrorCorrection::CreateUlpfec(ssrc_)) {}
@ -243,6 +250,13 @@ int32_t UlpfecReceiverImpl::ProcessReceivedFec() {
recovered_packet_callback_->OnRecoveredPacket(packet->data,
packet->length);
crit_sect_.Enter();
RtpPacketReceived rtp_packet;
// TODO(ilnik): move extension nullifying out of RtpPacket, so there's no
// need to create one here, and avoid two memcpy calls below.
rtp_packet.Parse(packet->data, packet->length); // Does memcopy.
rtp_packet.IdentifyExtensions(extensions_);
rtp_packet.CopyAndZeroMutableExtensions( // Does memcopy.
rtc::MakeArrayView(packet->data, packet->length));
}
fec_->DecodeFec(*received_packet, &recovered_packets_);
}