xref: /aosp_15_r20/external/webrtc/test/call_config_utils_unittest.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #include "test/call_config_utils.h"
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #include "call/video_receive_stream.h"
14*d9f75844SAndroid Build Coastguard Worker #include "test/gtest.h"
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
17*d9f75844SAndroid Build Coastguard Worker namespace test {
18*d9f75844SAndroid Build Coastguard Worker 
TEST(CallConfigUtils,MarshalUnmarshalProcessSameObject)19*d9f75844SAndroid Build Coastguard Worker TEST(CallConfigUtils, MarshalUnmarshalProcessSameObject) {
20*d9f75844SAndroid Build Coastguard Worker   VideoReceiveStreamInterface::Config recv_config(nullptr);
21*d9f75844SAndroid Build Coastguard Worker 
22*d9f75844SAndroid Build Coastguard Worker   VideoReceiveStreamInterface::Decoder decoder;
23*d9f75844SAndroid Build Coastguard Worker   decoder.payload_type = 10;
24*d9f75844SAndroid Build Coastguard Worker   decoder.video_format.name = "test";
25*d9f75844SAndroid Build Coastguard Worker   decoder.video_format.parameters["99"] = "b";
26*d9f75844SAndroid Build Coastguard Worker   recv_config.decoders.push_back(decoder);
27*d9f75844SAndroid Build Coastguard Worker   recv_config.render_delay_ms = 10;
28*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.remote_ssrc = 100;
29*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.local_ssrc = 101;
30*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.rtcp_mode = RtcpMode::kCompound;
31*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.transport_cc = false;
32*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.lntf.enabled = false;
33*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.nack.rtp_history_ms = 150;
34*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.red_payload_type = 50;
35*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.rtx_ssrc = 1000;
36*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.rtx_associated_payload_types[10] = 10;
37*d9f75844SAndroid Build Coastguard Worker   recv_config.rtp.extensions.emplace_back("uri", 128, true);
38*d9f75844SAndroid Build Coastguard Worker 
39*d9f75844SAndroid Build Coastguard Worker   VideoReceiveStreamInterface::Config unmarshaled_config =
40*d9f75844SAndroid Build Coastguard Worker       ParseVideoReceiveStreamJsonConfig(
41*d9f75844SAndroid Build Coastguard Worker           nullptr, GenerateVideoReceiveStreamJsonConfig(recv_config));
42*d9f75844SAndroid Build Coastguard Worker 
43*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.decoders[0].payload_type,
44*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.decoders[0].payload_type);
45*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.decoders[0].video_format.name,
46*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.decoders[0].video_format.name);
47*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.decoders[0].video_format.parameters,
48*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.decoders[0].video_format.parameters);
49*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.render_delay_ms, unmarshaled_config.render_delay_ms);
50*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.remote_ssrc, unmarshaled_config.rtp.remote_ssrc);
51*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.local_ssrc, unmarshaled_config.rtp.local_ssrc);
52*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.rtcp_mode, unmarshaled_config.rtp.rtcp_mode);
53*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.transport_cc, unmarshaled_config.rtp.transport_cc);
54*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.lntf.enabled, unmarshaled_config.rtp.lntf.enabled);
55*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.nack.rtp_history_ms,
56*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.rtp.nack.rtp_history_ms);
57*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.red_payload_type,
58*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.rtp.red_payload_type);
59*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.rtx_ssrc, unmarshaled_config.rtp.rtx_ssrc);
60*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.rtx_associated_payload_types,
61*d9f75844SAndroid Build Coastguard Worker             unmarshaled_config.rtp.rtx_associated_payload_types);
62*d9f75844SAndroid Build Coastguard Worker   EXPECT_EQ(recv_config.rtp.extensions, recv_config.rtp.extensions);
63*d9f75844SAndroid Build Coastguard Worker }
64*d9f75844SAndroid Build Coastguard Worker 
65*d9f75844SAndroid Build Coastguard Worker }  // namespace test
66*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
67