google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.71k stars 6.02k forks source link

Receiving Playback error when playing ip camera RTSP content #9619

Closed gysutantoman closed 2 years ago

gysutantoman commented 2 years ago

I am trying to access rtsp://192.168.0.148:554/ch1. I am able to play same link in windows VLC medial player 3.0.12 and Android VLC player 3.3.4

device: android 9.0 exoplayer version 2.15.1

I have created mediasource as shown below

SimpleExoPlayer exoPlayer = new SimpleExoPlayer.Builder(context).build();
exoPlayer.setMediaSource(new RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri("rtsp://192.168.0.148:554/ch1));); 
exoPlayer.setVideoSurface(sur);
exoPlayer.prepare();
exoPlayer.play();

err log:

D/ExoPlayerSource: load source rtsp://192.168.0.148:554/ch1
I/ExoPlayerImpl: Init 2357caf [ExoPlayerLib/2.15.1] [sdm660_64, sdm660 for arm64, QUALCOMM, 28]
E/RTSP[S]: [OPTIONS rtsp://192.168.0.148:554/ch1 RTSP/1.0, CSeq: 0, User-Agent: ExoPlayerLib/2.15.1, , ]
E/RTSP[R]: [RTSP/1.0 200 OK, Server: MS/1.0 (Build/1.0; Platform/Linux; Release/RDCamera;), CSeq: 0, Date: Thu, 28 Oct 2021 10:21:45 GMT, Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, ]
E/RTSP[S]: [DESCRIBE rtsp://192.168.0.148:554/ch1 RTSP/1.0, CSeq: 1, User-Agent: ExoPlayerLib/2.15.1, , ]
E/RTSP[R]: [RTSP/1.0 200 OK, Server: MS/1.0 (Build/1.0; Platform/Linux; Release/RDCamera;), CSeq: 1, Date: Thu, 28 Oct 2021 10:21:45 GMT, Expires: Thu, 28 Oct 2021 10:21:45 GMT, Content-Length: 558, Content-Type: application/sdp, x-Accept-Retransmit: our-retransmit, x-Accept-Dynamic-Rate: 1, Content-Base: rtsp://192.168.0.148:554/media.sdp/, , v=0
    o=MediaBox 1635416505936410 1635416505936410 IN IP4 0.0.0.0
    s=AMNC
    i=MediaBox Live Cast
    c=IN IP4 192.168.0.148
    t=0 0
    a=range:npt=0.000-
    a=control:*
    m=video 0 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;profile-level-id=42001F;sprop-parameter-sets=Z0IAH52oFAFum4CAgIE=,aM48gA==
    a=range:npt=0.000-
    a=control:trackID=1
    m=audio 0 RTP/AVP 104
    a=rtpmap:104 MPEG4-GENERIC/16000
    b=AS:96
    a=fmtp:104 streamtype=5;profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408
    a=control:trackID=2]
W/AudioCapabilities: Unsupported mime audio/adpcm_ima_qt
W/AudioCapabilities: Unsupported mime audio/adpcm_ima_wav
W/AudioCapabilities: Unsupported mime audio/adpcm_yamaha
W/AudioCapabilities: Unsupported mime audio/alac
W/AudioCapabilities: Unsupported mime audio/x-ape
    Unsupported mime audio/dsd
W/AudioCapabilities: Unsupported mime audio/dts
W/AudioCapabilities: Unsupported mime audio/mpeg-L2
W/AudioCapabilities: Unsupported mime audio/pcm_alaw
W/AudioCapabilities: Unsupported mime audio/pcm_dvd
    Unsupported mime audio/pcm_mulaw
W/AudioCapabilities: Unsupported mime audio/pcm_s16be
W/AudioCapabilities: Unsupported mime audio/pcm_s16le
    Unsupported mime audio/qdm
W/AudioCapabilities: Unsupported mime audio/vnd.rn-realaudio
W/AudioCapabilities: Unsupported mime audio/ffmpeg
W/AudioCapabilities: Unsupported mime audio/wavpack
W/AudioCapabilities: Unsupported mime audio/x-ms-wma
W/VideoCapabilities: Unsupported mime video/divx
W/VideoCapabilities: Unsupported mime video/divx
W/VideoCapabilities: Unsupported mime video/divx311
W/VideoCapabilities: Unsupported mime video/divx4
W/VideoCapabilities: Unsupported mime video/x-flv
W/VideoCapabilities: Unrecognized profile 4 for video/hevc
W/VideoCapabilities: Unsupported mime video/x-jpeg
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unsupported mime video/msmpeg4
W/VideoCapabilities: Unsupported mime video/vnd.rn-realvideo
W/VideoCapabilities: Unsupported mime video/svq
W/VideoCapabilities: Unsupported mime video/ffmpeg
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
I/chatty: uid=10119(com.**) ExoPlayer:Playb identical 1 line
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
W/Utils: could not parse long range '175-174'
E/RTSP[S]: [SETUP rtsp://192.168.0.148:554/ch1/trackID=1 RTSP/1.0, CSeq: 2, User-Agent: ExoPlayerLib/2.15.1, Transport: RTP/AVP;unicast;client_port=44948-44949, , ]
E/RTSP[R]: [RTSP/1.0 200 OK, Server: MS/1.0 (Build/1.0; Platform/Linux; Release/RDCamera;), CSeq: 2, Session: 0, Date: Thu, 28 Oct 2021 10:21:46 GMT, Expires: Thu, 28 Oct 2021 10:21:46 GMT, Transport: RTP/AVP;unicast;client_port=44948-44949;server_port=21670-21671, ]
D/ACodec: onAllocateComponent
I/OMXClient: IOmx service obtained
D/SurfaceUtils: connecting to surface 0x76f535c010, reason connectToSurface
I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 15866881
D/SurfaceUtils: disconnecting from surface 0x76f535c010, reason connectToSurface(reconnect)
    connecting to surface 0x76f535c010, reason connectToSurface(reconnect)
I/ExtendedACodec: setupVideoDecoder()
I/ExtendedACodec: Decoder will be in frame by frame mode
D/SurfaceUtils: set up nativeWindow 0x76f535c010 for 1280x720, color 0x7fa30c06, rotation 0, usage 0x20002900
W/MapperHal: buffer descriptor with invalid usage bits 0x2000
D/ACodec: onAllocateComponent
I/OMXClient: IOmx service obtained
W/MapperHal: buffer descriptor with invalid usage bits 0x2000
I/ACodec: codec does not support config priority (err -2147483648)
I/ACodec: codec does not support config priority (err -2147483648)
W/ExtendedACodec: Failed to get extension for extradata parameter
E/RTSP[S]: [SETUP rtsp://192.168.0.148:554/ch1/trackID=2 RTSP/1.0, CSeq: 3, User-Agent: ExoPlayerLib/2.15.1, Session: 0, Transport: RTP/AVP;unicast;client_port=40932-40933, , ]
E/RTSP[R]: [RTSP/1.0 200 OK, Server: MS/1.0 (Build/1.0; Platform/Linux; Release/RDCamera;), CSeq: 3, Session: 0, Date: Thu, 28 Oct 2021 10:21:46 GMT, Expires: Thu, 28 Oct 2021 10:21:46 GMT, Transport: RTP/AVP;unicast;client_port=40932-40933;server_port=21666-21667, ]
E/RTSP[S]: [PLAY rtsp://192.168.0.148:554/ch1 RTSP/1.0, CSeq: 4, User-Agent: ExoPlayerLib/2.15.1, Session: 0, Range: npt=0.000-, , ]
E/RTSP[R]: [RTSP/1.0 200 OK, Server: MS/1.0 (Build/1.0; Platform/Linux; Release/RDCamera;), CSeq: 4, Session: 0, Date: Thu, 28 Oct 2021 10:21:46 GMT, Range: npt=0.000-, RTP-Info: url=rtsp://192.168.0.148:554/media.sdp/trackID=1,192.168.0.148:554/media.sdp/trackID=2, ]
E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.source.rtsp.RtspMediaSource$RtspPlaybackException: com.google.android.exoplayer2.ParserException: url=rtsp://192.168.0.148:554/media.sdp/trackID=1
        at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:528)
        at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$RtspClient$MessageListener(RtspClient.java:423)
        at com.google.android.exoplayer2.source.rtsp.-$$Lambda$RtspClient$MessageListener$dJPB0r-FyeWq7xUwLx0FyxTnUk0.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
     Caused by: com.google.android.exoplayer2.ParserException: url=rtsp://192.168.0.148:554/media.sdp/trackID=1
        at com.google.android.exoplayer2.source.rtsp.RtspTrackTiming.parseTrackTiming(RtspTrackTiming.java:97)
        at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:507)
        at com.google.android.exoplayer2.source.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$RtspClient$MessageListener(RtspClient.java:423) 
        at com.google.android.exoplayer2.source.rtsp.-$$Lambda$RtspClient$MessageListener$dJPB0r-FyeWq7xUwLx0FyxTnUk0.run(Unknown Source:4) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
divyanshupundir commented 2 years ago

Has there been any development in this?

I am facing the same issue where I cannot play an RTSP stream from an IP camera using ExoPlayer, whereas libvlc for android is able to play it.

claincly commented 2 years ago

The cause is the server included invalid RTP-Info header values in the RTSP PLAY response.

We are working on a fix internally to ignore RTP-Info, please see #9775.