Skip to content

Commit

Permalink
Improve silence handling
Browse files Browse the repository at this point in the history
Copy the previous analysis data instead of flagging as invalid
  • Loading branch information
jmvalin committed Feb 13, 2019
1 parent a7aa7fb commit 57092f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,11 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
tonal->mem_fill = 240 + remaining;
if (is_silence)
{
info->valid = 0;
/* On silence, copy the previous analysis. */
int prev_pos = tonal->write_pos-2;
if (prev_pos < 0)
prev_pos += DETECT_SIZE;
OPUS_COPY(info, &tonal->info[prev_pos], 1);
RESTORE_STACK;
return;
}
Expand Down

0 comments on commit 57092f9

Please sign in to comment.