ffmpeg: update statistics only when a packet is actually muxed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/54/head
Michael Niedermayer 11 years ago
parent 5c459504f6
commit d73f897669
  1. 2
      ffmpeg.c

@ -1381,7 +1381,6 @@ static void flush_encoders(void)
av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc); av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc);
exit_program(1); exit_program(1);
} }
*size += pkt.size;
if (ost->logfile && enc->stats_out) { if (ost->logfile && enc->stats_out) {
fprintf(ost->logfile, "%s", enc->stats_out); fprintf(ost->logfile, "%s", enc->stats_out);
} }
@ -1393,6 +1392,7 @@ static void flush_encoders(void)
av_free_packet(&pkt); av_free_packet(&pkt);
continue; continue;
} }
*size += pkt.size;
if (pkt.pts != AV_NOPTS_VALUE) if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
if (pkt.dts != AV_NOPTS_VALUE) if (pkt.dts != AV_NOPTS_VALUE)

Loading…
Cancel
Save