ant-media / LibRtmp-Client-for-Android

It is probably the smallest(~60KB, fat version ~300KB) rtmp client for android. It calls librtmp functions over JNI interface
http://antmedia.io
Apache License 2.0
672 stars 230 forks source link

RtmpClient.read returns -1 rather than throwing when no connection #69

Closed ojw28 closed 4 years ago

ojw28 commented 6 years ago

Reproduction steps:

  1. Start reading an RTMP live stream, by opening a connection and then repeatedly calling RtmpClient.read, as normal. @jinfanzon can provide you with such a stream via email.
  2. Toggle airplane mode on, then off again whilst reading.
  3. Observe the current RtmpClient.read call ends up returning -1, which is documented to mean that the stream is complete.

It looks to me like returning -1 in this case is incorrect. In ExoPlayer, it causes us to assume the stream has ended and transition the player to its ended state. The RtmpClient.read call should either throw an exception (in which case the player will retry) or read some valid data (if possible, depending on when the method returns relative to when airplane mode is toggled off again). Please could you take a look?

mekya commented 6 years ago

Hi, Throwing an exception indicating connection with the server is dropped may help you for this issue?

ojw28 commented 6 years ago

Yes, if RtmpClient.read were to throw an appropriate exception rather than returning -1 in this case, that would help.

jinfanzon commented 6 years ago

Hi @mekya - could you please provide me an email adress to send the stream url I'm using.

jinfanzon commented 6 years ago

Hi @mekya - Will the proposed solution will be implemented in the upcoming releases?