blob: 46ebf18e78915f09fcef63f9e84c87d1677ba32c [file] [log] [blame]
Benjamin Wright9db8b882019-01-14 15:30:20 -08001/*
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
16namespace webrtc {
17namespace test {
18
19TEST(CallConfigUtils, MarshalUnmarshalProcessSameObject) {
Tommif6f45432022-05-20 15:21:20 +020020 VideoReceiveStreamInterface::Config recv_config(nullptr);
Benjamin Wright9db8b882019-01-14 15:30:20 -080021
Tommif6f45432022-05-20 15:21:20 +020022 VideoReceiveStreamInterface::Decoder decoder;
Benjamin Wright9db8b882019-01-14 15:30:20 -080023 decoder.payload_type = 10;
24 decoder.video_format.name = "test";
Oleh Prypin2fb79992019-02-05 09:33:54 +010025 decoder.video_format.parameters["99"] = "b";
Benjamin Wright9db8b882019-01-14 15:30:20 -080026 recv_config.decoders.push_back(decoder);
27 recv_config.render_delay_ms = 10;
Benjamin Wright9db8b882019-01-14 15:30:20 -080028 recv_config.rtp.remote_ssrc = 100;
29 recv_config.rtp.local_ssrc = 101;
30 recv_config.rtp.rtcp_mode = RtcpMode::kCompound;
Elad Alonfadb1812019-05-24 13:40:02 +020031 recv_config.rtp.lntf.enabled = false;
Benjamin Wright9db8b882019-01-14 15:30:20 -080032 recv_config.rtp.nack.rtp_history_ms = 150;
33 recv_config.rtp.red_payload_type = 50;
34 recv_config.rtp.rtx_ssrc = 1000;
35 recv_config.rtp.rtx_associated_payload_types[10] = 10;
Benjamin Wright9db8b882019-01-14 15:30:20 -080036
Tommif6f45432022-05-20 15:21:20 +020037 VideoReceiveStreamInterface::Config unmarshaled_config =
Benjamin Wright9db8b882019-01-14 15:30:20 -080038 ParseVideoReceiveStreamJsonConfig(
39 nullptr, GenerateVideoReceiveStreamJsonConfig(recv_config));
40
41 EXPECT_EQ(recv_config.decoders[0].payload_type,
42 unmarshaled_config.decoders[0].payload_type);
43 EXPECT_EQ(recv_config.decoders[0].video_format.name,
44 unmarshaled_config.decoders[0].video_format.name);
45 EXPECT_EQ(recv_config.decoders[0].video_format.parameters,
46 unmarshaled_config.decoders[0].video_format.parameters);
47 EXPECT_EQ(recv_config.render_delay_ms, unmarshaled_config.render_delay_ms);
Benjamin Wright9db8b882019-01-14 15:30:20 -080048 EXPECT_EQ(recv_config.rtp.remote_ssrc, unmarshaled_config.rtp.remote_ssrc);
49 EXPECT_EQ(recv_config.rtp.local_ssrc, unmarshaled_config.rtp.local_ssrc);
50 EXPECT_EQ(recv_config.rtp.rtcp_mode, unmarshaled_config.rtp.rtcp_mode);
Elad Alonfadb1812019-05-24 13:40:02 +020051 EXPECT_EQ(recv_config.rtp.lntf.enabled, unmarshaled_config.rtp.lntf.enabled);
Benjamin Wright9db8b882019-01-14 15:30:20 -080052 EXPECT_EQ(recv_config.rtp.nack.rtp_history_ms,
53 unmarshaled_config.rtp.nack.rtp_history_ms);
54 EXPECT_EQ(recv_config.rtp.red_payload_type,
55 unmarshaled_config.rtp.red_payload_type);
56 EXPECT_EQ(recv_config.rtp.rtx_ssrc, unmarshaled_config.rtp.rtx_ssrc);
57 EXPECT_EQ(recv_config.rtp.rtx_associated_payload_types,
58 unmarshaled_config.rtp.rtx_associated_payload_types);
Benjamin Wright9db8b882019-01-14 15:30:20 -080059}
60
61} // namespace test
62} // namespace webrtc