Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 703b0d22 authored by Juffin Alex Varghese's avatar Juffin Alex Varghese Committed by Steve Kondik
Browse files

OBEX: Reduce Obex MTU size for A2DP or SCO concurrency

Reduce Obex MTU to 8k from 64k when OPP send is tried with
SCO / A2DP streaming in progress, so that the continue
response for first complete Obex PUT packet is received
from SOC within 50 seconds time frame.

CRs-Fixed: 571865
Change-Id: I1eae114f57f2a92ee4b26c82d8f55fafe02775b8
parent 17221101
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ public final class ClientSession extends ObexSession {

    private boolean mRequestActive;

    private boolean setMTU = false;

    private final InputStream mInput;

    private final OutputStream mOutput;
@@ -245,6 +247,10 @@ public final class ClientSession extends ObexSession {
        return ObexHelper.convertToLong(mConnectionId);
    }

    public void reduceMTU(boolean enable) {
        setMTU = enable;
    }

    public Operation put(HeaderSet header) throws IOException {
        if (!mObexConnected) {
            throw new IOException("Not connected to the server");
@@ -451,7 +457,9 @@ public final class ClientSession extends ObexSession {
                maxPacketSize = (mInput.read() << 8) + mInput.read();

                //check with local max size
                if (maxPacketSize > ObexHelper.MAX_CLIENT_PACKET_SIZE) {
                if (setMTU) {
                    maxPacketSize = ObexHelper.A2DP_SCO_OBEX_MAX_CLIENT_PACKET_SIZE;
                } else if (maxPacketSize > ObexHelper.MAX_CLIENT_PACKET_SIZE) {
                    maxPacketSize = ObexHelper.MAX_CLIENT_PACKET_SIZE;
                }

+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public final class ObexHelper {
     * TODO: Should be removed as soon as Microsoft updates their driver.
     */
    public static final int MAX_CLIENT_PACKET_SIZE = 0xFC00;
    public static final int A2DP_SCO_OBEX_MAX_CLIENT_PACKET_SIZE = 0x2000;

    public static final int OBEX_OPCODE_CONNECT = 0x80;