]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve fmp4 调整时间戳避免回溯
authorqydysky <qydysky@foxmail.com>
Tue, 31 Oct 2023 14:37:33 +0000 (22:37 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 31 Oct 2023 14:37:33 +0000 (22:37 +0800)
Reply/fmp4Decode.go

index 21e5620aad92f42225898fc9142e2d2fe6e0ff62..9a4a5d184309de82d2bd94bc7dff064a649eb48d 100644 (file)
@@ -4,7 +4,6 @@ import (
        "bytes"
        "errors"
        "io"
-       "math"
 
        "github.com/dustin/go-humanize"
        F "github.com/qydysky/bili_danmu/F"
@@ -330,7 +329,7 @@ func (t *Fmp4Decoder) Search_stream_fmp4(buf []byte, keyframe *slice.Buf[byte])
                                }
 
                                //sync audio timeStamp
-                               if diff := math.Abs(audio.getT() - video.getT()); diff > 0.00001 {
+                               if diff := video.getT() - audio.getT(); diff > 0.00001 {
                                        date := F.Itob64(int64(video.getT() * float64(audio.firstTimeStamp)))
                                        copy(audio.data, date)
                                }