Move, almost, all receive side references to RTP to RtpStreamReceiver.
There are still a few places in VideoReceiveStream where the RTP module is explicitly used, e.g. setting up a/v sync, but it's a bigger task to change and that will be done in a follow up instead of in this CL. BUG=webrtc:5838 Review-Url: https://codereview.webrtc.org/1947913002 Cr-Commit-Position: refs/heads/master@{#12642}
This commit is contained in:
parent
b56069e650
commit
dc7d0d2ef0
@ -540,6 +540,9 @@ class RtpRtcp : public Module {
|
||||
|
||||
/*
|
||||
* Send NACK for the packets specified.
|
||||
*
|
||||
* Note: This assumes the caller keeps track of timing and doesn't rely on
|
||||
* the RTP module to do this.
|
||||
*/
|
||||
virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0;
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include "webrtc/system_wrappers/include/timestamp_extrapolator.h"
|
||||
#include "webrtc/system_wrappers/include/trace.h"
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
#include "webrtc/video/vie_remb.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -76,12 +77,17 @@ RtpStreamReceiver::RtpStreamReceiver(
|
||||
RtcpRttStats* rtt_stats,
|
||||
PacedSender* paced_sender,
|
||||
PacketRouter* packet_router,
|
||||
VieRemb* remb,
|
||||
const VideoReceiveStream::Config& config,
|
||||
ReceiveStatisticsProxy* receive_stats_proxy)
|
||||
ReceiveStatisticsProxy* receive_stats_proxy,
|
||||
ProcessThread* process_thread)
|
||||
: clock_(Clock::GetRealTimeClock()),
|
||||
config_(config),
|
||||
video_receiver_(video_receiver),
|
||||
remote_bitrate_estimator_(remote_bitrate_estimator),
|
||||
packet_router_(packet_router),
|
||||
remb_(remb),
|
||||
process_thread_(process_thread),
|
||||
ntp_estimator_(clock_),
|
||||
rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)),
|
||||
rtp_header_parser_(RtpHeaderParser::Create()),
|
||||
@ -108,8 +114,23 @@ RtpStreamReceiver::RtpStreamReceiver(
|
||||
RTC_DCHECK(config.rtp.rtcp_mode != RtcpMode::kOff)
|
||||
<< "A stream should not be configured with RTCP disabled. This value is "
|
||||
"reserved for internal usage.";
|
||||
RTC_DCHECK(config_.rtp.remote_ssrc != 0);
|
||||
// TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
|
||||
RTC_DCHECK(config_.rtp.local_ssrc != 0);
|
||||
RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc);
|
||||
|
||||
rtp_rtcp_->SetRTCPStatus(config.rtp.rtcp_mode);
|
||||
rtp_rtcp_->SetSSRC(config.rtp.local_ssrc);
|
||||
rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp);
|
||||
if (config.rtp.remb) {
|
||||
rtp_rtcp_->SetREMBStatus(true);
|
||||
remb_->AddReceiveChannel(rtp_rtcp_.get());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < config.rtp.extensions.size(); ++i) {
|
||||
EnableReceiveRtpHeaderExtension(config.rtp.extensions[i].name,
|
||||
config.rtp.extensions[i].id);
|
||||
}
|
||||
|
||||
static const int kMaxPacketAgeToNack = 450;
|
||||
NACKMethod nack_method =
|
||||
@ -118,26 +139,63 @@ RtpStreamReceiver::RtpStreamReceiver(
|
||||
? kMaxPacketAgeToNack : kDefaultMaxReorderingThreshold;
|
||||
rtp_receiver_->SetNACKStatus(nack_method);
|
||||
rtp_receive_statistics_->SetMaxReorderingThreshold(max_reordering_threshold);
|
||||
|
||||
// TODO(pbos): Support multiple RTX, per video payload.
|
||||
for (const auto& kv : config_.rtp.rtx) {
|
||||
RTC_DCHECK(kv.second.ssrc != 0);
|
||||
RTC_DCHECK(kv.second.payload_type != 0);
|
||||
|
||||
rtp_payload_registry_.SetRtxSsrc(kv.second.ssrc);
|
||||
rtp_payload_registry_.SetRtxPayloadType(kv.second.payload_type,
|
||||
kv.first);
|
||||
}
|
||||
|
||||
// If set to true, the RTX payload type mapping supplied in
|
||||
// |SetRtxPayloadType| will be used when restoring RTX packets. Without it,
|
||||
// RTX packets will always be restored to the last non-RTX packet payload type
|
||||
// received.
|
||||
// TODO(holmer): When Chrome no longer depends on this being false by default,
|
||||
// always use the mapping and remove this whole codepath.
|
||||
rtp_payload_registry_.set_use_rtx_payload_mapping_on_restore(
|
||||
config_.rtp.use_rtx_payload_mapping_on_restore);
|
||||
|
||||
if (IsFecEnabled()) {
|
||||
VideoCodec ulpfec_codec = {};
|
||||
ulpfec_codec.codecType = kVideoCodecULPFEC;
|
||||
strncpy(ulpfec_codec.plName, "ulpfec", sizeof(ulpfec_codec.plName));
|
||||
ulpfec_codec.plType = config_.rtp.fec.ulpfec_payload_type;
|
||||
RTC_CHECK(SetReceiveCodec(ulpfec_codec));
|
||||
|
||||
VideoCodec red_codec = {};
|
||||
red_codec.codecType = kVideoCodecRED;
|
||||
strncpy(red_codec.plName, "red", sizeof(red_codec.plName));
|
||||
red_codec.plType = config_.rtp.fec.red_payload_type;
|
||||
RTC_CHECK(SetReceiveCodec(red_codec));
|
||||
if (config_.rtp.fec.red_rtx_payload_type != -1) {
|
||||
rtp_payload_registry_.SetRtxPayloadType(
|
||||
config_.rtp.fec.red_rtx_payload_type,
|
||||
config_.rtp.fec.red_payload_type);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.rtp.rtcp_xr.receiver_reference_time_report)
|
||||
rtp_rtcp_->SetRtcpXrRrtrStatus(true);
|
||||
|
||||
// Stats callback for CNAME changes.
|
||||
rtp_rtcp_->RegisterRtcpStatisticsCallback(receive_stats_proxy);
|
||||
|
||||
process_thread_->RegisterModule(rtp_receive_statistics_.get());
|
||||
process_thread_->RegisterModule(rtp_rtcp_.get());
|
||||
}
|
||||
|
||||
RtpStreamReceiver::~RtpStreamReceiver() {
|
||||
packet_router_->RemoveRtpModule(rtp_rtcp_.get());
|
||||
UpdateHistograms();
|
||||
}
|
||||
process_thread_->DeRegisterModule(rtp_receive_statistics_.get());
|
||||
process_thread_->DeRegisterModule(rtp_rtcp_.get());
|
||||
|
||||
void RtpStreamReceiver::UpdateHistograms() {
|
||||
FecPacketCounter counter = fec_receiver_->GetPacketCounter();
|
||||
if (counter.num_packets > 0) {
|
||||
RTC_LOGGED_HISTOGRAM_PERCENTAGE(
|
||||
"WebRTC.Video.ReceivedFecPacketsInPercent",
|
||||
static_cast<int>(counter.num_fec_packets * 100 / counter.num_packets));
|
||||
}
|
||||
if (counter.num_fec_packets > 0) {
|
||||
RTC_LOGGED_HISTOGRAM_PERCENTAGE(
|
||||
"WebRTC.Video.RecoveredMediaPacketsInPercentOfFec",
|
||||
static_cast<int>(counter.num_recovered_packets * 100 /
|
||||
counter.num_fec_packets));
|
||||
}
|
||||
packet_router_->RemoveRtpModule(rtp_rtcp_.get());
|
||||
rtp_rtcp_->SetREMBStatus(false);
|
||||
remb_->RemoveReceiveChannel(rtp_rtcp_.get());
|
||||
UpdateHistograms();
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::SetReceiveCodec(const VideoCodec& video_codec) {
|
||||
@ -153,28 +211,6 @@ bool RtpStreamReceiver::SetReceiveCodec(const VideoCodec& video_codec) {
|
||||
0, 0) == 0;
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::SetRtxPayloadType(int payload_type,
|
||||
int associated_payload_type) {
|
||||
rtp_payload_registry_.SetRtxPayloadType(payload_type,
|
||||
associated_payload_type);
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::SetUseRtxPayloadMappingOnRestore(bool val) {
|
||||
rtp_payload_registry_.set_use_rtx_payload_mapping_on_restore(val);
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::SetRtxSsrc(uint32_t ssrc) {
|
||||
rtp_payload_registry_.SetRtxSsrc(ssrc);
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::GetRtxSsrc(uint32_t* ssrc) const {
|
||||
return rtp_payload_registry_.GetRtxSsrc(ssrc);
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::IsFecEnabled() const {
|
||||
return rtp_payload_registry_.ulpfec_payload_type() > -1;
|
||||
}
|
||||
|
||||
uint32_t RtpStreamReceiver::GetRemoteSsrc() const {
|
||||
return rtp_receiver_->SSRC();
|
||||
}
|
||||
@ -187,13 +223,6 @@ RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const {
|
||||
return rtp_receiver_.get();
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::EnableReceiveRtpHeaderExtension(
|
||||
const std::string& extension, int id) {
|
||||
RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension));
|
||||
RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
|
||||
StringToRtpExtensionType(extension), id));
|
||||
}
|
||||
|
||||
int32_t RtpStreamReceiver::OnReceivedPayloadData(
|
||||
const uint8_t* payload_data,
|
||||
const size_t payload_size,
|
||||
@ -304,6 +333,20 @@ int32_t RtpStreamReceiver::SliceLossIndicationRequest(
|
||||
static_cast<uint8_t>(picture_id));
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::IsFecEnabled() const {
|
||||
return config_.rtp.fec.red_payload_type != -1 &&
|
||||
config_.rtp.fec.ulpfec_payload_type != -1;
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::IsRetransmissionsEnabled() const {
|
||||
return config_.rtp.nack.rtp_history_ms > 0;
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::RequestPacketRetransmit(
|
||||
const std::vector<uint16_t>& sequence_numbers) {
|
||||
rtp_rtcp_->SendNack(sequence_numbers);
|
||||
}
|
||||
|
||||
int32_t RtpStreamReceiver::ResendPackets(const uint16_t* sequence_numbers,
|
||||
uint16_t length) {
|
||||
return rtp_rtcp_->SendNACK(sequence_numbers, length);
|
||||
@ -432,6 +475,11 @@ bool RtpStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet,
|
||||
return true;
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::SignalNetworkState(NetworkState state) {
|
||||
rtp_rtcp_->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode
|
||||
: RtcpMode::kOff);
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::StartReceive() {
|
||||
rtc::CritScope lock(&receive_cs_);
|
||||
receiving_ = true;
|
||||
@ -442,10 +490,6 @@ void RtpStreamReceiver::StopReceive() {
|
||||
receiving_ = false;
|
||||
}
|
||||
|
||||
ReceiveStatistics* RtpStreamReceiver::GetReceiveStatistics() const {
|
||||
return rtp_receive_statistics_.get();
|
||||
}
|
||||
|
||||
bool RtpStreamReceiver::IsPacketInOrder(const RTPHeader& header) const {
|
||||
StreamStatistician* statistician =
|
||||
rtp_receive_statistics_->GetStatistician(header.ssrc);
|
||||
@ -469,4 +513,30 @@ bool RtpStreamReceiver::IsPacketRetransmitted(const RTPHeader& header,
|
||||
return !in_order &&
|
||||
statistician->IsRetransmitOfOldPacket(header, min_rtt);
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::UpdateHistograms() {
|
||||
FecPacketCounter counter = fec_receiver_->GetPacketCounter();
|
||||
if (counter.num_packets > 0) {
|
||||
RTC_LOGGED_HISTOGRAM_PERCENTAGE(
|
||||
"WebRTC.Video.ReceivedFecPacketsInPercent",
|
||||
static_cast<int>(counter.num_fec_packets * 100 / counter.num_packets));
|
||||
}
|
||||
if (counter.num_fec_packets > 0) {
|
||||
RTC_LOGGED_HISTOGRAM_PERCENTAGE(
|
||||
"WebRTC.Video.RecoveredMediaPacketsInPercentOfFec",
|
||||
static_cast<int>(counter.num_recovered_packets * 100 /
|
||||
counter.num_fec_packets));
|
||||
}
|
||||
}
|
||||
|
||||
void RtpStreamReceiver::EnableReceiveRtpHeaderExtension(
|
||||
const std::string& extension, int id) {
|
||||
// One-byte-extension local identifiers are in the range 1-14 inclusive.
|
||||
RTC_DCHECK_GE(id, 1);
|
||||
RTC_DCHECK_LE(id, 14);
|
||||
RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension));
|
||||
RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
|
||||
StringToRtpExtensionType(extension), id));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -33,6 +33,7 @@ namespace webrtc {
|
||||
class FecReceiver;
|
||||
class PacedSender;
|
||||
class PacketRouter;
|
||||
class ProcessThread;
|
||||
class RemoteNtpTimeEstimator;
|
||||
class ReceiveStatistics;
|
||||
class ReceiveStatisticsProxy;
|
||||
@ -42,6 +43,7 @@ class RtpHeaderParser;
|
||||
class RTPPayloadRegistry;
|
||||
class RtpReceiver;
|
||||
class Transport;
|
||||
class VieRemb;
|
||||
|
||||
namespace vcm {
|
||||
class VideoReceiver;
|
||||
@ -57,31 +59,20 @@ class RtpStreamReceiver : public RtpData, public RtpFeedback,
|
||||
RtcpRttStats* rtt_stats,
|
||||
PacedSender* paced_sender,
|
||||
PacketRouter* packet_router,
|
||||
VieRemb* remb,
|
||||
const VideoReceiveStream::Config& config,
|
||||
ReceiveStatisticsProxy* receive_stats_proxy);
|
||||
ReceiveStatisticsProxy* receive_stats_proxy,
|
||||
ProcessThread* process_thread);
|
||||
~RtpStreamReceiver();
|
||||
|
||||
bool SetReceiveCodec(const VideoCodec& video_codec);
|
||||
|
||||
void SetRtxPayloadType(int payload_type, int associated_payload_type);
|
||||
// If set to true, the RTX payload type mapping supplied in
|
||||
// |SetRtxPayloadType| will be used when restoring RTX packets. Without it,
|
||||
// RTX packets will always be restored to the last non-RTX packet payload type
|
||||
// received.
|
||||
void SetUseRtxPayloadMappingOnRestore(bool val);
|
||||
void SetRtxSsrc(uint32_t ssrc);
|
||||
bool GetRtxSsrc(uint32_t* ssrc) const;
|
||||
|
||||
bool IsFecEnabled() const;
|
||||
|
||||
uint32_t GetRemoteSsrc() const;
|
||||
int GetCsrcs(uint32_t* csrcs) const;
|
||||
|
||||
RtpReceiver* GetRtpReceiver() const;
|
||||
RtpRtcp* rtp_rtcp() const { return rtp_rtcp_.get(); }
|
||||
|
||||
void EnableReceiveRtpHeaderExtension(const std::string& extension, int id);
|
||||
|
||||
void StartReceive();
|
||||
void StopReceive();
|
||||
|
||||
@ -90,6 +81,8 @@ class RtpStreamReceiver : public RtpData, public RtpFeedback,
|
||||
const PacketTime& packet_time);
|
||||
bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length);
|
||||
|
||||
void SignalNetworkState(NetworkState state);
|
||||
|
||||
// Implements RtpData.
|
||||
int32_t OnReceivedPayloadData(const uint8_t* payload_data,
|
||||
const size_t payload_size,
|
||||
@ -109,12 +102,15 @@ class RtpStreamReceiver : public RtpData, public RtpFeedback,
|
||||
int32_t RequestKeyFrame() override;
|
||||
int32_t SliceLossIndicationRequest(const uint64_t picture_id) override;
|
||||
|
||||
bool IsFecEnabled() const;
|
||||
bool IsRetransmissionsEnabled() const;
|
||||
// Don't use, still experimental.
|
||||
void RequestPacketRetransmit(const std::vector<uint16_t>& sequence_numbers);
|
||||
|
||||
// Implements VCMPacketRequestCallback.
|
||||
int32_t ResendPackets(const uint16_t* sequenceNumbers,
|
||||
uint16_t length) override;
|
||||
|
||||
ReceiveStatistics* GetReceiveStatistics() const;
|
||||
|
||||
private:
|
||||
bool ReceivePacket(const uint8_t* packet,
|
||||
size_t packet_length,
|
||||
@ -129,11 +125,15 @@ class RtpStreamReceiver : public RtpData, public RtpFeedback,
|
||||
bool IsPacketInOrder(const RTPHeader& header) const;
|
||||
bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const;
|
||||
void UpdateHistograms();
|
||||
void EnableReceiveRtpHeaderExtension(const std::string& extension, int id);
|
||||
|
||||
Clock* const clock_;
|
||||
const VideoReceiveStream::Config config_;
|
||||
vcm::VideoReceiver* const video_receiver_;
|
||||
RemoteBitrateEstimator* const remote_bitrate_estimator_;
|
||||
PacketRouter* const packet_router_;
|
||||
VieRemb* const remb_;
|
||||
ProcessThread* const process_thread_;
|
||||
|
||||
RemoteNtpTimeEstimator ntp_estimator_;
|
||||
RTPPayloadRegistry rtp_payload_registry_;
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
#include "webrtc/video/call_stats.h"
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
#include "webrtc/video/vie_remb.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -161,7 +160,6 @@ VideoReceiveStream::VideoReceiveStream(
|
||||
decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
|
||||
congestion_controller_(congestion_controller),
|
||||
call_stats_(call_stats),
|
||||
remb_(remb),
|
||||
video_receiver_(clock_, nullptr, this, this, this),
|
||||
incoming_video_stream_(config.disable_prerenderer_smoothing),
|
||||
stats_proxy_(config_, clock_),
|
||||
@ -172,93 +170,28 @@ VideoReceiveStream::VideoReceiveStream(
|
||||
call_stats_->rtcp_rtt_stats(),
|
||||
congestion_controller_->pacer(),
|
||||
congestion_controller_->packet_router(),
|
||||
remb,
|
||||
config,
|
||||
&stats_proxy_),
|
||||
&stats_proxy_,
|
||||
process_thread_),
|
||||
video_stream_decoder_(&video_receiver_,
|
||||
&rtp_stream_receiver_,
|
||||
&rtp_stream_receiver_,
|
||||
config.rtp.nack.rtp_history_ms > 0,
|
||||
rtp_stream_receiver_.IsRetransmissionsEnabled(),
|
||||
rtp_stream_receiver_.IsFecEnabled(),
|
||||
&stats_proxy_,
|
||||
&incoming_video_stream_,
|
||||
this),
|
||||
vie_sync_(&video_receiver_),
|
||||
rtp_rtcp_(rtp_stream_receiver_.rtp_rtcp()) {
|
||||
vie_sync_(&video_receiver_) {
|
||||
LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
|
||||
|
||||
RTC_DCHECK(process_thread_);
|
||||
RTC_DCHECK(congestion_controller_);
|
||||
RTC_DCHECK(call_stats_);
|
||||
RTC_DCHECK(remb_);
|
||||
RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
|
||||
<< "A stream should not be configured with RTCP disabled. This value is "
|
||||
"reserved for internal usage.";
|
||||
|
||||
// Register the channel to receive stats updates.
|
||||
call_stats_->RegisterStatsObserver(&video_stream_decoder_);
|
||||
|
||||
RTC_DCHECK(config_.rtp.remote_ssrc != 0);
|
||||
// TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
|
||||
RTC_DCHECK(config_.rtp.local_ssrc != 0);
|
||||
RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc);
|
||||
rtp_rtcp_->SetSSRC(config_.rtp.local_ssrc);
|
||||
|
||||
// TODO(pbos): Support multiple RTX, per video payload.
|
||||
for (const auto& kv : config_.rtp.rtx) {
|
||||
RTC_DCHECK(kv.second.ssrc != 0);
|
||||
RTC_DCHECK(kv.second.payload_type != 0);
|
||||
|
||||
rtp_stream_receiver_.SetRtxSsrc(kv.second.ssrc);
|
||||
rtp_stream_receiver_.SetRtxPayloadType(kv.second.payload_type, kv.first);
|
||||
}
|
||||
// TODO(holmer): When Chrome no longer depends on this being false by default,
|
||||
// always use the mapping and remove this whole codepath.
|
||||
rtp_stream_receiver_.SetUseRtxPayloadMappingOnRestore(
|
||||
config_.rtp.use_rtx_payload_mapping_on_restore);
|
||||
|
||||
if (config_.rtp.remb) {
|
||||
rtp_rtcp_->SetREMBStatus(true);
|
||||
remb_->AddReceiveChannel(rtp_rtcp_);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
|
||||
const std::string& extension = config_.rtp.extensions[i].name;
|
||||
int id = config_.rtp.extensions[i].id;
|
||||
// One-byte-extension local identifiers are in the range 1-14 inclusive.
|
||||
RTC_DCHECK_GE(id, 1);
|
||||
RTC_DCHECK_LE(id, 14);
|
||||
rtp_stream_receiver_.EnableReceiveRtpHeaderExtension(extension, id);
|
||||
}
|
||||
|
||||
if (config_.rtp.fec.ulpfec_payload_type != -1) {
|
||||
// ULPFEC without RED doesn't make sense.
|
||||
RTC_DCHECK(config_.rtp.fec.red_payload_type != -1);
|
||||
VideoCodec codec;
|
||||
memset(&codec, 0, sizeof(codec));
|
||||
codec.codecType = kVideoCodecULPFEC;
|
||||
strncpy(codec.plName, "ulpfec", sizeof(codec.plName));
|
||||
codec.plType = config_.rtp.fec.ulpfec_payload_type;
|
||||
RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
|
||||
}
|
||||
if (config_.rtp.fec.red_payload_type != -1) {
|
||||
VideoCodec codec;
|
||||
memset(&codec, 0, sizeof(codec));
|
||||
codec.codecType = kVideoCodecRED;
|
||||
strncpy(codec.plName, "red", sizeof(codec.plName));
|
||||
codec.plType = config_.rtp.fec.red_payload_type;
|
||||
RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
|
||||
if (config_.rtp.fec.red_rtx_payload_type != -1) {
|
||||
rtp_stream_receiver_.SetRtxPayloadType(
|
||||
config_.rtp.fec.red_rtx_payload_type,
|
||||
config_.rtp.fec.red_payload_type);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.rtp.rtcp_xr.receiver_reference_time_report)
|
||||
rtp_rtcp_->SetRtcpXrRrtrStatus(true);
|
||||
|
||||
// Stats callback for CNAME changes.
|
||||
rtp_rtcp_->RegisterRtcpStatisticsCallback(&stats_proxy_);
|
||||
|
||||
RTC_DCHECK(!config_.decoders.empty());
|
||||
std::set<int> decoder_payload_types;
|
||||
for (const Decoder& decoder : config_.decoders) {
|
||||
@ -272,7 +205,6 @@ VideoReceiveStream::VideoReceiveStream(
|
||||
decoder.payload_type);
|
||||
|
||||
VideoCodec codec = CreateDecoderVideoCodec(decoder);
|
||||
|
||||
RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
|
||||
RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
|
||||
&codec, num_cpu_cores, false));
|
||||
@ -282,8 +214,6 @@ VideoReceiveStream::VideoReceiveStream(
|
||||
incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms);
|
||||
incoming_video_stream_.SetExternalCallback(this);
|
||||
|
||||
process_thread_->RegisterModule(rtp_stream_receiver_.GetReceiveStatistics());
|
||||
process_thread_->RegisterModule(rtp_stream_receiver_.rtp_rtcp());
|
||||
process_thread_->RegisterModule(&video_receiver_);
|
||||
process_thread_->RegisterModule(&vie_sync_);
|
||||
}
|
||||
@ -294,9 +224,6 @@ VideoReceiveStream::~VideoReceiveStream() {
|
||||
|
||||
process_thread_->DeRegisterModule(&vie_sync_);
|
||||
process_thread_->DeRegisterModule(&video_receiver_);
|
||||
process_thread_->DeRegisterModule(rtp_stream_receiver_.rtp_rtcp());
|
||||
process_thread_->DeRegisterModule(
|
||||
rtp_stream_receiver_.GetReceiveStatistics());
|
||||
|
||||
// Deregister external decoders so they are no longer running during
|
||||
// destruction. This effectively stops the VCM since the decoder thread is
|
||||
@ -306,16 +233,13 @@ VideoReceiveStream::~VideoReceiveStream() {
|
||||
video_receiver_.RegisterExternalDecoder(nullptr, decoder.payload_type);
|
||||
|
||||
call_stats_->DeregisterStatsObserver(&video_stream_decoder_);
|
||||
rtp_rtcp_->SetREMBStatus(false);
|
||||
remb_->RemoveReceiveChannel(rtp_rtcp_);
|
||||
|
||||
congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_))
|
||||
->RemoveStream(rtp_stream_receiver_.GetRemoteSsrc());
|
||||
}
|
||||
|
||||
void VideoReceiveStream::SignalNetworkState(NetworkState state) {
|
||||
rtp_rtcp_->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode
|
||||
: RtcpMode::kOff);
|
||||
rtp_stream_receiver_.SignalNetworkState(state);
|
||||
}
|
||||
|
||||
|
||||
@ -352,13 +276,14 @@ void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine,
|
||||
int audio_channel_id) {
|
||||
if (voice_engine && audio_channel_id != -1) {
|
||||
VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine);
|
||||
vie_sync_.ConfigureSync(audio_channel_id, voe_sync_interface, rtp_rtcp_,
|
||||
vie_sync_.ConfigureSync(audio_channel_id, voe_sync_interface,
|
||||
rtp_stream_receiver_.rtp_rtcp(),
|
||||
rtp_stream_receiver_.GetRtpReceiver());
|
||||
voe_sync_interface->Release();
|
||||
return;
|
||||
} else {
|
||||
vie_sync_.ConfigureSync(-1, nullptr, rtp_stream_receiver_.rtp_rtcp(),
|
||||
rtp_stream_receiver_.GetRtpReceiver());
|
||||
}
|
||||
vie_sync_.ConfigureSync(-1, nullptr, rtp_rtcp_,
|
||||
rtp_stream_receiver_.GetRtpReceiver());
|
||||
}
|
||||
|
||||
VideoReceiveStream::Stats VideoReceiveStream::GetStats() const {
|
||||
@ -427,11 +352,11 @@ void VideoReceiveStream::Decode() {
|
||||
|
||||
void VideoReceiveStream::SendNack(
|
||||
const std::vector<uint16_t>& sequence_numbers) {
|
||||
rtp_rtcp_->SendNack(sequence_numbers);
|
||||
rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers);
|
||||
}
|
||||
|
||||
void VideoReceiveStream::RequestKeyFrame() {
|
||||
rtp_rtcp_->RequestKeyFrame();
|
||||
rtp_stream_receiver_.RequestKeyFrame();
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
@ -80,10 +80,10 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
|
||||
void SetSyncChannel(VoiceEngine* voice_engine, int audio_channel_id);
|
||||
|
||||
// NackSender
|
||||
// Implements NackSender.
|
||||
void SendNack(const std::vector<uint16_t>& sequence_numbers) override;
|
||||
|
||||
// KeyFrameRequestSender
|
||||
// Implements KeyFrameRequestSender.
|
||||
void RequestKeyFrame() override;
|
||||
|
||||
private:
|
||||
@ -100,7 +100,6 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
|
||||
CongestionController* const congestion_controller_;
|
||||
CallStats* const call_stats_;
|
||||
VieRemb* const remb_;
|
||||
|
||||
vcm::VideoReceiver video_receiver_;
|
||||
IncomingVideoStream incoming_video_stream_;
|
||||
@ -108,7 +107,6 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
RtpStreamReceiver rtp_stream_receiver_;
|
||||
VideoStreamDecoder video_stream_decoder_;
|
||||
ViESyncModule vie_sync_;
|
||||
RtpRtcp* const rtp_rtcp_;
|
||||
|
||||
std::unique_ptr<IvfFileWriter> ivf_writer_;
|
||||
};
|
||||
|
||||
@ -32,6 +32,7 @@ VideoStreamDecoder::VideoStreamDecoder(
|
||||
VCMFrameTypeCallback* vcm_frame_type_callback,
|
||||
VCMPacketRequestCallback* vcm_packet_request_callback,
|
||||
bool enable_nack,
|
||||
bool enable_fec, // TODO(philipel): Actually use this.
|
||||
ReceiveStatisticsProxy* receive_statistics_proxy,
|
||||
IncomingVideoStream* incoming_video_stream,
|
||||
I420FrameCallback* pre_render_callback)
|
||||
|
||||
@ -57,6 +57,7 @@ class VideoStreamDecoder : public VCMReceiveCallback,
|
||||
VCMFrameTypeCallback* vcm_frame_type_callback,
|
||||
VCMPacketRequestCallback* vcm_packet_request_callback,
|
||||
bool enable_nack,
|
||||
bool enable_fec,
|
||||
ReceiveStatisticsProxy* receive_statistics_proxy,
|
||||
IncomingVideoStream* incoming_video_stream,
|
||||
I420FrameCallback* pre_render_callback);
|
||||
@ -82,7 +83,6 @@ class VideoStreamDecoder : public VCMReceiveCallback,
|
||||
int min_playout_delay_ms,
|
||||
int render_delay_ms) override;
|
||||
|
||||
|
||||
void RegisterReceiveStatisticsProxy(
|
||||
ReceiveStatisticsProxy* receive_statistics_proxy);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user