From 2cbb722141501205c382a5db89fa9616762dda3b Mon Sep 17 00:00:00 2001 From: Nelson Ho Date: Sat, 7 Jan 2017 17:59:00 -0500 Subject: [PATCH] fix logic for location.sample_start and location.frame update, fixes audio gaps --- src/FFmpegReader.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 6af63d87..65ed0df2 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -1472,17 +1472,8 @@ AudioLocation FFmpegReader::GetAudioPTSLocation(long int pts) int orig_start = location.sample_start; // Update sample start, to prevent gaps in audio - if (previous_packet_location.sample_start <= samples_per_frame) - { - location.sample_start = previous_packet_location.sample_start; - location.frame = previous_packet_location.frame; - } - else - { - // set to next frame (since we exceeded the # of samples on a frame) - location.sample_start = 0; - location.frame++; - } + location.sample_start = previous_packet_location.sample_start; + location.frame = previous_packet_location.frame; // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::GetAudioPTSLocation (Audio Gap Detected)", "Source Frame", orig_frame, "Source Audio Sample", orig_start, "Target Frame", location.frame, "Target Audio Sample", location.sample_start, "pts", pts, "", -1);