blob: ab00971089cb2e3f46dcd7ffd41e9c200d3d244a [file] [log] [blame]
Sebastian Jansson09408112018-04-24 14:41:22 +02001/*
2 * Copyright 2018 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#include "test/direct_transport.h"
Yves Gerey3e707812018-11-28 16:47:49 +010011
12#include <string.h>
13
Sebastian Jansson09408112018-04-24 14:41:22 +020014#include "test/gtest.h"
15
16namespace webrtc {
17namespace test {
18TEST(DemuxerTest, Demuxing) {
19 constexpr uint8_t kVideoPayloadType = 100;
20 constexpr uint8_t kAudioPayloadType = 101;
Danil Chapovalov00ca0042021-07-05 19:06:17 +020021 constexpr size_t kPacketSize = 12;
Sebastian Jansson09408112018-04-24 14:41:22 +020022 Demuxer demuxer({{kVideoPayloadType, MediaType::VIDEO},
23 {kAudioPayloadType, MediaType::AUDIO}});
24
25 uint8_t data[kPacketSize];
26 memset(data, 0, kPacketSize);
Danil Chapovalov00ca0042021-07-05 19:06:17 +020027 data[0] = 0x80;
Sebastian Jansson09408112018-04-24 14:41:22 +020028 data[1] = kVideoPayloadType;
29 EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::VIDEO);
30 data[1] = kAudioPayloadType;
31 EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::AUDIO);
32}
33} // namespace test
34} // namespace webrtc