fix: timestamp < skipts

This commit is contained in:
langhuihui
2024-09-14 14:35:27 +08:00
parent 76ad6284fd
commit 0955dc76fa
3 changed files with 14 additions and 13 deletions
+2 -1
View File
@@ -167,11 +167,12 @@ func (r *AVRingReader) ReadFrame(conf *config.Subscribe) (err error) {
}
}
r.Delay = r.Track.LastValue.Sequence - r.Value.Sequence
r.Log(context.TODO(), task.TraceLevel, r.Track.FourCC().String(), "delay", r.Delay)
r.Log(context.TODO(), task.TraceLevel, r.Track.FourCC().String(), "ts", r.Value.Timestamp, "delay", r.Delay)
return
}
func (r *AVRingReader) ResetAbsTime() {
r.SkipTs = r.Value.Timestamp
r.Info("reset absTime", "skipTs", r.SkipTs)
r.AbsTime = 1
}
+1 -1
View File
@@ -305,7 +305,7 @@ func (p *Publisher) writeAV(t *AVTrack, data IAVFrame) {
if p.Enabled(p, task.TraceLevel) {
codec := t.FourCC().String()
data := frame.Wraps[0].String()
p.Trace("write", "seq", frame.Sequence, "ts", uint32(frame.Timestamp/time.Millisecond), "codec", codec, "size", bytesIn, "data", data)
p.Trace("write", "seq", frame.Sequence, "ts0", ts, "ts", uint32(frame.Timestamp/time.Millisecond), "codec", codec, "size", bytesIn, "data", data)
}
}
+11 -11
View File
@@ -346,17 +346,17 @@ func (handler *SubscribeHandler[A, V]) Start() (err error) {
// 正常模式下或者纯音频模式下,音频开始播放
if ar != nil {
for err == nil {
switch ar.State {
case READSTATE_INIT:
if vr != nil {
ar.FirstTs = vr.FirstTs
}
case READSTATE_NORMAL:
if vr != nil {
ar.SkipTs = vr.SkipTs
}
}
//switch ar.State {
//case READSTATE_INIT:
// if vr != nil {
// ar.FirstTs = vr.FirstTs
//
// }
//case READSTATE_NORMAL:
// if vr != nil {
// ar.SkipTs = vr.SkipTs
// }
//}
if err = ar.ReadFrame(&s.Subscribe); err == nil {
if prePublisher != s.Publisher {
break