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

IllegalArgumentException on RSTP stream from ip-cam because of trailing space in RtpMap #9379

Closed
ArtRoman opened this issue Sep 2, 2021 · 1 comment
Assignees

Comments

@ArtRoman
Copy link

ArtRoman commented Sep 2, 2021

Exoplayer can't show stream from ip camera because of RtpMap header with trailing space. I don't know if it is a camera's firmware bug or it was made intentionally, but no change in camera settings removes that trailing space. Some players (e.g VLC) plays this steam correctly. I'm still using an ExoPlayer fork with RTSP support (before is was added to official repo), and nothing of them has such blocker.

As described in #9014 I have RTSP response:

RTSP/1.0 200 OK
Content-Type: application/sdp
Server: H264DVR 1.0
Cseq: 1
Content-Base: rtsp://192.168.1.11:554/user=admin&password=&channel=1&stream=0.sdp/
Cache-Control: private
x-Accept-Retransmit: our-retransmit
x-Accept-Dynamic-Rate: 1
Content-Length: 412

v=0
o=- 38990265062388 38990265062388 IN IP4 192.168.1.11
s=RTSP Session
c=IN IP4 192.168.1.11
t=0 0
a=control:*
a=range:npt=0-
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000 
a=range:npt=0-
a=framerate:0S
a=fmtp:96 profile-level-id=4d0029; packetization-mode=1; sprop-parameter-sets=J00AKY1uBQBboQAAAwABAAADADKE,KO4Fcg==
a=framerate:25
a=control:trackID=3
m=audio 0 RTP/AVP 8
a=control:trackID=4

Here is additional trailing space that causes error:
a=rtpmap:96 H264/90000␣

Proposed solution

As I see, header looks normal and can be used as normal with skipping trailing spacer after splitting parameter. Moreover, the library uses only first two values, but checks that split result counts to exactly two in MediaDescriptor.java:47:

      String[] rtpmapInfo = Util.split(rtpmapString, " ");
      checkArgument(rtpmapInfo.length == 2);

Also, Util.split() just calls value.split(regex, -1);. Calling rtpmapString.split(" ") or more specific call rtpmapString.split(" ", 0) will be enough to enhance the situation.

Similar headers processing issues: #9247, #9114, #9182

@claincly
Copy link
Contributor

claincly commented Sep 3, 2021

Will be patched soon.

icbaker pushed a commit that referenced this issue Sep 7, 2021
@claincly claincly closed this as completed Sep 8, 2021
christosts pushed a commit that referenced this issue Sep 21, 2021
@google google locked and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants