Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Side by Side Diff: webrtc/test/direct_transport.cc

Issue 2794243002: Making FakeNetworkPipe demux audio and video packets. (Closed)
Patch Set: new solution Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/test/direct_transport.h" 10 #include "webrtc/test/direct_transport.h"
11 11
12 #include "webrtc/call/call.h" 12 #include "webrtc/call/call.h"
13 #include "webrtc/system_wrappers/include/clock.h" 13 #include "webrtc/system_wrappers/include/clock.h"
14 14
15 namespace webrtc { 15 namespace webrtc {
16 namespace test { 16 namespace test {
17 17
18 DirectTransport::DirectTransport(Call* send_call, MediaType media_type) 18 DirectTransport::DirectTransport(
19 : DirectTransport(FakeNetworkPipe::Config(), send_call, media_type) {} 19 Call* send_call,
20 const std::map<uint8_t, MediaType>& payload_type_map)
21 : DirectTransport(FakeNetworkPipe::Config(), send_call, payload_type_map) {}
20 22
21 DirectTransport::DirectTransport(const FakeNetworkPipe::Config& config, 23 DirectTransport::DirectTransport(
22 Call* send_call, MediaType media_type) 24 const FakeNetworkPipe::Config& config,
25 Call* send_call,
26 const std::map<uint8_t, MediaType>& payload_type_map)
23 : send_call_(send_call), 27 : send_call_(send_call),
24 packet_event_(false, false), 28 packet_event_(false, false),
25 thread_(NetworkProcess, this, "NetworkProcess"), 29 thread_(NetworkProcess, this, "NetworkProcess"),
26 clock_(Clock::GetRealTimeClock()), 30 clock_(Clock::GetRealTimeClock()),
27 shutting_down_(false), 31 shutting_down_(false),
28 fake_network_(clock_, config, media_type) { 32 fake_network_(clock_, config, payload_type_map) {
29 thread_.Start(); 33 thread_.Start();
30 if (send_call_) { 34 if (send_call_) {
31 send_call_->SignalChannelNetworkState(MediaType::AUDIO, kNetworkUp); 35 send_call_->SignalChannelNetworkState(MediaType::AUDIO, kNetworkUp);
32 send_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp); 36 send_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp);
33 } 37 }
34 } 38 }
35 39
36 DirectTransport::~DirectTransport() { StopSending(); } 40 DirectTransport::~DirectTransport() { StopSending(); }
37 41
38 void DirectTransport::SetConfig(const FakeNetworkPipe::Config& config) { 42 void DirectTransport::SetConfig(const FakeNetworkPipe::Config& config) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 fake_network_.Process(); 88 fake_network_.Process();
85 int64_t wait_time_ms = fake_network_.TimeUntilNextProcess(); 89 int64_t wait_time_ms = fake_network_.TimeUntilNextProcess();
86 if (wait_time_ms > 0) { 90 if (wait_time_ms > 0) {
87 packet_event_.Wait(static_cast<int>(wait_time_ms)); 91 packet_event_.Wait(static_cast<int>(wait_time_ms));
88 } 92 }
89 rtc::CritScope crit(&lock_); 93 rtc::CritScope crit(&lock_);
90 return shutting_down_ ? false : true; 94 return shutting_down_ ? false : true;
91 } 95 }
92 } // namespace test 96 } // namespace test
93 } // namespace webrtc 97 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698