OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ | |
12 #define WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ | |
13 | |
14 #include <map> | |
15 #include "webrtc/common_types.h" | |
16 #include "webrtc/rtc_base/timeutils.h" | |
17 | |
18 namespace webrtc { | |
19 namespace voetest { | |
20 | |
21 class LoudestFilter { | |
22 public: | |
23 /* ForwardThisPacket() | |
24 * Decide whether to forward a RTP packet, given its header. | |
25 * | |
26 * Input: | |
27 * rtp_header : Header of the RTP packet of interest. | |
28 */ | |
29 bool ForwardThisPacket(const webrtc::RTPHeader& rtp_header); | |
30 | |
31 private: | |
32 struct Status { | |
33 void Set(int audio_level, int64_t last_time_ms) { | |
34 this->audio_level = audio_level; | |
35 this->last_time_ms = last_time_ms; | |
36 } | |
37 int audio_level; | |
38 int64_t last_time_ms; | |
39 }; | |
40 | |
41 void RemoveTimeoutStreams(int64_t time_ms); | |
42 unsigned int FindQuietestStream(); | |
43 | |
44 // Keeps the streams being forwarded in pair<SSRC, Status>. | |
45 std::map<unsigned int, Status> stream_levels_; | |
46 | |
47 const int32_t kStreamTimeOutMs = 5000; | |
48 const size_t kMaxMixSize = 3; | |
49 const int kInvalidAudioLevel = 128; | |
50 }; | |
51 | |
52 } // namespace voetest | |
53 } // namespace webrtc | |
54 | |
55 #endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ | |
OLD | NEW |