Skip to content

Commit

Permalink
fix(mse): 一些边界条件判断修正
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohappy committed Jan 22, 2025
1 parent 0400890 commit ace2c55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/avplayer/mse/MSEPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ export default class MSEPipeline extends Pipeline {
if (resource.backPacket > 0) {
startDTS = resource.backPacket.dts
startPTS = resource.backPacket.pts
if (startTimestamp > 0n) {
if (startTimestamp > startPTS) {
cacheDuration += startTimestamp - avRescaleQ(startDTS, timeBase, AV_MILLI_TIME_BASE_Q)
}

Expand All @@ -808,7 +808,7 @@ export default class MSEPipeline extends Pipeline {
resource.backPacket = nullptr
}

while (startDTS < 0n || avRescaleQ((lastDTS - startDTS), timeBase, AV_MILLI_TIME_BASE_Q) < cacheDuration) {
while (startDTS === NOPTS_VALUE_BIGINT || avRescaleQ((lastDTS - startDTS), timeBase, AV_MILLI_TIME_BASE_Q) < cacheDuration) {
avpacket = await this.pullAVPacket(resource, task)

if (avpacket < 0) {
Expand All @@ -817,7 +817,7 @@ export default class MSEPipeline extends Pipeline {
}

lastDTS = avpacket.dts
if (startDTS < 0n) {
if (startDTS === NOPTS_VALUE_BIGINT) {
startDTS = lastDTS
startPTS = avpacket.pts
}
Expand Down

0 comments on commit ace2c55

Please sign in to comment.