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