From 23bd8745c100ee368bccc0ab096499f98b06630c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 7 Aug 2020 13:40:16 +0200 Subject: [PATCH] Remove rtp test dependency on VideoCodec class Bug: None Change-Id: I4848b4bd37a6e263c787bba0851cd14c5c7b3052 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181070 Reviewed-by: Danil Chapovalov Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#31882} --- .../rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc | 18 +++++++----------- .../rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 18 +++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc index 81c71aa58e..9925c541c3 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -15,7 +15,6 @@ #include #include "api/transport/field_trial_based_config.h" -#include "api/video_codecs/video_codec.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/rtcp_packet.h" #include "modules/rtp_rtcp/source/rtcp_packet/nack.h" @@ -39,6 +38,9 @@ const int64_t kOneWayNetworkDelayMs = 100; const uint8_t kBaseLayerTid = 0; const uint8_t kHigherLayerTid = 1; const uint16_t kSequenceNumber = 100; +const uint8_t kPayloadType = 100; +const int kWidth = 320; +const int kHeight = 100; class RtcpRttStatsTestImpl : public RtcpRttStats { public: @@ -190,11 +192,6 @@ class RtpRtcpImpl2Test : public ::testing::Test { video_config.field_trials = &field_trials; sender_video_ = std::make_unique(video_config); - memset(&codec_, 0, sizeof(VideoCodec)); - codec_.plType = 100; - codec_.width = 320; - codec_.height = 180; - // Receive module. EXPECT_EQ(0, receiver_.impl_->SetSendingStatus(false)); receiver_.impl_->SetSendingMediaStatus(false); @@ -213,7 +210,6 @@ class RtpRtcpImpl2Test : public ::testing::Test { RtpRtcpModule sender_; std::unique_ptr sender_video_; RtpRtcpModule receiver_; - VideoCodec codec_; void SendFrame(const RtpRtcpModule* module, RTPSenderVideo* sender, @@ -222,8 +218,8 @@ class RtpRtcpImpl2Test : public ::testing::Test { vp8_header.temporalIdx = tid; RTPVideoHeader rtp_video_header; rtp_video_header.frame_type = VideoFrameType::kVideoFrameKey; - rtp_video_header.width = codec_.width; - rtp_video_header.height = codec_.height; + rtp_video_header.width = kWidth; + rtp_video_header.height = kHeight; rtp_video_header.rotation = kVideoRotation_0; rtp_video_header.content_type = VideoContentType::UNSPECIFIED; rtp_video_header.playout_delay = {-1, -1}; @@ -234,8 +230,8 @@ class RtpRtcpImpl2Test : public ::testing::Test { rtp_video_header.video_timing = {0u, 0u, 0u, 0u, 0u, 0u, false}; const uint8_t payload[100] = {0}; - EXPECT_TRUE(module->impl_->OnSendingRtpFrame(0, 0, codec_.plType, true)); - EXPECT_TRUE(sender->SendVideo(codec_.plType, VideoCodecType::kVideoCodecVP8, + EXPECT_TRUE(module->impl_->OnSendingRtpFrame(0, 0, kPayloadType, true)); + EXPECT_TRUE(sender->SendVideo(kPayloadType, VideoCodecType::kVideoCodecVP8, 0, 0, payload, rtp_video_header, 0)); } diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index aefa91e23e..826e4cb340 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -15,7 +15,6 @@ #include #include "api/transport/field_trial_based_config.h" -#include "api/video_codecs/video_codec.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/rtcp_packet.h" #include "modules/rtp_rtcp/source/rtcp_packet/nack.h" @@ -37,6 +36,9 @@ const int64_t kOneWayNetworkDelayMs = 100; const uint8_t kBaseLayerTid = 0; const uint8_t kHigherLayerTid = 1; const uint16_t kSequenceNumber = 100; +const uint8_t kPayloadType = 100; +const int kWidth = 320; +const int kHeight = 100; class RtcpRttStatsTestImpl : public RtcpRttStats { public: @@ -185,11 +187,6 @@ class RtpRtcpImplTest : public ::testing::Test { video_config.field_trials = &field_trials; sender_video_ = std::make_unique(video_config); - memset(&codec_, 0, sizeof(VideoCodec)); - codec_.plType = 100; - codec_.width = 320; - codec_.height = 180; - // Receive module. EXPECT_EQ(0, receiver_.impl_->SetSendingStatus(false)); receiver_.impl_->SetSendingMediaStatus(false); @@ -202,7 +199,6 @@ class RtpRtcpImplTest : public ::testing::Test { RtpRtcpModule sender_; std::unique_ptr sender_video_; RtpRtcpModule receiver_; - VideoCodec codec_; void SendFrame(const RtpRtcpModule* module, RTPSenderVideo* sender, @@ -211,8 +207,8 @@ class RtpRtcpImplTest : public ::testing::Test { vp8_header.temporalIdx = tid; RTPVideoHeader rtp_video_header; rtp_video_header.frame_type = VideoFrameType::kVideoFrameKey; - rtp_video_header.width = codec_.width; - rtp_video_header.height = codec_.height; + rtp_video_header.width = kWidth; + rtp_video_header.height = kHeight; rtp_video_header.rotation = kVideoRotation_0; rtp_video_header.content_type = VideoContentType::UNSPECIFIED; rtp_video_header.playout_delay = {-1, -1}; @@ -223,8 +219,8 @@ class RtpRtcpImplTest : public ::testing::Test { rtp_video_header.video_timing = {0u, 0u, 0u, 0u, 0u, 0u, false}; const uint8_t payload[100] = {0}; - EXPECT_TRUE(module->impl_->OnSendingRtpFrame(0, 0, codec_.plType, true)); - EXPECT_TRUE(sender->SendVideo(codec_.plType, VideoCodecType::kVideoCodecVP8, + EXPECT_TRUE(module->impl_->OnSendingRtpFrame(0, 0, kPayloadType, true)); + EXPECT_TRUE(sender->SendVideo(kPayloadType, VideoCodecType::kVideoCodecVP8, 0, 0, payload, rtp_video_header, 0)); }