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

Commit 0d9fa6df authored by Gaurav's avatar Gaurav Committed by Gaurav Tiwari
Browse files

VT: do not remove a rx session even if ECONNREFUSED occurred.



[Problem] rx session removed if recvfrom() returned
 -1 with ECONNREFUSED reason.
[Cause] ECONNREFUSED can be occurred while calling
  recvfrom() after sendto() for a rtcp packet such
  as RR and TMMBR if remote side didn't open a socket yet.
[Solution] rx session should not be removed even if
  remote device didn't ready to receive a packet yet.

Bug: 196252321

Change-Id: I22b1fbd660a930aaac5e0952fb81cf0537822b77
Signed-off-by: default avatarGaurav <Tiwari&lt;gaurav.tiw@samsung.com>
parent fdbce8a0
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -508,8 +508,6 @@ void ARTPConnection::onPollStreams() {
                    if (n != (ssize_t)buffer->size()) {
                        ALOGW("failed to send RTCP TMMBR (%s).",
                                n >= 0 ? "connection gone" : strerror(errno));

                        it = mStreams.erase(it);
                        continue;
                    }
                }
@@ -560,8 +558,6 @@ void ARTPConnection::onPollStreams() {
                if (n != (ssize_t)buffer->size()) {
                    ALOGW("failed to send RTCP receiver report (%s).",
                            n >= 0 ? "connection gone" : strerror(errno));

                    it = mStreams.erase(it);
                    continue;
                }

@@ -621,8 +617,15 @@ status_t ARTPConnection::receive(StreamInfo *s, bool receiveRTP) {
    } while (nbytes < 0 && errno == EINTR);

    if (nbytes <= 0) {
        ALOGW("failed to recv rtp packet. cause=%s", strerror(errno));
        // ECONNREFUSED may happen in next recvfrom() calling if one of
        // outgoing packet can not be delivered to remote by using sendto()
        if (errno == ECONNREFUSED) {
            return -ECONNREFUSED;
        } else {
            return -ECONNRESET;
        }
    }

    buffer->setRange(0, nbytes);

@@ -665,6 +668,10 @@ ssize_t ARTPConnection::send(const StreamInfo *info, const sp<ABuffer> buffer) {
                    pRemoteRTCPAddr, sizeSockSt);
        } while (n < 0 && errno == EINTR);

        if (n < 0) {
            ALOGW("failed to send rtcp packet. cause=%s", strerror(errno));
        }

        return n;
}