Chromium Code Reviews| Index: webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h |
| diff --git a/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b84936e0394910dabf4b3f3438ef8e81a4072a62 |
| --- /dev/null |
| +++ b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h |
| @@ -0,0 +1,54 @@ |
| +/* |
| + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ |
| +#define WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ |
| + |
| +#include <map> |
| +#include "webrtc/base/timeutils.h" |
| + |
| +namespace voetest { |
| + |
| +class LoudestFilter { |
| + public: |
| + /* DecideForward() |
|
phoglund
2015/08/10 08:43:27
I think this method name is hard to understand. I
minyue-webrtc
2015/08/10 09:30:22
Good point. May I suggest ShouldPass()?
ShouldFilt
hlundin-webrtc
2015/08/10 10:50:18
I suggest ForwardThisPacket().
phoglund
2015/08/10 11:34:04
+1
minyue-webrtc
2015/08/12 14:53:23
I am a bit confused. Did we say "forward" isn't an
|
| + * Decide whether to filter out a stream. |
|
hlundin-webrtc
2015/08/10 10:50:18
"Decide whether to forward a packet."
After all, t
minyue-webrtc
2015/08/12 14:53:23
Acknowledged.
|
| + * |
| + * Input: |
| + * source_ssrc : SSRC of the stream, |
| + * audio_level : audio level (smaller is louder). |
| + */ |
| + bool DecideForward(unsigned int source_ssrc, int audio_level); |
| + |
| + private: |
| + struct Status { |
| + void Set(int audio_level, uint32 last_time_ms) { |
| + audio_level_ = audio_level; |
|
hlundin-webrtc
2015/08/10 10:50:17
Data members of structs don't have a trailing unde
minyue-webrtc
2015/08/12 14:53:23
Acknowledged.
|
| + last_time_ms_ = last_time_ms; |
| + } |
| + int audio_level_; |
| + uint32 last_time_ms_; |
|
hlundin-webrtc
2015/08/10 10:50:18
int
minyue-webrtc
2015/08/12 14:53:23
Done.
|
| + }; |
| + |
| + void RemoveTimeoutStreams(uint32 time_ms); |
|
hlundin-webrtc
2015/08/10 10:50:17
int
minyue-webrtc
2015/08/12 14:53:23
Done.
|
| + unsigned int FindQuietestStream(); |
| + |
| + // Keeps the streams being forwarded in pair<SSRC, Status>. |
| + std::map<unsigned int, Status> stream_levels_; |
| + |
| + const int32 kStreamTimeOutMs = 5000; |
|
hlundin-webrtc
2015/08/10 10:50:17
const int
minyue-webrtc
2015/08/12 14:53:23
Done.
|
| + const size_t kMaxMixSize = 3; |
| + const int kInvalidAudioLevel = 128; |
| +}; |
| + |
| + |
| +} // namespace voetest |
| + |
| +#endif // WEBRTC_VOICE_ENGINE_TEST_AUTO_TEST_FAKES_LOUDEST_FILTER_H_ |