Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesús de Vicente Peña <devicentepena@webrtc.org>2020-02-11 11:27:10 +0300
committerFelicia Lim <flim@google.com>2020-02-15 05:36:39 +0300
commitbe68a9ae94a1f50c8c7a22f2bdd76ab12fd71a1b (patch)
treee59e8ec448a272e4e40a497130f5163d49c627f2 /src
parent3880c5abdd8765c510ee3262d3888df848deff0c (diff)
Fix for an assertion when running the fixed point tests
Signed-off-by: Felicia Lim <flim@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/opus_encoder.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index e339d332..4a10098e 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1152,16 +1152,18 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
if (!is_silence)
st->voice_ratio = -1;
- if (analysis_info.valid) {
- activity = !is_silence &&
- analysis_info.activity_probability >= DTX_ACTIVITY_THRESHOLD;
- if (!activity) {
- opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch);
- /* do not mark as active unless is sufficiently quiet */
- activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy);
- }
- } else {
+ if (is_silence)
+ {
activity = !is_silence;
+ } else if (analysis_info.valid)
+ {
+ activity = analysis_info.activity_probability >= DTX_ACTIVITY_THRESHOLD;
+ if (!activity)
+ {
+ /* Mark as active if this noise frame is sufficiently loud */
+ opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch);
+ activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy);
+ }
}
st->detected_bandwidth = 0;