Skip to content

Commit

Permalink
[Recorder] audio buffer grouping logic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YuAo committed Feb 15, 2022
1 parent aa5b7f9 commit b2af9fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/VideoIO/MultitrackMovieRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public final class MultitrackMovieRecorder {
guard self.pendingAudioSampleBuffers.count > 0 else {
return
}
let (groupsToBeAppended, pendingGroups) = pendingAudioSampleBuffers.stableGroup(using: { $0.endTime >= lastVideoSampleTime })
let (groupsToBeAppended, pendingGroups) = pendingAudioSampleBuffers.stableGroup(using: { $0.endTime <= lastVideoSampleTime })
for group in groupsToBeAppended {
try self.appendAudioSampleBufferGroup(group)
}
Expand All @@ -431,7 +431,7 @@ public final class MultitrackMovieRecorder {

private func tryAppendingAudioSampleBufferGroup(_ group: SampleBufferGroup) throws {
dispatchPrecondition(condition: .onQueue(self.queue))
if group.endTime >= self.lastVideoSampleTime {
if group.endTime > self.lastVideoSampleTime {
self.pendingAudioSampleBuffers.append(group)
} else {
try self.appendAudioSampleBufferGroup(group)
Expand Down

0 comments on commit b2af9fe

Please sign in to comment.