这是indexloc提供的服务,不要输入任何密码
Skip to content

RTSP Session Description Parser fails on extra newline #2357

@dptsolutions

Description

@dptsolutions

Version

Media3 1.6.1

More version details

No response

Devices that reproduce the issue

Using a Pixel 3 Emulator running API 34 image

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

  1. Attempt to connect to a BambuLab X1's RTSP stream over LAN.

Expected result

  1. It connects and Exoplayer goes to ready to play

Actual result

I get the following stacktrace, and player fails to play the stream:

androidx.media3.exoplayer.ExoPlaybackException: Source error
    at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:864)
    at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:840)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.io.IOException: androidx.media3.common.ParserException: Malformed SDP line: i=Sun Apr 20 12:59:09 2025
    {contentIsMalformed=true, dataType=4}
    at androidx.media3.exoplayer.rtsp.RtspMediaPeriod$InternalListener.onSessionTimelineRequestFailed(RtspMediaPeriod.java:697)
    at androidx.media3.exoplayer.rtsp.RtspClient.dispatchRtspError(RtspClient.java:334)
    at androidx.media3.exoplayer.rtsp.RtspClient.access$700(RtspClient.java:76)
    at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspResponse(RtspClient.java:698)
    at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:531)
    at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$androidx-media3-exoplayer-rtsp-RtspClient$MessageListener(RtspClient.java:524)
    at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    ... 3 more
Caused by: androidx.media3.exoplayer.rtsp.RtspMediaSource$RtspPlaybackException: androidx.media3.common.ParserException: Malformed SDP line: i=Sun Apr 20 12:59:09 2025
    {contentIsMalformed=true, dataType=4}
    ... 9 more
Caused by: androidx.media3.common.ParserException: Malformed SDP line: i=Sun Apr 20 12:59:09 2025
    {contentIsMalformed=true, dataType=4}
    at androidx.media3.exoplayer.rtsp.SessionDescriptionParser.parse(SessionDescriptionParser.java:97)
    at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspResponse(RtspClient.java:642)
    ... 8 more

Stepping through the debugger, it appears that BambuLab mangled the SDP spec, and inserted an extra \n character into the line, and this is causing SessionDescriptionParser.parse() to blow up when parsing the following line:

Image

I think a potential solution here is to strip whitespace from the end of the line before attempting to run the line through SDP_LINE_PATTERN? If when stepping through this loop I delete any errant \n characters from the line in the debugger before running it through the matcher, the parse completes successfully, and Exoplayer moves to the ready state.

Media

Can't really share this, it's locally available only. If the tester has a Bambu X1 printer, you can use the instructions to connect here.

Bug Report

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions