From 623146cfe1a06d7f7f62db612dfbf625638f916e Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Mon, 19 Jul 2021 15:43:18 +0000 Subject: [PATCH] Delete remaining usage of RtpHeaderParser test helper. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: None Change-Id: Ia4f8c5dc212f25b1a507e13955973ce4aa6a7ddc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225550 Reviewed-by: Niels Moller Reviewed-by: Björn Terelius Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#34525} --- call/BUILD.gn | 1 - call/call_perf_tests.cc | 1 - .../source/rtp_rtcp_impl2_unittest.cc | 1 - .../rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 1 - .../rtp_rtcp/source/rtp_sender_unittest.cc | 1 - test/BUILD.gn | 3 --- test/fuzzers/BUILD.gn | 5 ---- test/fuzzers/rtp_header_parser_fuzzer.cc | 26 ------------------- test/peer_scenario/tests/BUILD.gn | 1 - .../tests/unsignaled_stream_test.cc | 1 - test/rtp_header_parser.cc | 26 ------------------- test/rtp_header_parser.h | 25 ------------------ test/scenario/BUILD.gn | 1 - test/scenario/call_client.cc | 5 +--- 14 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 test/fuzzers/rtp_header_parser_fuzzer.cc delete mode 100644 test/rtp_header_parser.cc delete mode 100644 test/rtp_header_parser.h diff --git a/call/BUILD.gn b/call/BUILD.gn index 638eb0b910..04b5e50588 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -548,7 +548,6 @@ if (rtc_include_tests) { "../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_perf_tests.cc b/call/call_perf_tests.cc index c163ab2fe7..701dda7e62 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -43,7 +43,6 @@ #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/testsupport/file_utils.h" #include "test/testsupport/perf_test.h" diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc index c8ab15de78..123b68a10d 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -31,7 +31,6 @@ #include "test/gmock.h" #include "test/gtest.h" #include "test/rtcp_packet_parser.h" -#include "test/rtp_header_parser.h" #include "test/run_loop.h" #include "test/time_controller/simulated_time_controller.h" diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index ac05584e18..0902e90d51 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -24,7 +24,6 @@ #include "test/gmock.h" #include "test/gtest.h" #include "test/rtcp_packet_parser.h" -#include "test/rtp_header_parser.h" using ::testing::ElementsAre; using ::testing::Eq; diff --git a/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_unittest.cc index e9be016143..7237bee648 100644 --- a/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -40,7 +40,6 @@ #include "test/gmock.h" #include "test/gtest.h" #include "test/mock_transport.h" -#include "test/rtp_header_parser.h" #include "test/time_controller/simulated_time_controller.h" namespace webrtc { diff --git a/test/BUILD.gn b/test/BUILD.gn index 82d0b9ea28..9172eb3227 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -196,8 +196,6 @@ rtc_library("rtp_test_utils") { "rtp_file_reader.h", "rtp_file_writer.cc", "rtp_file_writer.h", - "rtp_header_parser.cc", - "rtp_header_parser.h", ] deps = [ @@ -212,7 +210,6 @@ rtc_library("rtp_test_utils") { "../rtc_base/synchronization:mutex", "../rtc_base/system:arch", ] - absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } rtc_library("field_trial") { diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 201cb49192..1561e8b845 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -618,11 +618,6 @@ webrtc_fuzzer_test("dcsctp_socket_fuzzer") { ] } -webrtc_fuzzer_test("rtp_header_parser_fuzzer") { - sources = [ "rtp_header_parser_fuzzer.cc" ] - deps = [ "../:rtp_test_utils" ] -} - webrtc_fuzzer_test("ssl_certificate_fuzzer") { sources = [ "ssl_certificate_fuzzer.cc" ] deps = [ diff --git a/test/fuzzers/rtp_header_parser_fuzzer.cc b/test/fuzzers/rtp_header_parser_fuzzer.cc deleted file mode 100644 index 435c64bbb4..0000000000 --- a/test/fuzzers/rtp_header_parser_fuzzer.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include -#include - -#include -#include -#include - -#include "test/rtp_header_parser.h" - -namespace webrtc { - -void FuzzOneInput(const uint8_t* data, size_t size) { - RtpHeaderParser::GetSsrc(data, size); -} - -} // namespace webrtc diff --git a/test/peer_scenario/tests/BUILD.gn b/test/peer_scenario/tests/BUILD.gn index a8b9c2563e..042b636690 100644 --- a/test/peer_scenario/tests/BUILD.gn +++ b/test/peer_scenario/tests/BUILD.gn @@ -19,7 +19,6 @@ if (rtc_include_tests) { deps = [ "..:peer_scenario", "../../:field_trial", - "../../:rtp_test_utils", "../../:test_support", "../../../media:rtc_media_base", "../../../modules/rtp_rtcp:rtp_rtcp", diff --git a/test/peer_scenario/tests/unsignaled_stream_test.cc b/test/peer_scenario/tests/unsignaled_stream_test.cc index e0fe02edcf..3fd3c7d288 100644 --- a/test/peer_scenario/tests/unsignaled_stream_test.cc +++ b/test/peer_scenario/tests/unsignaled_stream_test.cc @@ -17,7 +17,6 @@ #include "test/gmock.h" #include "test/gtest.h" #include "test/peer_scenario/peer_scenario.h" -#include "test/rtp_header_parser.h" namespace webrtc { namespace test { diff --git a/test/rtp_header_parser.cc b/test/rtp_header_parser.cc deleted file mode 100644 index 48e493ddeb..0000000000 --- a/test/rtp_header_parser.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#include "test/rtp_header_parser.h" - -#include "modules/rtp_rtcp/source/rtp_utility.h" - -namespace webrtc { - -absl::optional RtpHeaderParser::GetSsrc(const uint8_t* packet, - size_t length) { - RtpUtility::RtpHeaderParser rtp_parser(packet, length); - RTPHeader header; - if (rtp_parser.Parse(&header, nullptr)) { - return header.ssrc; - } - return absl::nullopt; -} - -} // namespace webrtc diff --git a/test/rtp_header_parser.h b/test/rtp_header_parser.h deleted file mode 100644 index f6ed74c043..0000000000 --- a/test/rtp_header_parser.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef TEST_RTP_HEADER_PARSER_H_ -#define TEST_RTP_HEADER_PARSER_H_ - -#include -#include - -#include "absl/types/optional.h" - -namespace webrtc { - -class RtpHeaderParser { - public: - static absl::optional GetSsrc(const uint8_t* packet, size_t length); -}; -} // namespace webrtc -#endif // TEST_RTP_HEADER_PARSER_H_ diff --git a/test/scenario/BUILD.gn b/test/scenario/BUILD.gn index a64f8317a0..561cd7b1ea 100644 --- a/test/scenario/BUILD.gn +++ b/test/scenario/BUILD.gn @@ -71,7 +71,6 @@ if (rtc_include_tests && !build_with_chromium) { ":column_printer", "../:fake_video_codecs", "../:fileutils", - "../:rtp_test_utils", "../:test_common", "../:test_support", "../:video_test_common", diff --git a/test/scenario/call_client.cc b/test/scenario/call_client.cc index be8d39f2a5..d45909c053 100644 --- a/test/scenario/call_client.cc +++ b/test/scenario/call_client.cc @@ -18,7 +18,6 @@ #include "api/transport/network_types.h" #include "modules/audio_mixer/audio_mixer_impl.h" #include "modules/rtp_rtcp/source/rtp_util.h" -#include "test/rtp_header_parser.h" namespace webrtc { namespace test { @@ -295,9 +294,7 @@ void CallClient::UpdateBitrateConstraints( void CallClient::OnPacketReceived(EmulatedIpPacket packet) { MediaType media_type = MediaType::ANY; if (IsRtpPacket(packet.data)) { - auto ssrc = RtpHeaderParser::GetSsrc(packet.cdata(), packet.data.size()); - RTC_CHECK(ssrc.has_value()); - media_type = ssrc_media_types_[*ssrc]; + media_type = ssrc_media_types_[ParseRtpSsrc(packet.data)]; } task_queue_.PostTask( [call = call_.get(), media_type, packet = std::move(packet)]() mutable {