RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Audio not sending shortly after beginning

Open mkrn opened this issue 2 years ago • 6 comments

Describe the bug We've noticed that on some streams audio stops sending shortly after start or not sending at all: http://bit.ly/3PLdgZG

Here's the chart of audio and video packets in the received video on RTMP server: image

To Reproduce Steps to reproduce the behavior: This only happens in small % of streams

Expected behavior Audio and video be sent continiously

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Samsung Galaxy S20 5G Samsung Galaxy S23 Ultra

Additional context Probably non-ideal connection on 4G with interruptions.

mkrn avatar Sep 18 '23 11:09 mkrn

Forgot to mention this was com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.2.4 If the problem is fixed in 2.2.8 feel free to close.

mkrn avatar Sep 18 '23 13:09 mkrn

Hello,

I will try investigate. I noticed that sometimes (I could reproduce like 1 or 2 times, long time ago, that I remember) AudioEncoder class stop to process frames with no reason (no crash report) but it is really rare and I was no able to reproduce. I'm not sure if AudioEncoder crash without report it or Microphone stop send frames.

I think that internet is not related if you can receive video because in that case audio and video frames should be affected and you should receive both channels but maybe losing few frames.

Do you have anyway to reproduce it easier?

pedroSG94 avatar Sep 18 '23 18:09 pedroSG94

No way to reproduce unfortunately, but I can introduce more logging to catch it. Any ideas where it could happen? Is it possible it happens in some "catch" and microphone restart should be started?

FYI setMicrophoneMode(MicrophoneMode.ASYNC); is used.

mkrn avatar Sep 19 '23 10:09 mkrn

I have 2 main suspects:

  • AudioEncoder crash: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/BaseEncoder.java#L283 https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/BaseEncoder.java#L276 https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/BaseEncoder.java#L265 I added EncoderErrorCallback to listen this errors yerterday

  • Microphone stop generate frames: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/input/audio/MicrophoneManager.java#L206 Check if this line is executed. I added this log today but in previous versions this method should return null if microphone fail to read.

Let me know if you can detect the error and we can try to solve it.

pedroSG94 avatar Sep 19 '23 13:09 pedroSG94

Can we release a new version if anything was fixed? Having trouble with adding master branch via implementation in gradle /jitpack.

mkrn avatar Sep 20 '23 11:09 mkrn

Hello,

Try this gradle:

implementation 'com.github.pedroSG94:RootEncoder:library:0005d02b5b'

This will compile the library in the actual last commit of master

pedroSG94 avatar Sep 20 '23 11:09 pedroSG94