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:
Barry 2019-06-15 18:33:08 +08:00
commit 2d6dfc09e1

View file

@ -368,7 +368,6 @@ void Decoder::run()
goto runQuit; goto runQuit;
} }
#else #else
while (packet.size > 0) {
int gotPicture = 0; int gotPicture = 0;
int len = -1; int len = -1;
if (decodingFrame) { if (decodingFrame) {
@ -382,9 +381,6 @@ void Decoder::run()
if (gotPicture) { if (gotPicture) {
pushFrame(); pushFrame();
} }
packet.size -= len;
packet.data += len;
}
#endif #endif
if (m_recorder) { if (m_recorder) {
// we retrieve the PTS in order they were received, so they will // we retrieve the PTS in order they were received, so they will