Skip to content

Commit

Permalink
SGVideoDecoder: Reset timestamp for padding frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
libobjc committed Dec 30, 2019
1 parent 59bcf46 commit a88c7d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ - (void)flush
if (frames.count == 0 &&
self->_lastDecodeFrame &&
self->_flags.outputCount == 0) {
self->_lastDecodeFrame.flags |= SGDataFlagPadding;
CMTimeRange timeRange = self->_codecDescriptor.timeRange;
if (CMTIME_IS_NUMERIC(timeRange.start) &&
CMTIME_IS_NUMERIC(timeRange.duration)) {
SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init];
cd.track = self->_lastDecodeFrame.track;
cd.metadata = self->_lastDecodeFrame.codecDescriptor.metadata;
[self->_lastDecodeFrame setCodecDescriptor:cd];
[self->_lastDecodeFrame fillWithTimeStamp:timeRange.start decodeTimeStamp:timeRange.start duration:timeRange.duration];
}
frames = @[self->_lastDecodeFrame];
[self->_lastDecodeFrame lock];
} else if (frames.count == 0 &&
Expand Down

0 comments on commit a88c7d0

Please sign in to comment.