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

Commit fd3bbcb5 authored by Dichen Zhang's avatar Dichen Zhang
Browse files

Close socket before posting message to RTSPSource message handler

Bug: 120119004
Test: Same as b/120119004 #1
Change-Id: If22bb575347448893032465f6c59b244ba74ef89
parent 39d76637
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -144,6 +144,10 @@ void NuPlayer::RTSPSource::stop() {
    if (mLooper == NULL) {
        return;
    }

    // Close socket before posting message to RTSPSource message handler.
    close(mHandler->getARTSPConnection()->getSocket());

    sp<AMessage> msg = new AMessage(kWhatDisconnect, this);

    sp<AMessage> dummy;
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ struct ARTSPConnection : public AHandler {
            const char *url, AString *host, unsigned *port, AString *path,
            AString *user, AString *pass);

    int getSocket() { return mSocket; }

protected:
    virtual ~ARTSPConnection();
    virtual void onMessageReceived(const sp<AMessage> &msg);
+4 −0
Original line number Diff line number Diff line
@@ -257,6 +257,10 @@ struct MyHandler : public AHandler {
        msg->post();
    }

    sp<ARTSPConnection> getARTSPConnection() {
      return mConn;
    }

    static void addRR(const sp<ABuffer> &buf) {
        uint8_t *ptr = buf->data() + buf->size();
        ptr[0] = 0x80 | 0;