OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 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_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_DELAY_ANALYZER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_DELAY_ANALYZER_H_ |
| 13 |
| 14 #include <map> |
| 15 #include <vector> |
| 16 |
| 17 #include "webrtc/base/optional.h" |
| 18 #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h" |
| 19 #include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h" |
| 20 #include "webrtc/typedefs.h" |
| 21 |
| 22 namespace webrtc { |
| 23 namespace test { |
| 24 |
| 25 class NetEqDelayAnalyzer : public test::NetEqPostInsertPacket, |
| 26 public test::NetEqGetAudioCallback { |
| 27 public: |
| 28 void AfterInsertPacket(const test::NetEqInput::PacketData& packet, |
| 29 NetEq* neteq) override; |
| 30 |
| 31 void BeforeGetAudio(NetEq* neteq) override; |
| 32 |
| 33 void AfterGetAudio(int64_t time_now_ms, |
| 34 const AudioFrame& audio_frame, |
| 35 bool muted, |
| 36 NetEq* neteq) override; |
| 37 |
| 38 void CreateGraphs(std::vector<float>* send_times_s, |
| 39 std::vector<float>* arrival_delay_ms, |
| 40 std::vector<float>* corrected_arrival_delay_ms, |
| 41 std::vector<rtc::Optional<float>>* playout_delay_ms, |
| 42 std::vector<rtc::Optional<float>>* target_delay_ms) const; |
| 43 |
| 44 private: |
| 45 struct TimingData { |
| 46 explicit TimingData(double at) : arrival_time_ms(at) {} |
| 47 double arrival_time_ms; |
| 48 rtc::Optional<int64_t> decode_get_audio_count; |
| 49 rtc::Optional<int64_t> sync_delay_ms; |
| 50 rtc::Optional<int> target_delay_ms; |
| 51 rtc::Optional<int> current_delay_ms; |
| 52 }; |
| 53 std::map<uint32_t, TimingData> data_; |
| 54 std::vector<int64_t> get_audio_time_ms_; |
| 55 size_t get_audio_count_ = 0; |
| 56 size_t last_sync_buffer_ms_ = 0; |
| 57 int last_sample_rate_hz_ = 0; |
| 58 }; |
| 59 |
| 60 } // namespace test |
| 61 } // namespace webrtc |
| 62 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_DELAY_ANALYZER_H_ |
OLD | NEW |