Skip to content

Commit 64e5782

Browse files
committed
Reduced, but didn't eliminate empty time at the beginning
1 parent bdf6e9f commit 64e5782

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/FFmpegWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,10 +1836,6 @@ void FFmpegWriter::write_audio_packets(bool is_final) {
18361836
audio_encoder_buffer_size, 0);
18371837
}
18381838

1839-
// Increment PTS (in samples)
1840-
write_audio_count += FFMIN(audio_input_frame_size, audio_input_position);
1841-
frame_final->pts = write_audio_count; // Set the AVFrame's PTS
1842-
18431839
// Init the packet
18441840
AVPacket pkt;
18451841
av_init_packet(&pkt);
@@ -1911,6 +1907,10 @@ void FFmpegWriter::write_audio_packets(bool is_final) {
19111907
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_audio_packets ERROR [" + (std::string) av_err2str(error_code) + "]", "error_code", error_code);
19121908
}
19131909

1910+
// Increment PTS (in samples)
1911+
write_audio_count += FFMIN(audio_input_frame_size, audio_input_position);
1912+
frame_final->pts = write_audio_count; // Set the AVFrame's PTS
1913+
19141914
// deallocate AVFrame
19151915
av_freep(&(frame_final->data[0]));
19161916
AV_FREE_FRAME(&frame_final);

0 commit comments

Comments
 (0)