Commit 55b59fab authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Vittorio Giovara

roqaudio: Always use the frame buffer on flush

Prevent NULL dereference.

CC: libav-stable@libav.org
Bug-Id: CID 703669
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 0562887a
...@@ -147,15 +147,16 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -147,15 +147,16 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
context->input_frames++; context->input_frames++;
return 0; return 0;
} }
in = context->frame_buffer;
} }
if (context->input_frames < 8)
in = context->frame_buffer;
if (stereo) { if (stereo) {
context->lastSample[0] &= 0xFF00; context->lastSample[0] &= 0xFF00;
context->lastSample[1] &= 0xFF00; context->lastSample[1] &= 0xFF00;
} }
if (context->input_frames == 7 || !in) if (context->input_frames == 7)
data_size = avctx->channels * context->buffered_samples; data_size = avctx->channels * context->buffered_samples;
else else
data_size = avctx->channels * avctx->frame_size; data_size = avctx->channels * avctx->frame_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment