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

Side by Side Diff: webrtc/voice_engine/test/auto_test/fakes/conference_transport.h

Issue 1236793003: Add LoudestFilter in ConferenceTransport (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: avoiding C++11 map.erase signature Created 5 years, 4 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
« no previous file with comments | « no previous file | webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 10
11 #ifndef WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_ 11 #ifndef WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_
12 #define WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_ 12 #define WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_
13 13
14 #include <deque> 14 #include <deque>
15 #include <map> 15 #include <map>
16 #include <utility> 16 #include <utility>
17 17
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "webrtc/base/basictypes.h" 19 #include "webrtc/base/basictypes.h"
20 #include "webrtc/base/scoped_ptr.h" 20 #include "webrtc/base/scoped_ptr.h"
21 #include "webrtc/common_types.h" 21 #include "webrtc/common_types.h"
22 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
22 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 23 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
23 #include "webrtc/system_wrappers/interface/event_wrapper.h" 24 #include "webrtc/system_wrappers/interface/event_wrapper.h"
24 #include "webrtc/system_wrappers/interface/thread_wrapper.h" 25 #include "webrtc/system_wrappers/interface/thread_wrapper.h"
25 #include "webrtc/voice_engine/include/voe_base.h" 26 #include "webrtc/voice_engine/include/voe_base.h"
26 #include "webrtc/voice_engine/include/voe_codec.h" 27 #include "webrtc/voice_engine/include/voe_codec.h"
27 #include "webrtc/voice_engine/include/voe_file.h" 28 #include "webrtc/voice_engine/include/voe_file.h"
28 #include "webrtc/voice_engine/include/voe_network.h" 29 #include "webrtc/voice_engine/include/voe_network.h"
29 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 30 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
30 31 #include "webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h"
31 32
32 static const size_t kMaxPacketSizeByte = 1500; 33 static const size_t kMaxPacketSizeByte = 1500;
33 34
34 namespace voetest { 35 namespace voetest {
35 36
36 // This class is to simulate a conference call. There are two Voice Engines, one 37 // This class is to simulate a conference call. There are two Voice Engines, one
37 // for local channels and the other for remote channels. There is a simulated 38 // for local channels and the other for remote channels. There is a simulated
38 // reflector, which exchanges RTCP with local channels. For simplicity, it 39 // reflector, which exchanges RTCP with local channels. For simplicity, it
39 // also uses the Voice Engine for remote channels. One can add streams by 40 // also uses the Voice Engine for remote channels. One can add streams by
40 // calling AddStream(), which creates a remote sender channel and a local 41 // calling AddStream(), which creates a remote sender channel and a local
41 // receive channel. The remote sender channel plays a file as microphone in a 42 // receive channel. The remote sender channel plays a file as microphone in a
42 // looped fashion. Received streams are mixed and played. 43 // looped fashion. Received streams are mixed and played.
43 44
44 class ConferenceTransport: public webrtc::Transport { 45 class ConferenceTransport: public webrtc::Transport {
45 public: 46 public:
46 ConferenceTransport(); 47 ConferenceTransport();
47 virtual ~ConferenceTransport(); 48 virtual ~ConferenceTransport();
48 49
49 /* SetRtt() 50 /* SetRtt()
50 * Set RTT between local channels and reflector. 51 * Set RTT between local channels and reflector.
51 * 52 *
52 * Input: 53 * Input:
53 * rtt_ms : RTT in milliseconds. 54 * rtt_ms : RTT in milliseconds.
54 */ 55 */
55 void SetRtt(unsigned int rtt_ms); 56 void SetRtt(unsigned int rtt_ms);
56 57
57 /* AddStream() 58 /* AddStream()
58 * Adds a stream in the conference. 59 * Adds a stream in the conference.
59 * 60 *
61 * Input:
62 * file_name : name of the file to be added as microphone input.
63 * format : format of the input file.
64 *
60 * Returns stream id. 65 * Returns stream id.
61 */ 66 */
62 unsigned int AddStream(); 67 unsigned int AddStream(std::string file_name, webrtc::FileFormats format);
63 68
64 /* RemoveStream() 69 /* RemoveStream()
65 * Removes a stream with specified ID from the conference. 70 * Removes a stream with specified ID from the conference.
66 * 71 *
67 * Input: 72 * Input:
68 * id : stream id. 73 * id : stream id.
69 * 74 *
70 * Returns false if the specified stream does not exist, true if succeeds. 75 * Returns false if the specified stream does not exist, true if succeeds.
71 */ 76 */
72 bool RemoveStream(unsigned int id); 77 bool RemoveStream(unsigned int id);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 uint32 send_time_ms_; 121 uint32 send_time_ms_;
117 }; 122 };
118 123
119 static bool Run(void* transport) { 124 static bool Run(void* transport) {
120 return static_cast<ConferenceTransport*>(transport)->DispatchPackets(); 125 return static_cast<ConferenceTransport*>(transport)->DispatchPackets();
121 } 126 }
122 127
123 int GetReceiverChannelForSsrc(unsigned int sender_ssrc) const; 128 int GetReceiverChannelForSsrc(unsigned int sender_ssrc) const;
124 void StorePacket(Packet::Type type, int channel, const void* data, 129 void StorePacket(Packet::Type type, int channel, const void* data,
125 size_t len); 130 size_t len);
126 void SendPacket(const Packet& packet) const; 131 void SendPacket(const Packet& packet);
127 bool DispatchPackets(); 132 bool DispatchPackets();
128 133
129 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> pq_crit_; 134 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> pq_crit_;
130 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> stream_crit_; 135 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> stream_crit_;
131 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; 136 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
132 const rtc::scoped_ptr<webrtc::ThreadWrapper> thread_; 137 const rtc::scoped_ptr<webrtc::ThreadWrapper> thread_;
133 138
134 unsigned int rtt_ms_; 139 unsigned int rtt_ms_;
135 unsigned int stream_count_; 140 unsigned int stream_count_;
136 141
137 std::map<unsigned int, std::pair<int, int>> streams_ 142 std::map<unsigned int, std::pair<int, int>> streams_
138 GUARDED_BY(stream_crit_.get()); 143 GUARDED_BY(stream_crit_.get());
139 std::deque<Packet> packet_queue_ GUARDED_BY(pq_crit_.get()); 144 std::deque<Packet> packet_queue_ GUARDED_BY(pq_crit_.get());
140 145
141 int local_sender_; // Channel Id of local sender 146 int local_sender_; // Channel Id of local sender
142 int reflector_; 147 int reflector_;
143 148
144 webrtc::VoiceEngine* local_voe_; 149 webrtc::VoiceEngine* local_voe_;
145 webrtc::VoEBase* local_base_; 150 webrtc::VoEBase* local_base_;
146 webrtc::VoERTP_RTCP* local_rtp_rtcp_; 151 webrtc::VoERTP_RTCP* local_rtp_rtcp_;
147 webrtc::VoENetwork* local_network_; 152 webrtc::VoENetwork* local_network_;
148 153
149 webrtc::VoiceEngine* remote_voe_; 154 webrtc::VoiceEngine* remote_voe_;
150 webrtc::VoEBase* remote_base_; 155 webrtc::VoEBase* remote_base_;
151 webrtc::VoECodec* remote_codec_; 156 webrtc::VoECodec* remote_codec_;
152 webrtc::VoERTP_RTCP* remote_rtp_rtcp_; 157 webrtc::VoERTP_RTCP* remote_rtp_rtcp_;
153 webrtc::VoENetwork* remote_network_; 158 webrtc::VoENetwork* remote_network_;
154 webrtc::VoEFile* remote_file_; 159 webrtc::VoEFile* remote_file_;
160
161 LoudestFilter loudest_filter_;
162
163 const rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_header_parser_;
155 }; 164 };
156 } // namespace voetest 165 } // namespace voetest
157 166
158 #endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_ 167 #endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698