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

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

Issue 2794243002: Making FakeNetworkPipe demux audio and video packets. (Closed)
Patch Set: on other comments 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 #ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_ 10 #ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_
(...skipping 12 matching lines...) Expand all
23 23
24 namespace webrtc { 24 namespace webrtc {
25 25
26 class Clock; 26 class Clock;
27 class PacketReceiver; 27 class PacketReceiver;
28 28
29 namespace test { 29 namespace test {
30 30
31 class DirectTransport : public Transport { 31 class DirectTransport : public Transport {
32 public: 32 public:
33 DirectTransport(Call* send_call, MediaType media_type); 33 DirectTransport(Call* send_call,
34 DirectTransport(const FakeNetworkPipe::Config& config, Call* send_call, 34 const std::map<uint8_t, MediaType>& payload_type_map);
35 MediaType media_type); 35 DirectTransport(const FakeNetworkPipe::Config& config,
36 Call* send_call,
37 const std::map<uint8_t, MediaType>& payload_type_map);
38 DirectTransport(const FakeNetworkPipe::Config& config,
39 Call* send_call,
40 std::unique_ptr<Demuxer> demuxer);
41
42 // These deprecated variants always use ForceDemuxer.
43 RTC_DEPRECATED DirectTransport(Call* send_call, MediaType media_type)
44 : DirectTransport(FakeNetworkPipe::Config(), send_call, media_type) {}
45 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config,
46 Call* send_call,
47 MediaType media_type)
48 : DirectTransport(
49 config,
50 send_call,
51 std::unique_ptr<Demuxer>(new ForceDemuxer(media_type))) {}
52
36 // These deprecated variants always use MediaType::VIDEO. 53 // These deprecated variants always use MediaType::VIDEO.
37 RTC_DEPRECATED explicit DirectTransport(Call* send_call) 54 RTC_DEPRECATED explicit DirectTransport(Call* send_call)
38 : DirectTransport(send_call, MediaType::VIDEO) {} 55 : DirectTransport(send_call, MediaType::VIDEO) {}
39 56
40 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config, 57 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config,
41 Call* send_call) 58 Call* send_call)
42 : DirectTransport(config, send_call, MediaType::VIDEO) {} 59 : DirectTransport(config, send_call, MediaType::VIDEO) {}
43 60
44 ~DirectTransport(); 61 ~DirectTransport();
45 62
46 void SetConfig(const FakeNetworkPipe::Config& config); 63 void SetConfig(const FakeNetworkPipe::Config& config);
47 64
48 virtual void StopSending(); 65 virtual void StopSending();
49 // TODO(holmer): Look into moving this to the constructor. 66 // TODO(holmer): Look into moving this to the constructor.
50 virtual void SetReceiver(PacketReceiver* receiver); 67 virtual void SetReceiver(PacketReceiver* receiver);
51 68
52 bool SendRtp(const uint8_t* data, 69 bool SendRtp(const uint8_t* data,
53 size_t length, 70 size_t length,
54 const PacketOptions& options) override; 71 const PacketOptions& options) override;
55 bool SendRtcp(const uint8_t* data, size_t length) override; 72 bool SendRtcp(const uint8_t* data, size_t length) override;
56 73
57 int GetAverageDelayMs(); 74 int GetAverageDelayMs();
58 75
59 private: 76 private:
77 // TODO(minyue): remove when the deprecate ctors are removed.
stefan-webrtc 2017/04/10 07:45:26 deprecated
minyue-webrtc 2017/04/10 09:56:10 Done. and since there are several deprecated ctors
78 class ForceDemuxer : public Demuxer {
79 public:
80 explicit ForceDemuxer(MediaType media_type);
81 void SetReceiver(PacketReceiver* receiver) override;
82 void DeliverPacket(const NetworkPacket* packet,
83 const PacketTime& packet_time) override;
84
85 private:
86 const MediaType media_type_;
87 PacketReceiver* packet_receiver_;
88 RTC_DISALLOW_COPY_AND_ASSIGN(ForceDemuxer);
89 };
90
60 static bool NetworkProcess(void* transport); 91 static bool NetworkProcess(void* transport);
61 bool SendPackets(); 92 bool SendPackets();
62 93
63 rtc::CriticalSection lock_; 94 rtc::CriticalSection lock_;
64 Call* const send_call_; 95 Call* const send_call_;
65 rtc::Event packet_event_; 96 rtc::Event packet_event_;
66 rtc::PlatformThread thread_; 97 rtc::PlatformThread thread_;
67 Clock* const clock_; 98 Clock* const clock_;
68 99
69 bool shutting_down_; 100 bool shutting_down_;
70 101
71 FakeNetworkPipe fake_network_; 102 FakeNetworkPipe fake_network_;
72 }; 103 };
73 } // namespace test 104 } // namespace test
74 } // namespace webrtc 105 } // namespace webrtc
75 106
76 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ 107 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698