File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 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 {
471471 }
472472 var dlsr uint32
473473
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 )
476477 dlsr = (delayMS / 1e3 ) << 16
477478 dlsr |= (delayMS % 1e3 ) * 65536 / 1000
478479 }
@@ -483,18 +484,16 @@ func (b *Buffer) buildReceptionReport() rtcp.ReceptionReport {
483484 TotalLost : lost ,
484485 LastSequenceNumber : extMaxSeq ,
485486 Jitter : uint32 (b .stats .Jitter ),
486- LastSenderReport : uint32 (b .lastSRNTPTime >> 16 ),
487+ LastSenderReport : uint32 (atomic . LoadUint64 ( & b .lastSRNTPTime ) >> 16 ),
487488 Delay : dlsr ,
488489 }
489490 return rr
490491}
491492
492493func (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 ())
498497}
499498
500499func (b * Buffer ) getRTCP () []rtcp.Packet {
You can’t perform that action at this time.
0 commit comments