Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Unified Diff: webrtc/modules/audio_coding/neteq/tools/neteq_test.cc

Issue 2851383004: NetEqTest: Extend the callback structure (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
index 7cca0fed8abfecc5aa1b4a04566cd657461afbfb..6ff46bcd90b537c4674d953c12ab8bfb3fe173e8 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
@@ -41,11 +41,11 @@ NetEqTest::NetEqTest(const NetEq::Config& config,
const ExtDecoderMap& ext_codecs,
std::unique_ptr<NetEqInput> input,
std::unique_ptr<AudioSink> output,
- NetEqTestErrorCallback* error_callback)
+ Callbacks callbacks)
: neteq_(NetEq::Create(config, CreateBuiltinAudioDecoderFactory())),
input_(std::move(input)),
output_(std::move(output)),
- error_callback_(error_callback),
+ callbacks_(callbacks),
sample_rate_hz_(config.sample_rate_hz) {
RTC_CHECK(!config.enable_muted_state)
<< "The code does not handle enable_muted_state";
@@ -69,25 +69,37 @@ int64_t NetEqTest::Run() {
packet_data->header,
rtc::ArrayView<const uint8_t>(packet_data->payload),
static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / 1000));
- if (error != NetEq::kOK && error_callback_) {
- error_callback_->OnInsertPacketError(neteq_->LastError(), *packet_data);
+ if (error != NetEq::kOK && callbacks_.error_callback) {
AleBzk 2017/05/02 10:36:55 For sure, it's fine as it is now. Just wondering i
hlundin-webrtc 2017/05/04 12:50:07 I think we have a fair amount of the shorter form
+ callbacks_.error_callback->OnInsertPacketError(neteq_->LastError(),
+ *packet_data);
+ }
+ if (callbacks_.post_insert_packet) {
+ callbacks_.post_insert_packet->AfterInsertPacket(*packet_data,
+ neteq_.get());
AleBzk 2017/05/02 10:36:55 I wonder if there was an error for which a packet
hlundin-webrtc 2017/05/04 12:50:07 There could be. But I think we can leave that up t
}
}
// Check if it is time to get output audio.
if (input_->NextOutputEventTime() &&
time_now_ms >= *input_->NextOutputEventTime()) {
+ if (callbacks_.get_audio_callback) {
+ callbacks_.get_audio_callback->BeforeGetAudio(neteq_.get());
+ }
AudioFrame out_frame;
bool muted;
int error = neteq_->GetAudio(&out_frame, &muted);
RTC_CHECK(!muted) << "The code does not handle enable_muted_state";
if (error != NetEq::kOK) {
- if (error_callback_) {
- error_callback_->OnGetAudioError(neteq_->LastError());
+ if (callbacks_.error_callback) {
+ callbacks_.error_callback->OnGetAudioError(neteq_->LastError());
}
} else {
sample_rate_hz_ = out_frame.sample_rate_hz_;
}
+ if (callbacks_.get_audio_callback) {
+ callbacks_.get_audio_callback->AfterGetAudio(time_now_ms, out_frame,
+ muted, neteq_.get());
+ }
if (output_) {
RTC_CHECK(output_->WriteArray(

Powered by Google App Engine
This is Rietveld 408576698