mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Migrate away from legacy rtp parser in test/
Bug: None Change-Id: I71e4a352b67a304df44454b36352285e8b11e4b5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226742 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34551}
This commit is contained in:
parent
f325ea2e2a
commit
33fdb3430d
4 changed files with 13 additions and 29 deletions
|
@ -517,6 +517,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||||
":test_support_test_artifacts",
|
":test_support_test_artifacts",
|
||||||
":video_test_common",
|
":video_test_common",
|
||||||
":video_test_support",
|
":video_test_support",
|
||||||
|
"../api:array_view",
|
||||||
"../api:create_frame_generator",
|
"../api:create_frame_generator",
|
||||||
"../api:create_simulcast_test_fixture_api",
|
"../api:create_simulcast_test_fixture_api",
|
||||||
"../api:frame_generator_api",
|
"../api:frame_generator_api",
|
||||||
|
@ -530,7 +531,6 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||||
"../call:video_stream_api",
|
"../call:video_stream_api",
|
||||||
"../common_video",
|
"../common_video",
|
||||||
"../media:rtc_media_base",
|
"../media:rtc_media_base",
|
||||||
"../modules/rtp_rtcp",
|
|
||||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||||
"../modules/video_coding:simulcast_test_fixture_impl",
|
"../modules/video_coding:simulcast_test_fixture_impl",
|
||||||
"../modules/video_coding:video_codec_interface",
|
"../modules/video_coding:video_codec_interface",
|
||||||
|
|
|
@ -21,7 +21,6 @@ if (rtc_include_tests) {
|
||||||
"../../:field_trial",
|
"../../:field_trial",
|
||||||
"../../:test_support",
|
"../../:test_support",
|
||||||
"../../../media:rtc_media_base",
|
"../../../media:rtc_media_base",
|
||||||
"../../../modules/rtp_rtcp:rtp_rtcp",
|
|
||||||
"../../../modules/rtp_rtcp:rtp_rtcp_format",
|
"../../../modules/rtp_rtcp:rtp_rtcp_format",
|
||||||
"../../../pc:rtc_pc_base",
|
"../../../pc:rtc_pc_base",
|
||||||
"../../../pc:session_description",
|
"../../../pc:session_description",
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
|
||||||
|
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
||||||
|
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_util.h"
|
#include "modules/rtp_rtcp/source/rtp_util.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
|
||||||
#include "pc/media_session.h"
|
#include "pc/media_session.h"
|
||||||
#include "pc/session_description.h"
|
#include "pc/session_description.h"
|
||||||
#include "test/field_trial.h"
|
#include "test/field_trial.h"
|
||||||
|
@ -26,19 +28,6 @@ RtpHeaderExtensionMap AudioExtensions(
|
||||||
return RtpHeaderExtensionMap(audio_desc->rtp_header_extensions());
|
return RtpHeaderExtensionMap(audio_desc->rtp_header_extensions());
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<RTPHeaderExtension> GetRtpPacketExtensions(
|
|
||||||
const rtc::ArrayView<const uint8_t> packet,
|
|
||||||
const RtpHeaderExtensionMap& extension_map) {
|
|
||||||
RtpUtility::RtpHeaderParser rtp_parser(packet.data(), packet.size());
|
|
||||||
if (IsRtpPacket(packet)) {
|
|
||||||
RTPHeader header;
|
|
||||||
if (rtp_parser.Parse(&header, &extension_map, true)) {
|
|
||||||
return header.extension;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return absl::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(RemoteEstimateEndToEnd, OfferedCapabilityIsInAnswer) {
|
TEST(RemoteEstimateEndToEnd, OfferedCapabilityIsInAnswer) {
|
||||||
|
@ -106,13 +95,10 @@ TEST(RemoteEstimateEndToEnd, AudioUsesAbsSendTimeExtension) {
|
||||||
// The dummy packets used by the fake signaling are filled with 0. We
|
// The dummy packets used by the fake signaling are filled with 0. We
|
||||||
// want to ignore those and we can do that on the basis that the first
|
// want to ignore those and we can do that on the basis that the first
|
||||||
// byte of RTP packets are guaranteed to not be 0.
|
// byte of RTP packets are guaranteed to not be 0.
|
||||||
// TODO(srte): Find a more elegant way to check for RTP traffic.
|
RtpPacket rtp_packet(&extension_map);
|
||||||
if (packet.size() > 1 && packet.cdata()[0] != 0) {
|
if (rtp_packet.Parse(packet.data)) {
|
||||||
auto extensions = GetRtpPacketExtensions(packet.data, extension_map);
|
EXPECT_TRUE(rtp_packet.HasExtension<AbsoluteSendTime>());
|
||||||
if (extensions) {
|
received_abs_send_time = true;
|
||||||
EXPECT_TRUE(extensions->hasAbsoluteSendTime);
|
|
||||||
received_abs_send_time = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RTC_CHECK(s.WaitAndProcess(&received_abs_send_time));
|
RTC_CHECK(s.WaitAndProcess(&received_abs_send_time));
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
#include "api/array_view.h"
|
||||||
|
#include "modules/rtp_rtcp/source/rtp_util.h"
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
#include "test/testsupport/file_utils.h"
|
#include "test/testsupport/file_utils.h"
|
||||||
|
|
||||||
|
@ -84,11 +85,9 @@ class TestPcapFileReader : public ::testing::Test {
|
||||||
PacketsPerSsrc pps;
|
PacketsPerSsrc pps;
|
||||||
test::RtpPacket packet;
|
test::RtpPacket packet;
|
||||||
while (rtp_packet_source_->NextPacket(&packet)) {
|
while (rtp_packet_source_->NextPacket(&packet)) {
|
||||||
RtpUtility::RtpHeaderParser rtp_header_parser(packet.data, packet.length);
|
rtc::ArrayView<const uint8_t> raw(packet.data, packet.length);
|
||||||
webrtc::RTPHeader header;
|
if (IsRtpPacket(raw)) {
|
||||||
if (!rtp_header_parser.RTCP() &&
|
pps[ParseRtpSsrc(raw)]++;
|
||||||
rtp_header_parser.Parse(&header, nullptr)) {
|
|
||||||
pps[header.ssrc]++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pps;
|
return pps;
|
||||||
|
|
Loading…
Reference in a new issue