File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -471,8 +471,9 @@ func (b *Buffer) buildReceptionReport() rtcp.ReceptionReport {
471
471
}
472
472
var dlsr uint32
473
473
474
- if b .lastSRRecv != 0 {
475
- delayMS := uint32 ((time .Now ().UnixNano () - b .lastSRRecv ) / 1e6 )
474
+ lastSRRecv := atomic .LoadInt64 (& b .lastSRRecv )
475
+ if lastSRRecv != 0 {
476
+ delayMS := uint32 ((time .Now ().UnixNano () - lastSRRecv ) / 1e6 )
476
477
dlsr = (delayMS / 1e3 ) << 16
477
478
dlsr |= (delayMS % 1e3 ) * 65536 / 1000
478
479
}
@@ -483,18 +484,16 @@ func (b *Buffer) buildReceptionReport() rtcp.ReceptionReport {
483
484
TotalLost : lost ,
484
485
LastSequenceNumber : extMaxSeq ,
485
486
Jitter : uint32 (b .stats .Jitter ),
486
- LastSenderReport : uint32 (b .lastSRNTPTime >> 16 ),
487
+ LastSenderReport : uint32 (atomic . LoadUint64 ( & b .lastSRNTPTime ) >> 16 ),
487
488
Delay : dlsr ,
488
489
}
489
490
return rr
490
491
}
491
492
492
493
func (b * Buffer ) SetSenderReportData (rtpTime uint32 , ntpTime uint64 ) {
493
- b .Lock ()
494
- b .lastSRRTPTime = rtpTime
495
- b .lastSRNTPTime = ntpTime
496
- b .lastSRRecv = time .Now ().UnixNano ()
497
- b .Unlock ()
494
+ atomic .StoreUint64 (& b .lastSRNTPTime , ntpTime )
495
+ atomic .StoreUint32 (& b .lastSRRTPTime , rtpTime )
496
+ atomic .StoreInt64 (& b .lastSRRecv , time .Now ().UnixNano ())
498
497
}
499
498
500
499
func (b * Buffer ) getRTCP () []rtcp.Packet {
You can’t perform that action at this time.
0 commit comments