Commented calling _EncodeVideoFrame() with NULL.

As Adrian suggested, it's not only inefficient to do that there, but also wrong.
Modified the TODO comment
Added a new TODO comment
This commit is contained in:
JackBurton79 2018-08-09 10:44:22 +02:00
parent f049e59f50
commit 373832ae60

View File

@ -649,6 +649,7 @@ AVCodecEncoder::_EncodeAudio(const uint8* buffer, size_t bufferSize,
if (fCodecContext->coded_frame) { if (fCodecContext->coded_frame) {
// Store information about the coded frame in the context. // Store information about the coded frame in the context.
fCodecContext->coded_frame->pts = packet.pts; fCodecContext->coded_frame->pts = packet.pts;
// TODO: double "!" operator ?
fCodecContext->coded_frame->key_frame = !!(packet.flags & AV_PKT_FLAG_KEY); fCodecContext->coded_frame->key_frame = !!(packet.flags & AV_PKT_FLAG_KEY);
} }
@ -709,12 +710,13 @@ AVCodecEncoder::_EncodeVideo(const void* buffer, int64 frameCount,
} }
} }
// Pass a NULL AVFrame and enter "draining" mode, then flush buffers // TODO: we should pass a NULL AVFrame and enter "draining" mode, then flush buffers
// before restarting encoding, again. // when we have finished and there is no more data. We cannot do that here, though, since
// TODO: It's probably not very efficient to do it like this. We should // 1. It's not efficient
// do this only when there is no more data (when closing the "stream") // 2. It's incorrect, since many codecs need the "next" frame to be able to do optimization.
_EncodeVideoFrame(NULL, pkt, info); // if we drain the codec, they cannot work with the "next" frame.
avcodec_flush_buffers(fCodecContext); //_EncodeVideoFrame(NULL, pkt, info);
//avcodec_flush_buffers(fCodecContext);
av_packet_free(&pkt); av_packet_free(&pkt);
return ret; return ret;
} }