mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 14:20:45 +01:00

This CL moves the responsibility for demuxing from FakeNetworkPipe to DirectTransport. This makes the interface for FakeNetworkPipe more consistent. It exposes fewer different interfaces for different usages. It also means that any time degradations applied to the packets due in FakeNetworkPipe in tests will now be propagated to Call in a more realistic manner. Previously the time was set to uninitialized which meant that Call filled in values based on the system clock. Bug: webrtc:9054 Change-Id: Ie534062f5ae9ad992c06b19e43804138a35702f0 Reviewed-on: https://webrtc-review.googlesource.com/64260 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23017}
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
/*
|
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#include "test/direct_transport.h"
|
|
#include "test/gtest.h"
|
|
|
|
namespace webrtc {
|
|
namespace test {
|
|
TEST(DemuxerTest, Demuxing) {
|
|
constexpr uint8_t kVideoPayloadType = 100;
|
|
constexpr uint8_t kAudioPayloadType = 101;
|
|
constexpr size_t kPacketSize = 10;
|
|
Demuxer demuxer({{kVideoPayloadType, MediaType::VIDEO},
|
|
{kAudioPayloadType, MediaType::AUDIO}});
|
|
|
|
uint8_t data[kPacketSize];
|
|
memset(data, 0, kPacketSize);
|
|
data[1] = kVideoPayloadType;
|
|
EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::VIDEO);
|
|
data[1] = kAudioPayloadType;
|
|
EXPECT_EQ(demuxer.GetMediaType(data, kPacketSize), MediaType::AUDIO);
|
|
}
|
|
} // namespace test
|
|
} // namespace webrtc
|