rtp_encode: Fixing bug related to DTX
Bug: webrtc:2692
Change-Id: I7b884b22cab21b9dce77e5599f43431bbc899f5d
Reviewed-on: https://webrtc-review.googlesource.com/26027
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20909}
diff --git a/modules/audio_coding/neteq/tools/rtp_encode.cc b/modules/audio_coding/neteq/tools/rtp_encode.cc
index ca475da..ddf6ed8 100644
--- a/modules/audio_coding/neteq/tools/rtp_encode.cc
+++ b/modules/audio_coding/neteq/tools/rtp_encode.cc
@@ -110,7 +110,9 @@
size_t payload_len_bytes,
const RTPFragmentationHeader* fragmentation) override {
RTC_CHECK(!fragmentation);
- RTC_DCHECK_GT(payload_len_bytes, 0);
+ if (payload_len_bytes == 0) {
+ return 0;
+ }
constexpr size_t kRtpHeaderLength = 12;
constexpr size_t kRtpDumpHeaderLength = 8;
@@ -302,7 +304,7 @@
CreateEncoder(codec_it->second.type, payload_type);
// Create an external VAD/CNG encoder if needed.
- if (FLAG_dtx && codec_it->second.internal_dtx) {
+ if (FLAG_dtx && !codec_it->second.internal_dtx) {
AudioEncoderCng::Config cng_config = GetCngConfig(codec->SampleRateHz());
RTC_DCHECK(codec);
cng_config.speech_encoder = std::move(codec);