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}
diff --git a/call/BUILD.gn b/call/BUILD.gn
index dc545cd..c044a80 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -460,6 +460,7 @@
"../test:fileutils",
"../test:null_transport",
"../test:perf_test",
+ "../test:rtp_test_utils",
"../test:test_common",
"../test:test_support",
"../test:video_test_common",
diff --git a/call/call.cc b/call/call.cc
index 8771380..62a4378 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -40,9 +40,9 @@
#include "modules/congestion_controller/include/receive_side_congestion_controller.h"
#include "modules/rtp_rtcp/include/flexfec_receiver.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
-#include "modules/rtp_rtcp/include/rtp_header_parser.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
+#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "modules/utility/include/process_thread.h"
#include "modules/video_coding/fec_controller_default.h"
#include "rtc_base/checks.h"
@@ -155,6 +155,11 @@
return rtclog_config;
}
+bool IsRtcp(const uint8_t* packet, size_t length) {
+ RtpUtility::RtpHeaderParser rtp_parser(packet, length);
+ return rtp_parser.RTCP();
+}
+
} // namespace
namespace internal {
@@ -1322,7 +1327,7 @@
rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) {
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
- if (RtpHeaderParser::IsRtcp(packet.cdata(), packet.size()))
+ if (IsRtcp(packet.cdata(), packet.size()))
return DeliverRtcp(media_type, packet.cdata(), packet.size());
return DeliverRtp(media_type, std::move(packet), packet_time_us);
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 321f69c..5da1fae 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -27,7 +27,6 @@
#include "modules/audio_coding/include/audio_coding_module.h"
#include "modules/audio_device/include/test_audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
-#include "modules/rtp_rtcp/include/rtp_header_parser.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/metrics.h"
@@ -41,6 +40,7 @@
#include "test/frame_generator_capturer.h"
#include "test/gtest.h"
#include "test/null_transport.h"
+#include "test/rtp_header_parser.h"
#include "test/rtp_rtcp_observer.h"
#include "test/single_threaded_task_queue.h"
#include "test/testsupport/file_utils.h"