media icon indicating copy to clipboard operation
media copied to clipboard

RTSP streaming error: Malformed SDP line: i={contentIsMalformed=true, dataType=4}

Open draskori opened this issue 2 years ago • 5 comments

I am streaming from camera in local network (RTSP H.264) using androidx.media3:media3-exoplayer-rtsp:1.1.1 and I get following error in logcat:

Playback error

   androidx.media3.exoplayer.ExoPlaybackException: Source error
       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:684)
       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:660)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:154)
       at android.os.HandlerThread.run(HandlerThread.java:61)
   Caused by: java.io.IOException: androidx.media3.common.ParserException: Malformed SDP line: i={contentIsMalformed=true, dataType=4}
       at androidx.media3.exoplayer.rtsp.RtspMediaPeriod$InternalListener.onSessionTimelineRequestFailed(RtspMediaPeriod.java:689)
       at androidx.media3.exoplayer.rtsp.RtspClient.dispatchRtspError(RtspClient.java:322)
       at androidx.media3.exoplayer.rtsp.RtspClient.access$700(RtspClient.java:76)
       at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspResponse(RtspClient.java:682)
       at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:515)
       at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$androidx-media3-exoplayer-rtsp-RtspClient$MessageListener(RtspClient.java:508)
       at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154) 
       at android.os.HandlerThread.run(HandlerThread.java:61) 
   Caused by: androidx.media3.exoplayer.rtsp.RtspMediaSource$RtspPlaybackException: androidx.media3.common.ParserException: Malformed SDP line: i={contentIsMalformed=true, dataType=4}

draskori avatar Feb 14 '24 08:02 draskori

@draskori

It seems that your camera is providing a malformed SDP description for its stream. Its supplying an "i" attribute which is a "session description" without a value. The SDP description are attribute-value pairs and so it cannot be empty.

Maybe there is some mechanism in the camera setup through which you can "name" the stream or fix it so that its not empty?

microkatz avatar Feb 14 '24 10:02 microkatz

Unfortunately there isn't such option in setup... But I can stream it with VLC or VideoView on some Android 7 for example

draskori avatar Feb 14 '24 14:02 draskori

Reolink owner here, dealing with this problem also. I have reported the problem to Reolink but it looks like the rtsp protocol ( https://datatracker.ietf.org/doc/html/rfc4566 ) says the client end is supposed to ignore any session parameters that are not understood. (PS: I have written some specs in my day and I would say the spec could have been better written in this regard, but let's not go down that rabbit hole.)

2024-02-19_09-17

skipt1206 avatar Feb 19 '24 14:02 skipt1206

@draskori

I pushed a fix, commit https://github.com/androidx/media/commit/52c1d60d39f690b7f3231095fb193510c93fd1ec, to the androidx/media main branch that should address your issue. It will allow an session information attribute with an empty value.

Hopefully that fixes your issue!

@skipt1206 As long as the unknown attribute letter contains a value, then ExoPlayer should ignore it. Are you running into an issue with custom SDP descriptions that ExoPlayer crashes on?

microkatz avatar Feb 21 '24 11:02 microkatz

@draskori

I pushed a fix, commit 52c1d60, to the androidx/media main branch that should address your issue. It will allow an session information attribute with an empty value.

Hopefully that fixes your issue!

@skipt1206 As long as the unknown attribute letter contains a value, then ExoPlayer should ignore it. Are you running into an issue with custom SDP descriptions that ExoPlayer crashes on?

Thanks Michael. I am not a developer, but I have some experience working with developers. In this case I am trying to coordinate resolution of a problem getting Reolink camera rtsp to work with an app called Sparkle TV. Your fix should help a lot.

skipt1206 avatar Feb 21 '24 13:02 skipt1206

As the commit has fixed the initial problem I will close this issue. Please feel free to open a new ticket if an issue still exists.

microkatz avatar Mar 06 '24 10:03 microkatz