Make the RtpHeaderParserImpl available to tests and tools only.
There are a few reasons for making this test only: * The code is only used by tests and utilities. * The pure interface has only a single implementation so an interface isn't really needed. (a followup change could remove it altogether) * The implementation always incorporates locking regardless of how the class gets used. See e.g. previous use in the Packet class. * The implementation is a layer on top of RtpUtility::RtpHeaderParser which is sufficient for most production cases. Change-Id: Ide6d50567cf8ae5127a2eb04cceeb10cf317ec36 Bug: none Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150658 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29010}
This commit is contained in:
@ -18,8 +18,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "modules/audio_coding/neteq/tools/packet.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "test/rtp_file_reader.h"
|
||||
|
||||
@ -49,8 +49,7 @@ RtpFileSource::~RtpFileSource() {}
|
||||
|
||||
bool RtpFileSource::RegisterRtpHeaderExtension(RTPExtensionType type,
|
||||
uint8_t id) {
|
||||
assert(parser_.get());
|
||||
return parser_->RegisterRtpHeaderExtension(type, id);
|
||||
return rtp_header_extension_map_.RegisterByType(id, type);
|
||||
}
|
||||
|
||||
std::unique_ptr<Packet> RtpFileSource::NextPacket() {
|
||||
@ -66,9 +65,11 @@ std::unique_ptr<Packet> RtpFileSource::NextPacket() {
|
||||
}
|
||||
std::unique_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]);
|
||||
memcpy(packet_memory.get(), temp_packet.data, temp_packet.length);
|
||||
std::unique_ptr<Packet> packet(new Packet(
|
||||
RtpUtility::RtpHeaderParser parser(packet_memory.get(), temp_packet.length);
|
||||
auto packet = absl::make_unique<Packet>(
|
||||
packet_memory.release(), temp_packet.length,
|
||||
temp_packet.original_length, temp_packet.time_ms, *parser_.get()));
|
||||
temp_packet.original_length, temp_packet.time_ms, parser,
|
||||
&rtp_header_extension_map_);
|
||||
if (!packet->valid_header()) {
|
||||
continue;
|
||||
}
|
||||
@ -83,7 +84,6 @@ std::unique_ptr<Packet> RtpFileSource::NextPacket() {
|
||||
|
||||
RtpFileSource::RtpFileSource(absl::optional<uint32_t> ssrc_filter)
|
||||
: PacketSource(),
|
||||
parser_(RtpHeaderParser::Create()),
|
||||
ssrc_filter_(ssrc_filter) {}
|
||||
|
||||
bool RtpFileSource::OpenFile(const std::string& file_name) {
|
||||
|
||||
Reference in New Issue
Block a user