Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/system_wrappers/interface/critical_section_wrapper.h" | 22 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
| 23 #include "webrtc/system_wrappers/interface/event_wrapper.h" | 23 #include "webrtc/system_wrappers/interface/event_wrapper.h" |
| 24 #include "webrtc/system_wrappers/interface/thread_wrapper.h" | 24 #include "webrtc/system_wrappers/interface/thread_wrapper.h" |
| 25 #include "webrtc/voice_engine/include/voe_base.h" | 25 #include "webrtc/voice_engine/include/voe_base.h" |
| 26 #include "webrtc/voice_engine/include/voe_codec.h" | 26 #include "webrtc/voice_engine/include/voe_codec.h" |
| 27 #include "webrtc/voice_engine/include/voe_file.h" | 27 #include "webrtc/voice_engine/include/voe_file.h" |
| 28 #include "webrtc/voice_engine/include/voe_network.h" | 28 #include "webrtc/voice_engine/include/voe_network.h" |
| 29 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 29 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
| 30 | 30 #include "webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h" |
|
tlegrand-webrtc
2015/08/05 13:32:44
CL description talks about Loudness filter, but in
minyue-webrtc
2015/08/06 13:31:22
The CL title was made wrong, and I have changed it
| |
| 31 | 31 |
| 32 static const size_t kMaxPacketSizeByte = 1500; | 32 static const size_t kMaxPacketSizeByte = 1500; |
| 33 | 33 |
| 34 namespace voetest { | 34 namespace voetest { |
| 35 | 35 |
| 36 // This class is to simulate a conference call. There are two Voice Engines, one | 36 // 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 | 37 // for local channels and the other for remote channels. There is a simulated |
| 38 // reflector, which exchanges RTCP with local channels. For simplicity, it | 38 // reflector, which exchanges RTCP with local channels. For simplicity, it |
| 39 // also uses the Voice Engine for remote channels. One can add streams by | 39 // 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 | 40 // 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 | 41 // receive channel. The remote sender channel plays a file as microphone in a |
| 42 // looped fashion. Received streams are mixed and played. | 42 // looped fashion. Received streams are mixed and played. |
| 43 | 43 |
| 44 class ConferenceTransport: public webrtc::Transport { | 44 class ConferenceTransport: public webrtc::Transport { |
| 45 public: | 45 public: |
| 46 ConferenceTransport(); | 46 ConferenceTransport(); |
| 47 virtual ~ConferenceTransport(); | 47 virtual ~ConferenceTransport(); |
| 48 | 48 |
| 49 /* SetRtt() | 49 /* SetRtt() |
| 50 * Set RTT between local channels and reflector. | 50 * Set RTT between local channels and reflector. |
| 51 * | 51 * |
| 52 * Input: | 52 * Input: |
| 53 * rtt_ms : RTT in milliseconds. | 53 * rtt_ms : RTT in milliseconds. |
| 54 */ | 54 */ |
| 55 void SetRtt(unsigned int rtt_ms); | 55 void SetRtt(unsigned int rtt_ms); |
| 56 | 56 |
| 57 /* AddStream() | 57 /* AddStream() |
| 58 * Adds a stream in the conference. | 58 * Adds a stream in the conference. |
| 59 * | 59 * |
| 60 * Input: | |
| 61 * file_name : name of the file to be added as microphone input, | |
|
tlegrand-webrtc
2015/08/05 13:32:44
Nit , -> .
minyue-webrtc
2015/08/06 13:31:22
Ok. I thought "," was more correct, since it is an
tlegrand-webrtc
2015/08/06 14:51:55
Aha. Not sure about the style guide, but I read it
| |
| 62 * format : format of the input file. | |
| 63 * | |
| 60 * Returns stream id. | 64 * Returns stream id. |
| 61 */ | 65 */ |
| 62 unsigned int AddStream(); | 66 unsigned int AddStream(std::string file_name, webrtc::FileFormats format); |
| 63 | 67 |
| 64 /* RemoveStream() | 68 /* RemoveStream() |
| 65 * Removes a stream with specified ID from the conference. | 69 * Removes a stream with specified ID from the conference. |
| 66 * | 70 * |
| 67 * Input: | 71 * Input: |
| 68 * id : stream id. | 72 * id : stream id. |
| 69 * | 73 * |
| 70 * Returns false if the specified stream does not exist, true if succeeds. | 74 * Returns false if the specified stream does not exist, true if succeeds. |
| 71 */ | 75 */ |
| 72 bool RemoveStream(unsigned int id); | 76 bool RemoveStream(unsigned int id); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 uint32 send_time_ms_; | 120 uint32 send_time_ms_; |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 static bool Run(void* transport) { | 123 static bool Run(void* transport) { |
| 120 return static_cast<ConferenceTransport*>(transport)->DispatchPackets(); | 124 return static_cast<ConferenceTransport*>(transport)->DispatchPackets(); |
| 121 } | 125 } |
| 122 | 126 |
| 123 int GetReceiverChannelForSsrc(unsigned int sender_ssrc) const; | 127 int GetReceiverChannelForSsrc(unsigned int sender_ssrc) const; |
| 124 void StorePacket(Packet::Type type, int channel, const void* data, | 128 void StorePacket(Packet::Type type, int channel, const void* data, |
| 125 size_t len); | 129 size_t len); |
| 126 void SendPacket(const Packet& packet) const; | 130 void SendPacket(const Packet& packet); |
| 127 bool DispatchPackets(); | 131 bool DispatchPackets(); |
| 128 | 132 |
| 129 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> pq_crit_; | 133 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> pq_crit_; |
| 130 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> stream_crit_; | 134 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> stream_crit_; |
| 131 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; | 135 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; |
| 132 const rtc::scoped_ptr<webrtc::ThreadWrapper> thread_; | 136 const rtc::scoped_ptr<webrtc::ThreadWrapper> thread_; |
| 133 | 137 |
| 134 unsigned int rtt_ms_; | 138 unsigned int rtt_ms_; |
| 135 unsigned int stream_count_; | 139 unsigned int stream_count_; |
| 136 | 140 |
| 137 std::map<unsigned int, std::pair<int, int>> streams_ | 141 std::map<unsigned int, std::pair<int, int>> streams_ |
| 138 GUARDED_BY(stream_crit_.get()); | 142 GUARDED_BY(stream_crit_.get()); |
| 139 std::deque<Packet> packet_queue_ GUARDED_BY(pq_crit_.get()); | 143 std::deque<Packet> packet_queue_ GUARDED_BY(pq_crit_.get()); |
| 140 | 144 |
| 141 int local_sender_; // Channel Id of local sender | 145 int local_sender_; // Channel Id of local sender |
| 142 int reflector_; | 146 int reflector_; |
| 143 | 147 |
| 144 webrtc::VoiceEngine* local_voe_; | 148 webrtc::VoiceEngine* local_voe_; |
| 145 webrtc::VoEBase* local_base_; | 149 webrtc::VoEBase* local_base_; |
| 146 webrtc::VoERTP_RTCP* local_rtp_rtcp_; | 150 webrtc::VoERTP_RTCP* local_rtp_rtcp_; |
| 147 webrtc::VoENetwork* local_network_; | 151 webrtc::VoENetwork* local_network_; |
| 148 | 152 |
| 149 webrtc::VoiceEngine* remote_voe_; | 153 webrtc::VoiceEngine* remote_voe_; |
| 150 webrtc::VoEBase* remote_base_; | 154 webrtc::VoEBase* remote_base_; |
| 151 webrtc::VoECodec* remote_codec_; | 155 webrtc::VoECodec* remote_codec_; |
| 152 webrtc::VoERTP_RTCP* remote_rtp_rtcp_; | 156 webrtc::VoERTP_RTCP* remote_rtp_rtcp_; |
| 153 webrtc::VoENetwork* remote_network_; | 157 webrtc::VoENetwork* remote_network_; |
| 154 webrtc::VoEFile* remote_file_; | 158 webrtc::VoEFile* remote_file_; |
| 159 | |
| 160 LoudestFilter loudest_filter_; | |
|
tlegrand-webrtc
2015/08/05 13:32:44
Should this be "LoudnessFilter loudness_filter" in
minyue-webrtc
2015/08/06 13:31:22
Henrik and I like Loudest better, so I changed the
tlegrand-webrtc
2015/08/06 14:51:55
Acknowledged.
| |
| 155 }; | 161 }; |
| 156 } // namespace voetest | 162 } // namespace voetest |
| 157 | 163 |
| 158 #endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_ | 164 #endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_CONFERENCE_TRANSPORT_H_ |
| OLD | NEW |