1 /*
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"
11 
12 #include <string.h>
13 
14 #include "test/gtest.h"
15 
16 namespace webrtc {
17 namespace test {
TEST(DemuxerTest,Demuxing)18 TEST(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
34