pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.
Apache License 2.0
207 stars 65 forks source link

update latest version, exception info: java.lang.ArrayIndexOutOfBoundsException: #140

Closed pengxiao18 closed 2 days ago

pengxiao18 commented 3 days ago

E Unexpected error java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 at com.pedro.rtsp.rtsp.RtspSender.setSocketsInfo(SourceFile:38) at com.pedro.rtspserver.server.ServerClient$startClient$1.invokeSuspend(SourceFile:463) at nb.resumeWith(SourceFile:12) at x22.O0(SourceFile:7) at h.resumeWith(SourceFile:14) at nb.resumeWith(SourceFile:48) at l50.run(SourceFile:126) at r11$a.run(SourceFile:4) at rf2.run(SourceFile:3) at wt.e0(SourceFile:1) at wt$c.b(SourceFile:34) at wt$c.m(SourceFile:29) at wt$c.run(SourceFile:1)

pedroSG94 commented 3 days ago

Hello,

Do you have a way to reproduce it? Can you tell me player used to reproduce it?

pengxiao18 commented 3 days ago

The player I use is org.videolan.android:libvlc-all:3.5.4-eap4. The Code:

Media media = new Media(libVLC, Uri.parse(rtspUrl)); media.addOption(":network-caching=300"); media.setHWDecoderEnabled(true, false); mediaPlayer.setMedia(media); mediaPlayer.play(); media.release();

pengxiao18 commented 3 days ago

There is no problem using the previous version:

implementation 'com.github.pedroSG94:RTSP-Server:1.3.1' implementation 'com.github.pedroSG94.RootEncoder:library:2.5.1'

pedroSG94 commented 3 days ago

Hello,

I detected that it is a problem related to only use a track (only audio or only video) I'm fixing it

pedroSG94 commented 3 days ago

This should be fixed in version 1.3.3. Download the last version of the README again and test it.

pengxiao18 commented 3 days ago

I am downloading the new version to test

pengxiao18 commented 3 days ago

ffb320eb700b8d765836d311e70b103

I just tested it, but the problem still exists.

I use the track contains audio and video.

pedroSG94 commented 3 days ago

Ok, I will check it directly with VLC. Can you give me the VLC gradle import to reproduce the error?

pengxiao18 commented 3 days ago

implementation 'org.videolan.android:libvlc-all:3.5.4-eap4'

pengxiao18 commented 3 days ago

42a928459db35ebd490cb9dd1989108

I just debugged and found that videoServerPorts and audioServerPorts are both empty arrays

pedroSG94 commented 3 days ago

Maybe because the server request TCP instead UDP. Can you share the RTSP commands that should be able in the logcat?

pengxiao18 commented 3 days ago

You are right, I added options.add("--rtsp-tcp") in the vlc playback parameters

options.add("--no-drop-late-frames"); options.add("--no-skip-frames"); options.add("--rtsp-tcp"); options.add("--avcodec-hw=any"); options.add("--live-caching=300"); options.add("--mod-noisereduction");

pengxiao18 commented 3 days ago

I caught the log log.txt

pedroSG94 commented 2 days ago

Hello,

I was able to reproduce it using this command:

//open VLC and force use TCP
vlc --rtsp-tcp rtsp://192.168.0.6:1935

Test with version 1.3.4 Also:

pengxiao18 commented 2 days ago

I updated to the latest version and the problem no longer occurs.

But there is a kotlin coroutine exception that occurs once every 5 seconds.

log_2024_10_29.txt

pedroSG94 commented 2 days ago

Hello,

I know about that error but you can ignore it. This issue is temporal fix that I ddid until ktor fix a problem related with timeout, you can ignore that issue because the library works even with that error.

Closing as solved, let me know if you have more problems. You can reopen the issue if needed