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

Commit 6e8aec8d authored by Andreas Huber's avatar Andreas Huber
Browse files

Removed rtp timestamp patching hack in ANetworkSession, advertise

differentiated service tags to help prioritize our traffic.

Change-Id: Ibe42df64da272f4bb6b978e46a4ea2efdadfcbc7
parent 80bf5cc2
Loading
Loading
Loading
Loading
+8 −18
Original line number Diff line number Diff line
@@ -451,24 +451,6 @@ status_t ANetworkSession::Session::writeMore() {
            const Fragment &frag = *mOutFragments.begin();
            const sp<ABuffer> &datagram = frag.mBuffer;

            uint8_t *data = datagram->data();
            if (data[0] == 0x80 && (data[1] & 0x7f) == 33) {
                int64_t nowUs = ALooper::GetNowUs();

                uint32_t prevRtpTime = U32_AT(&data[4]);

                // 90kHz time scale
                uint32_t rtpTime = (nowUs * 9ll) / 100ll;
                int32_t diffTime = (int32_t)rtpTime - (int32_t)prevRtpTime;

                ALOGV("correcting rtpTime by %.0f ms", diffTime / 90.0);

                data[4] = rtpTime >> 24;
                data[5] = (rtpTime >> 16) & 0xff;
                data[6] = (rtpTime >> 8) & 0xff;
                data[7] = rtpTime & 0xff;
            }

            int n;
            do {
                n = send(mSocket, datagram->data(), datagram->size(), 0);
@@ -874,6 +856,14 @@ status_t ANetworkSession::createClientOrServer(
            err = -errno;
            goto bail2;
        }

        int tos = 224;  // VOICE
        res = setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));

        if (res < 0) {
            err = -errno;
            goto bail2;
        }
    }

    err = MakeSocketNonBlocking(s);