Restructure neteq_rtpplay into a library with small executable wrapper.
Most of the code in neteq_rtpplay is moved into a factory class for
NetEqTest. The factory method takes the same argc and argv arguments as
neteq_rtpplay.
This CL also adds a small public API for neteq_test to allow easy
integration into external software.
Bug: webrtc:9667
Change-Id: I5241c1f51736cb6fbe47b0ad25f4bc83dabd727d
Reviewed-on: https://webrtc-review.googlesource.com/96100
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24531}
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index ddcd221..3b2bd83 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -199,10 +199,12 @@
}
} // namespace
-int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) {
+int NetEqImpl::GetAudio(AudioFrame* audio_frame,
+ bool* muted,
+ absl::optional<Operations> action_override) {
TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio");
rtc::CritScope lock(&crit_sect_);
- if (GetAudioInternal(audio_frame, muted) != 0) {
+ if (GetAudioInternal(audio_frame, muted, action_override) != 0) {
return kFail;
}
RTC_DCHECK_EQ(
@@ -798,7 +800,9 @@
return 0;
}
-int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame, bool* muted) {
+int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame,
+ bool* muted,
+ absl::optional<Operations> action_override) {
PacketList packet_list;
DtmfEvent dtmf_event;
Operations operation;
@@ -831,9 +835,8 @@
*muted = true;
return 0;
}
-
- int return_value =
- GetDecision(&operation, &packet_list, &dtmf_event, &play_dtmf);
+ int return_value = GetDecision(&operation, &packet_list, &dtmf_event,
+ &play_dtmf, action_override);
if (return_value != 0) {
last_mode_ = kModeError;
return return_value;
@@ -1021,7 +1024,8 @@
int NetEqImpl::GetDecision(Operations* operation,
PacketList* packet_list,
DtmfEvent* dtmf_event,
- bool* play_dtmf) {
+ bool* play_dtmf,
+ absl::optional<Operations> action_override) {
// Initialize output variables.
*play_dtmf = false;
*operation = kUndefined;
@@ -1093,6 +1097,10 @@
*sync_buffer_, *expand_, decoder_frame_length_, packet, last_mode_,
*play_dtmf, generated_noise_samples, &reset_decoder_);
+ if (action_override) {
+ // Use the provided action instead of the decision NetEq decided on.
+ *operation = *action_override;
+ }
// Check if we already have enough samples in the |sync_buffer_|. If so,
// change decision to normal, unless the decision was merge, accelerate, or
// preemptive expand.