mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-18 17:16:04 +00:00
Remove useless lock in the custom track sample struct
This commit is contained in:
parent
a3d08637e0
commit
8bed364bb3
1 changed files with 1 additions and 9 deletions
|
|
@ -2,7 +2,6 @@ package webrtc
|
|||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/pion/rtp"
|
||||
"github.com/pion/rtp/codecs"
|
||||
|
|
@ -17,7 +16,6 @@ type CustomTrackSample struct {
|
|||
packetizer rtp.Packetizer
|
||||
rtpTrack *webrtc.TrackLocalStaticRTP
|
||||
clockRate float64
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
func NewCustomTrackSample(c webrtc.RTPCodecCapability, id, streamID string) (*CustomTrackSample, error) {
|
||||
|
|
@ -43,9 +41,6 @@ func (s *CustomTrackSample) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecPar
|
|||
return codec, err
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if s.packetizer != nil {
|
||||
return codec, nil
|
||||
}
|
||||
|
|
@ -72,10 +67,7 @@ func (s *CustomTrackSample) Unbind(t webrtc.TrackLocalContext) error {
|
|||
}
|
||||
|
||||
func (s *CustomTrackSample) WriteSampleWithTimestamp(sample media.Sample, timestamp uint32) (err error) {
|
||||
s.mu.RLock()
|
||||
p := s.packetizer
|
||||
clockRate := s.clockRate
|
||||
s.mu.RUnlock()
|
||||
p, clockRate := s.packetizer, s.clockRate
|
||||
|
||||
if p == nil {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue