Skip to content

Commit

Permalink
fix: 修复 ogg 重播 pts 不对的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohappy committed Jun 20, 2024
1 parent 3197021 commit b60da09
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/avformat/formats/IOggsFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,14 @@ export default class IOggFormat extends IFormat {
return now
}
else {

logger.debug('not found any keyframe index, try to seek in bytes')
const pointPts = avRescaleQ(timestamp, stream.timeBase, AV_MILLI_TIME_BASE_Q)
// 头十秒直接回到开始位置
if (pointPts < 10000n) {
logger.debug(`seek pts is earlier then 10s, seek to first packet pos(${this.firstPos}) directly`)
await formatContext.ioReader.seek(this.firstPos)
this.currentPts = 0n
return now
}

return seekInBytes(
formatContext,
Expand Down

0 comments on commit b60da09

Please sign in to comment.