aacdecoder-android-0.8 Exception when reading

  • Replies:3
  • OpenNot stickiedUnanswered
  • Forum posts: 2

Aug 28, 2018, 7:38:40 PM via Website

0
down vote
favorite

I'm having a problem with the aacdecoder library on devices with Android 8. It works perfectly for a few minutes after the screen locks, approximately after 4 or 5 minutes playback stops.

The error thrown by the Android Studio console is the following: E/BufferReader: Exception when reading: java.net.SocketException: Software caused connection abort

From what I could see, the problem is in the BufferReader.class file in this part of the code:

public void run() {
Log.d(LOG, "run() started....");
int cap = this.capacity;
boolean var2 = false;

while(!this.stopped) {
    BufferReader.Buffer buffer = this.buffers[this.indexMine];
    int total = 0;
    if (cap != buffer.data.length) {
        Log.d(LOG, "run() capacity changed: " + buffer.data.length + " -> " + cap);
        buffer = null;
        this.buffers[this.indexMine] = null;
        this.buffers[this.indexMine] = buffer = new BufferReader.Buffer(cap);
    }

    while(!this.stopped && total < cap) {
        try {
            int n = this.is.read(buffer.data, total, cap - total);
            if (n == -1) {
                this.stopped = true;
            } else {
                total += n;
            }
        } catch (IOException var8) {
            Log.e(LOG, "Exception when reading: " + var8);
            this.stopped = true;
        }
    }

    buffer.size = total;
    synchronized(this) {
        this.notify();
        int indexNew = (this.indexMine + 1) % this.buffers.length;

        while(!this.stopped && indexNew == this.indexBlocked) {
            try {
                this.wait();
            } catch (InterruptedException var9) {
                ;
            }
        }

        this.indexMine = indexNew;
        cap = this.capacity;
    }
}

Log.d(LOG, "run() stopped.");

}

So far I have not been able to find the solution, I appreciate your help, thank you for your time!

Reply
  • Forum posts: 2

Aug 31, 2018, 12:46:32 AM via Website

Hi,

Yes, BufferReader.class is part of the aacdecoder librery:
image

Yes, I can set a breakpoint, but the problem is that it's not happening in a step, instead, it happen a few minutes later (not always the same amount)
If you prefer, I can send you the project, in that case, tell me an email. I can't post a link en this forum.

Thanks!

Helpful?
Reply
  • Forum posts: 883

Aug 31, 2018, 3:59:16 AM via Website

LocucionAR Productora de contenidos

Hi,

Yes, BufferReader.class is part of the aacdecoder librery:
![image][1]

Yes, I can set a breakpoint, but the problem is that it's not happening in a step, instead, it happen a few minutes later (not always the same amount)
If you prefer, I can send you the project, in that case, tell me an email. I can't post a link en this forum.

Thanks!

[1]: https://fscl01.fonpit.de/userfiles/7605200/image/forum/Captura_de_pantalla_de_2018-08-30_19-06-33.png

This error about SocketException usually means that there was a network error.

According to your description, is it possible that your app calling the library was stopped from network access several minutes after screen locking due to some device settings about battery saving mode or data saver?

The screenshots about the settings of battery saving mode and data saver on my android phone are shared on Amazon Cloud as below. Check the Data Saver.png & Power Saving - Keep mobile data on.png, please.

https://www.amazon.com/clouddrive/share/uVB1WcXWiBLJUayLNzrAmRP374xHj7iGUTlmDnDsYWb/folder/8-gsiwuTRDS53I7erEtiow

Helpful?
Reply

Recommended articles