Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodecData SPS() panic: runtime error: index out of range [0] with length 0 #33

Open
PittYao opened this issue Sep 23, 2021 · 2 comments

Comments

@PittYao
Copy link

PittYao commented Sep 23, 2021

CodecData SPS() index error

src file path

  • adapter.go: line:218 codec.SPS() panic. console like this

image
image
image

How can I fix this problem

thank you

@deepch
Copy link
Owner

deepch commented Sep 23, 2021

you need to understand why it is empty and not allow it to be empty.

@hengzheoduyou
Copy link

you need to understand why it is empty and not allow it to be empty.

if rtsp DESCRIBE not have sprop-sps sprop-pps sprop-parameter-sets 。The code copied by some people doesn't parse these contents and push the stream 。
update parser.go like this
`
func (self CodecData) SPS() []byte {
if len(self.RecordInfo.SPS) > 0 {
return self.RecordInfo.SPS[0]
} else {
return nil
}
}

func (self CodecData) PPS() []byte {
if len(self.RecordInfo.PPS) > 0 {
return self.RecordInfo.PPS[0]
} else {
return nil
}
}

why in your https://github.com/deepch/RTSPtoWebRTC/blob/master/config.go
if codecVideo.SPS() != nil && codecVideo.PPS() != nil && len(codecVideo.SPS()) > 0 && len(codecVideo.PPS()) > 0 {
//ok
//log.Println("Ok Video Ready to play")
}
`
if codecVideo.SPS() == nil is panic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants