Improve audio sync.
This commit is contained in:
3 files changed
+16
-7
No files matched your search
@@ -26,7 +26,9 @@
|
||||
|
||||
@interface AVFDemuxHelper : NSObject {
|
||||
@public
|
||||
#ifdef SB_AVF_DEBUG
|
||||
int64_t currentTime;
|
||||
#endif
|
||||
int64_t minDisplayOffset;
|
||||
|
||||
AVAssetReaderOutput *assetReaderOutput;
|
||||
@@ -1003,7 +1005,9 @@
|
||||
[self enqueue:sample];
|
||||
[sample release];
|
||||
|
||||
#ifdef SB_AVF_DEBUG
|
||||
demuxHelper->currentTime += duration.value;
|
||||
#endif
|
||||
currentDataLength += sampleSize;
|
||||
} else if (samplesNum > 1) {
|
||||
// The CMSampleBufferRef contains more than one sample
|
||||
@@ -1103,7 +1107,9 @@
|
||||
[self enqueue:sample];
|
||||
[sample release];
|
||||
|
||||
#ifdef SB_AVF_DEBUG
|
||||
demuxHelper->currentTime += duration.value;
|
||||
#endif
|
||||
currentDataLength += sampleSize;
|
||||
}
|
||||
else {
|
||||
@@ -1198,8 +1204,10 @@
|
||||
[demuxHelper->editsConstructor addSample:sample];
|
||||
[self enqueue:sample];
|
||||
[sample release];
|
||||
|
||||
|
||||
#ifdef SB_AVF_DEBUG
|
||||
demuxHelper->currentTime += sampleTimingInfo.duration.value;
|
||||
#endif
|
||||
currentDataLength += sampleSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +601,9 @@ static NSString * TrackNameToString(TrackInfo *track)
|
||||
mkv_ReadFrame(_matroskaFile, 0, &Track, &StartTime, &EndTime, &FilePos, &FrameSize, &FrameFlags);
|
||||
mkv_Seek(_matroskaFile, 0, 0);
|
||||
|
||||
return StartTime / SCALE_FACTOR;
|
||||
TrackInfo *trackInfo = mkv_GetTrackInfo(_matroskaFile, Id);
|
||||
|
||||
return (StartTime - trackInfo->CodecDelay) / SCALE_FACTOR;
|
||||
}
|
||||
|
||||
- (NSUInteger)timescaleForTrack:(MP42Track *)track
|
||||
|
||||
+4
-5
@@ -75,8 +75,9 @@
|
||||
|
||||
- (void)addTrack:(MP42Track *)track
|
||||
{
|
||||
if (![track isMemberOfClass:[MP42ChapterTrack class]])
|
||||
if (![track isMemberOfClass:[MP42ChapterTrack class]]) {
|
||||
[_workingTracks addObject:track];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)setup:(NSError **)outError
|
||||
@@ -594,14 +595,12 @@
|
||||
NSData *magicCookie = [track.muxer_helper->converter magicCookie];
|
||||
|
||||
if (magicCookie) {
|
||||
if (track.conversionSettings.format == kAudioFormatMPEG4AAC)
|
||||
{
|
||||
if (track.conversionSettings.format == kAudioFormatMPEG4AAC) {
|
||||
MP4SetTrackESConfiguration(_fileHandle, track.trackId,
|
||||
magicCookie.bytes,
|
||||
magicCookie.length);
|
||||
}
|
||||
else if (track.conversionSettings.format == kAudioFormatAC3)
|
||||
{
|
||||
else if (track.conversionSettings.format == kAudioFormatAC3) {
|
||||
const uint64_t *ac3Info = (const uint64_t *)magicCookie.bytes;
|
||||
|
||||
MP4SetTrackIntegerProperty(_fileHandle, track.trackId, "mdia.minf.stbl.stsd.ac-3.dac3.fscod", ac3Info[0]);
|
||||
|
||||
Reference in new issue
Block a user