Fix recording with old decoding/encoding API
The deprecated avcodec_decode_video2() should always the whole packet, so there is no need to loop (cf doc/examples/demuxing_decoding.c in FFmpeg). This hack changed the packet size and data pointer. This broke recording which used the same packet.
This commit is contained in:
parent
84270e2d18
commit
bcd4090d51
1 changed files with 9 additions and 13 deletions
|
@ -237,19 +237,15 @@ static int run_decoder(void *data) {
|
||||||
goto run_quit;
|
goto run_quit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while (packet.size > 0) {
|
int got_picture;
|
||||||
int got_picture;
|
int len = avcodec_decode_video2(codec_ctx, decoder->video_buffer->decoding_frame, &got_picture, &packet);
|
||||||
int len = avcodec_decode_video2(codec_ctx, decoder->video_buffer->decoding_frame, &got_picture, &packet);
|
if (len < 0) {
|
||||||
if (len < 0) {
|
LOGE("Could not decode video packet: %d", len);
|
||||||
LOGE("Could not decode video packet: %d", len);
|
av_packet_unref(&packet);
|
||||||
av_packet_unref(&packet);
|
goto run_quit;
|
||||||
goto run_quit;
|
}
|
||||||
}
|
if (got_picture) {
|
||||||
if (got_picture) {
|
push_frame(decoder);
|
||||||
push_frame(decoder);
|
|
||||||
}
|
|
||||||
packet.size -= len;
|
|
||||||
packet.data += len;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue