Adds setup of RTP Extensions in Scenario tests.

This prevents printing warning messages when the extensions aren't
found. The real parsing is done deeper in the stack and is unaffected.

Bug: webrtc:9510
Change-Id: Idf09f0e69c223bd4217be7044d21d1d0bbbdab92
Reviewed-on: https://webrtc-review.googlesource.com/c/110615
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25612}
This commit is contained in:
Sebastian Jansson
2018-11-12 16:44:16 +01:00
committed by Commit Bot
parent cb7eddb955
commit fd20171d28
6 changed files with 27 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_
#define MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_
#include "api/rtpparameters.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
namespace webrtc {
@ -36,8 +37,14 @@ class RtpHeaderParser {
virtual bool RegisterRtpHeaderExtension(RTPExtensionType type,
uint8_t id) = 0;
// Registers an RTP header extension.
virtual bool RegisterRtpHeaderExtension(RtpExtension extension) = 0;
// De-registers an RTP header extension.
virtual bool DeregisterRtpHeaderExtension(RTPExtensionType type) = 0;
// De-registers an RTP header extension.
virtual bool DeregisterRtpHeaderExtension(RtpExtension extension) = 0;
};
} // namespace webrtc
#endif // MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_

View File

@ -28,8 +28,10 @@ class RtpHeaderParserImpl : public RtpHeaderParser {
RTPHeader* header) const override;
bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id) override;
bool RegisterRtpHeaderExtension(RtpExtension extension) override;
bool DeregisterRtpHeaderExtension(RTPExtensionType type) override;
bool DeregisterRtpHeaderExtension(RtpExtension extension) override;
private:
rtc::CriticalSection critical_section_;
@ -66,6 +68,10 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet,
}
return true;
}
bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RtpExtension extension) {
rtc::CritScope cs(&critical_section_);
return rtp_header_extension_map_.RegisterByUri(extension.id, extension.uri);
}
bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RTPExtensionType type,
uint8_t id) {
@ -73,6 +79,12 @@ bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RTPExtensionType type,
return rtp_header_extension_map_.RegisterByType(id, type);
}
bool RtpHeaderParserImpl::DeregisterRtpHeaderExtension(RtpExtension extension) {
rtc::CritScope cs(&critical_section_);
return rtp_header_extension_map_.Deregister(
rtp_header_extension_map_.GetType(extension.id));
}
bool RtpHeaderParserImpl::DeregisterRtpHeaderExtension(RTPExtensionType type) {
rtc::CritScope cs(&critical_section_);
return rtp_header_extension_map_.Deregister(type) == 0;

View File

@ -181,6 +181,7 @@ ReceiveAudioStream::ReceiveAudioStream(
recv_config.rtp.extensions = {
{RtpExtension::kTransportSequenceNumberUri, 8}};
}
receiver_->AddExtensions(recv_config.rtp.extensions);
recv_config.decoder_factory = decoder_factory;
recv_config.decoder_map = {
{CallTest::kAudioSendPayloadType, {"opus", 48000, 2}}};

View File

@ -209,6 +209,11 @@ std::string CallClient::GetNextPriorityId() {
return kPriorityStreamId;
}
void CallClient::AddExtensions(std::vector<RtpExtension> extensions) {
for (const auto& extension : extensions)
header_parser_->RegisterRtpHeaderExtension(extension);
}
CallClientPair::~CallClientPair() = default;
} // namespace test

View File

@ -85,6 +85,7 @@ class CallClient : public NetworkReceiverInterface {
uint32_t GetNextAudioSsrc();
uint32_t GetNextRtxSsrc();
std::string GetNextPriorityId();
void AddExtensions(std::vector<RtpExtension> extensions);
Clock* clock_;
LoggingNetworkControllerFactory network_controller_factory_;

View File

@ -319,6 +319,7 @@ ReceiveVideoStream::ReceiveVideoStream(CallClient* receiver,
recv_config.rtp.transport_cc = config.stream.packet_feedback;
recv_config.rtp.local_ssrc = CallTest::kReceiverLocalVideoSsrc;
recv_config.rtp.extensions = GetVideoRtpExtensions(config);
receiver_->AddExtensions(recv_config.rtp.extensions);
RTC_DCHECK(!config.stream.use_rtx ||
config.stream.nack_history_time > TimeDelta::Zero());
recv_config.rtp.nack.rtp_history_ms = config.stream.nack_history_time.ms();