fix logic for location.sample_start and location.frame update, fixes audio gaps

This commit is contained in:
Nelson Ho
2017-01-07 17:59:00 -05:00
parent c33e6fa2a8
commit 2cbb722141

View File

@@ -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);