Skip to content

Commit

Permalink
Reduced, but didn't eliminate empty time at the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonRG committed Jun 25, 2021
1 parent bdf6e9f commit 64e5782
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/FFmpegWriter.cpp
Expand Up @@ -1836,10 +1836,6 @@ void FFmpegWriter::write_audio_packets(bool is_final) {
audio_encoder_buffer_size, 0);
}

// Increment PTS (in samples)
write_audio_count += FFMIN(audio_input_frame_size, audio_input_position);
frame_final->pts = write_audio_count; // Set the AVFrame's PTS

// Init the packet
AVPacket pkt;
av_init_packet(&pkt);
Expand Down Expand Up @@ -1911,6 +1907,10 @@ void FFmpegWriter::write_audio_packets(bool is_final) {
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_audio_packets ERROR [" + (std::string) av_err2str(error_code) + "]", "error_code", error_code);
}

// Increment PTS (in samples)
write_audio_count += FFMIN(audio_input_frame_size, audio_input_position);
frame_final->pts = write_audio_count; // Set the AVFrame's PTS

// deallocate AVFrame
av_freep(&(frame_final->data[0]));
AV_FREE_FRAME(&frame_final);
Expand Down

0 comments on commit 64e5782

Please sign in to comment.