Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/tools/neteq_test.h |
| diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_test.h b/webrtc/modules/audio_coding/neteq/tools/neteq_test.h |
| index 619626cf144a562e0156fe401f20b0956b75957d..e4d3996e90cace9f4d86fdcc3a551e7d3de64965 100644 |
| --- a/webrtc/modules/audio_coding/neteq/tools/neteq_test.h |
| +++ b/webrtc/modules/audio_coding/neteq/tools/neteq_test.h |
| @@ -37,6 +37,23 @@ class DefaultNetEqTestErrorCallback : public NetEqTestErrorCallback { |
| void OnGetAudioError(int error_code) override; |
| }; |
| +class NetEqPostInsertPacket { |
| + public: |
| + virtual ~NetEqPostInsertPacket() = default; |
| + virtual void AfterInsertPacket(const NetEqInput::PacketData& packet, |
|
ivoc
2017/05/02 11:31:42
Why no BeforeInsertPacket? Not useful?
hlundin-webrtc
2017/05/04 12:50:07
Not at the moment. Easy enough to add if needed.
|
| + NetEq* neteq) = 0; |
|
ivoc
2017/05/02 11:31:42
Shouldn't this be a const reference as well? Or is
hlundin-webrtc
2017/05/04 12:50:07
The callback object may want to poll NetEq for sta
|
| +}; |
| + |
| +class NetEqGetAudioCallback { |
| + public: |
| + virtual ~NetEqGetAudioCallback() = default; |
| + virtual void BeforeGetAudio(NetEq* neteq) = 0; |
| + virtual void AfterGetAudio(int64_t time_now_ms, |
| + const AudioFrame& audio_frame, |
| + bool muted, |
| + NetEq* neteq) = 0; |
| +}; |
| + |
| // Class that provides an input--output test for NetEq. The input (both packets |
| // and output events) is provided by a NetEqInput object, while the output is |
| // directed to an AudioSink object. |
| @@ -52,6 +69,12 @@ class NetEqTest { |
| using ExtDecoderMap = std::map<int, ExternalDecoderInfo>; |
| + struct Callbacks { |
| + NetEqTestErrorCallback* error_callback = nullptr; |
| + NetEqPostInsertPacket* post_insert_packet = nullptr; |
| + NetEqGetAudioCallback* get_audio_callback = nullptr; |
| + }; |
| + |
| // Sets up the test with given configuration, codec mappings, input, ouput, |
| // and callback objects for error reporting. |
| NetEqTest(const NetEq::Config& config, |
| @@ -59,7 +82,7 @@ class NetEqTest { |
| const ExtDecoderMap& ext_codecs, |
| std::unique_ptr<NetEqInput> input, |
| std::unique_ptr<AudioSink> output, |
| - NetEqTestErrorCallback* error_callback); |
| + Callbacks callbacks); |
|
AleBzk
2017/05/02 10:36:55
Copying callbacks is fine because it's just 3 poin
hlundin-webrtc
2017/05/04 12:50:07
Yes.
|
| ~NetEqTest() = default; |
| @@ -76,7 +99,7 @@ class NetEqTest { |
| std::unique_ptr<NetEq> neteq_; |
| std::unique_ptr<NetEqInput> input_; |
| std::unique_ptr<AudioSink> output_; |
| - NetEqTestErrorCallback* error_callback_ = nullptr; |
| + Callbacks callbacks_; |
| int sample_rate_hz_; |
| }; |