You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
opusenc_psy: disable stereo searches for mono streams
Fixes a crash which happened when someone tried to encode mono. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
@@ -383,6 +383,10 @@ static void celt_search_for_dual_stereo(OpusPsyContext *s, CeltFrame *f)
|
|||||||
{
|
{
|
||||||
float td1, td2;
|
float td1, td2;
|
||||||
f->dual_stereo = 0;
|
f->dual_stereo = 0;
|
||||||
|
|
||||||
|
if (s->avctx->channels < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
bands_dist(s, f, &td1);
|
bands_dist(s, f, &td1);
|
||||||
f->dual_stereo = 1;
|
f->dual_stereo = 1;
|
||||||
bands_dist(s, f, &td2);
|
bands_dist(s, f, &td2);
|
||||||
@@ -396,6 +400,9 @@ static void celt_search_for_intensity(OpusPsyContext *s, CeltFrame *f)
|
|||||||
int i, best_band = CELT_MAX_BANDS - 1;
|
int i, best_band = CELT_MAX_BANDS - 1;
|
||||||
float dist, best_dist = FLT_MAX;
|
float dist, best_dist = FLT_MAX;
|
||||||
|
|
||||||
|
if (s->avctx->channels < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
/* TODO: fix, make some heuristic up here using the lambda value */
|
/* TODO: fix, make some heuristic up here using the lambda value */
|
||||||
float end_band = 0;
|
float end_band = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user