-
Notifications
You must be signed in to change notification settings - Fork 54
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
sdp file parsing failed #44
Comments
The SDP looks be able to be parsed by the following code: package main
import (
"fmt"
"github.com/pion/sdp/v2"
)
func main() {
s := &sdp.SessionDescription{}
err := s.Unmarshal([]byte(`v=0
o=NVR 1585015269 1585015269 IN IP4 0.0.0.0
s=3GPP Unicast SDP
c=IN IP4 0.0.0.0
t=0 0
a=range:npt=0-
a=control:*
m=video 0 RTP/AVP 96
a=control:video_0
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42002a;sprop-parameter-sets=Z0IAKp2oHgCJ+WbgICAgQA==,aM48gA==;packetization-mode=0
m=audio 0 RTP/AVP 8
a=control:audio_0
a=rtpmap:8 PCMA/8000`))
if err != nil {
panic(err)
}
fmt.Printf("parsed:\n%+#v\n\n", s)
b, err := s.Marshal()
fmt.Printf("roundtrip:\n%s\n", b)
} output:
Could you post your code and error log? |
code: package main
import (
"fmt"
"github.com/pion/sdp/v2"
)
func main() {
s := &sdp.SessionDescription{}
err := s.Unmarshal([]byte(`v=0
o=NVR 1585043154 1585043154 IN IP4 0.0.0.0
s=3GPP Unicast SDP
c=IN IP4 0.0.0.0
t=0 0
a=range:npt=0-
a=control:*
m=video 0 RTP/AVP 96
a=control:video_0
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42002a;sprop-parameter-sets=Z0IAKp2oHgCJ+WbgICAgQA==,aM48gA==;packetization-mode=0
m=audio 0 RTP/AVP 8
a=control:audio_0
a=rtpmap:8 PCMA/8000
`))
if err != nil {
panic(err)
}
fmt.Printf("parsed:\n%+#v\n\n", s)
b, err := s.Marshal()
fmt.Printf("roundtrip:\n%s\n", b)
} output:
there are several newline bytes after sdp.. |
I'm not very sure SDP allows empty lines. |
In my understanding, extra newlines in SDP is not fully adapting the specification. (I'm not 100% sure.) #46 will fix the issue. |
OK thanks! |
@umbrellary the master branch support SDP with extra newlines now. Please check it out! |
it works! |
What did you do?
Hi~
I took a sdp file from a webcam, but it failed to parse
[
v=0
o=NVR 1585015269 1585015269 IN IP4 0.0.0.0
s=3GPP Unicast SDP
c=IN IP4 0.0.0.0
t=0 0
a=range:npt=0-
a=control:*
m=video 0 RTP/AVP 96
a=control:video_0
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42002a;sprop-parameter-sets=Z0IAKp2oHgCJ+WbgICAgQA==,aM48gA==;packetization-mode=0
m=audio 0 RTP/AVP 8
a=control:audio_0
a=rtpmap:8 PCMA/8000
]
The text was updated successfully, but these errors were encountered: