webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Panic on SampleBuilder.Pop

Open tubzby opened this issue 11 months ago • 0 comments

Your environment.

  • Version: v3.2.40
  • Browser: NA
  • Other Information - stacktraces, related issues, suggestions how to fix, links for us to have context
 panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x998b5f]
 goroutine 2219639 [running]:
 github.com/pion/webrtc/v3/pkg/media/samplebuilder.(*SampleBuilder).buildSample(0xc00dec2000, 0x0)
         /go/pkg/mod/github.com/pion/webrtc/[email protected]/pkg/media/samplebuilder/samplebuilder.go:261 +0x41f
 github.com/pion/webrtc/v3/pkg/media/samplebuilder.(*SampleBuilder).Pop(0xc00dec2000)
         /go/pkg/mod/github.com/pion/webrtc/[email protected]/pkg/media/samplebuilder/samplebuilder.go:295 +0x1a
 gdcx.com/ionrecorder/demuxer.(*rtpDemuxer).demuxVideo(0xc001ed6600, 0x5b4?)
         /usr/src/myapp/demuxer/rtpdemuxer.go:73 +0x7a
 gdcx.com/ionrecorder/demuxer.(*rtpDemuxer).Demux(0xc0005b62f8?, 0x400?)
         /usr/src/myapp/demuxer/rtpdemuxer.go:62 +0x4f
 gdcx.com/ionrecorder/ion.(*Transport).onRTP(0xc0005b62a0, 0xc000808240)
         /usr/src/myapp/ion/transport.go:182 +0x62
 gdcx.com/ionrecorder/ion.newTransport.func4(0xc00afef0e0, 0xc000626960?)
         /usr/src/myapp/ion/transport.go:127 +0x4a
 created by github.com/pion/webrtc/v3.(*PeerConnection).onTrack in goroutine 2219597
         /go/pkg/mod/github.com/pion/webrtc/[email protected]/peerconnection.go:469 +0x165

What did you do?

I have a program working as a mp4 recorder for WebRTC streams, what I do is as following:

r, _, err := track.ReadRTP()

// handle err

sampleBuilder.Push(r)

for {
   // crash on this line
    out := sampleBuilder.Pop()
    if out == nil {
         break
    }
}

What did you expect?

Working normally.

What happened?

The program crashed.

tubzby avatar Nov 21 '24 03:11 tubzby