This commit is contained in:
Isaac Connor 2018-01-10 14:19:47 -05:00
parent ea8d8cbc23
commit 8a85694b1c
1 changed files with 25 additions and 23 deletions

View File

@ -521,7 +521,7 @@ void VideoStore::write_audio_packet( AVPacket &pkt ) {
VideoStore::~VideoStore() {
if ( oc->pb ) {
if ( video_out_ctx->codec_id != video_in_ctx->codec_id || audio_out_codec ) {
if ( ( video_out_ctx->codec_id != video_in_ctx->codec_id ) || audio_out_codec ) {
Debug(2,"Different codecs between in and out");
// The codec queues data. We need to send a flush command and out
// whatever we get. Failures are not fatal.
@ -572,7 +572,6 @@ VideoStore::~VideoStore() {
zm_av_packet_unref(&pkt);
} // while have buffered frames
} // end if have delay capability
} // end if have buffered video
if ( audio_out_codec ) {
// The codec queues data. We need to send a flush command and out
@ -588,9 +587,11 @@ VideoStore::~VideoStore() {
avcodec_send_frame(audio_out_ctx, NULL);
while (1) {
if ( (ret = avcodec_receive_packet(audio_out_ctx, &pkt) ) < 0 ) {
if (AVERROR_EOF != ret) {
if ( AVERROR_EOF != ret ) {
Error("ERror encoding audio while flushing (%d) (%s)", ret, av_err2str(ret));
}
break;
}
#else
while (1) {
pkt.data = NULL;
@ -640,7 +641,8 @@ VideoStore::~VideoStore() {
// allocation/de-allocation constantly, or whether we can just re-use it.
// Just do a file open/close/writeheader/etc.
// What if we were only doing audio recording?
if (video_out_stream) {
if ( video_out_stream ) {
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
// We allocate and copy in newer ffmpeg, so need to free it
avcodec_free_context(&video_in_ctx);