Sebastian Jansson | 0940811 | 2018-04-24 14:41:22 +0200 | [diff] [blame] | 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 | #include "test/gtest.h" |
| 12 | |
| 13 | namespace webrtc { |
| 14 | namespace test { |
| 15 | TEST(DemuxerTest, Demuxing) { |
| 16 | constexpr uint8_t kVideoPayloadType = 100; |
| 17 | constexpr uint8_t kAudioPayloadType = 101; |
| 18 | constexpr size_t kPacketSize = 10; |
| 19 | Demuxer demuxer({{kVideoPayloadType, MediaType::VIDEO}, |
| 20 | {kAudioPayloadType, MediaType::AUDIO}}); |
| 21 | |
| 22 | uint8_t data[kPacketSize]; |
| 23 | memset(data, 0, kPacketSize); |
| 24 | data[1] = kVideoPayloadType; |
| 25 | EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::VIDEO); |
| 26 | data[1] = kAudioPayloadType; |
| 27 | EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::AUDIO); |
| 28 | } |
| 29 | } // namespace test |
| 30 | } // namespace webrtc |