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

JPEGDepay not working if rtpmap attribute is missing #725

Open
heppth opened this issue Jan 25, 2023 · 1 comment
Open

JPEGDepay not working if rtpmap attribute is missing #725

heppth opened this issue Jan 25, 2023 · 1 comment
Labels
bug Something isn't working streams Related to streams (media-stream-library-js package)

Comments

@heppth
Copy link

heppth commented Jan 25, 2023

Can not depay MJPEG RTSP stream if SDP message does not contain a rtpmap attribute.

Reason
The VideoMedia can not be found, because rtpmap is undefined

const jpegMedia = msg.sdp.media.find((media): media is VideoMedia => {
return (
media.type === 'video' &&
media.rtpmap !== undefined &&
media.rtpmap.encodingName === 'JPEG'
)

...if camera sends DESCRIBE response like this:

v=0 
o=- 1674614617067403 1 IN IP4 192.168.40.45 
s=Mobotix IP-Camera (MJPEG, unicast) 
i=stream0/mobotix.mjpeg 
t=0 0 
a=tool:LIVE555 Streaming Media v2018.10.17 
a=type:broadcast 
a=control:* 
a=range:npt=0- 
a=x-qt-text-nam:Mobotix IP-Camera (MJPEG, unicast) 
a=x-qt-text-inf:stream0/mobotix.mjpeg 
m=video 0 RTP/AVP 26 
c=IN IP4 0.0.0.0 
b=AS:22500 
a=control:track1 
a=framesize:96 800-600 
a=x-dimensions:800,600 
a=recvonly 

Suggested fix
Do not require rtpmap and check fmt instead. For example:

          const jpegMedia = msg.sdp.media.find((media): media is VideoMedia => {
            return (
              media.type === 'video' &&
              media.fmt === 26
            )

...because the RFC says:

In the case of RTP streams, all media descriptions SHOULD contain
"a=rtpmap" mappings from RTP payload types to encodings. If there is
no "a=rtpmap", the default payload type mapping, as defined by the
current profile in use (for example, RFC 1890 [5]) is to be used.

@heppth heppth added the bug Something isn't working label Jan 25, 2023
@steabert steabert added the streams Related to streams (media-stream-library-js package) label Mar 18, 2023
@steabert
Copy link
Member

Since the server should send it, this isn't high prio. However, it would be nice to have a fallback for servers that don't do what they should do.

For the fallback, I don't think we can use the suggested fix, as we read the payload type later on. So we would need a way to completely bypass payload type selection and go for the default 26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working streams Related to streams (media-stream-library-js package)
Projects
None yet
Development

No branches or pull requests

2 participants