blob: 66ab5bcac1358c811a864fccd8640aadc9b4896f [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;
21 constexpr size_t kPacketSize = 10;
22 Demuxer demuxer({{kVideoPayloadType, MediaType::VIDEO},
23 {kAudioPayloadType, MediaType::AUDIO}});
24
25 uint8_t data[kPacketSize];
26 memset(data, 0, kPacketSize);
27 data[1] = kVideoPayloadType;
28 EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::VIDEO);
29 data[1] = kAudioPayloadType;
30 EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::AUDIO);
31}
32} // namespace test
33} // namespace webrtc