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

Commit 1b88b416 authored by Andreas Huber's avatar Andreas Huber Committed by The Android Automerger
Browse files

Update HTTP proxy configuration for all media playback inside stagefright.

Change-Id: Ie0dd00045aba668d8b49da73224e7a7c9c04f69b
related-to-bug: 8873723
(cherry picked from commit 2704965b8a1ff3b7450ff58ccecf86d8ec688c40)
parent 45e30653
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ public:

    virtual void addBatteryData(uint32_t params) = 0;
    virtual status_t pullBatteryData(Parcel* reply) = 0;

    virtual status_t updateProxyConfig(
            const char *host, int32_t port, const char *exclusionList) = 0;
};

// ----------------------------------------------------------------------------
+5 −0
Original line number Diff line number Diff line
@@ -198,6 +198,11 @@ public:
        return INVALID_OPERATION;
    }

    virtual status_t updateProxyConfig(
            const char *host, int32_t port, const char *exclusionList) {
        return INVALID_OPERATION;
    }

private:
    friend class MediaPlayerService;

+3 −0
Original line number Diff line number Diff line
@@ -232,6 +232,9 @@ public:
            status_t        setRetransmitEndpoint(const char* addrString, uint16_t port);
            status_t        setNextMediaPlayer(const sp<MediaPlayer>& player);

            status_t updateProxyConfig(
                    const char *host, int32_t port, const char *exclusionList);

private:
            void            clear_l();
            status_t        seekTo_l(int msec);
+38 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ enum {
    ADD_BATTERY_DATA,
    PULL_BATTERY_DATA,
    LISTEN_FOR_REMOTE_DISPLAY,
    UPDATE_PROXY_CONFIG,
};

class BpMediaPlayerService: public BpInterface<IMediaPlayerService>
@@ -163,6 +164,25 @@ public:
        remote()->transact(LISTEN_FOR_REMOTE_DISPLAY, data, &reply);
        return interface_cast<IRemoteDisplay>(reply.readStrongBinder());
    }

    virtual status_t updateProxyConfig(
            const char *host, int32_t port, const char *exclusionList) {
        Parcel data, reply;

        data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
        if (host == NULL) {
            data.writeInt32(0);
        } else {
            data.writeInt32(1);
            data.writeCString(host);
            data.writeInt32(port);
            data.writeCString(exclusionList);
        }

        remote()->transact(UPDATE_PROXY_CONFIG, data, &reply);

        return reply.readInt32();
    }
};

IMPLEMENT_META_INTERFACE(MediaPlayerService, "android.media.IMediaPlayerService");
@@ -267,6 +287,24 @@ status_t BnMediaPlayerService::onTransact(
            reply->writeStrongBinder(display->asBinder());
            return NO_ERROR;
        } break;
        case UPDATE_PROXY_CONFIG:
        {
            CHECK_INTERFACE(IMediaPlayerService, data, reply);

            const char *host = NULL;
            int32_t port = 0;
            const char *exclusionList = NULL;

            if (data.readInt32()) {
                host = data.readCString();
                port = data.readInt32();
                exclusionList = data.readCString();
            }

            reply->writeInt32(updateProxyConfig(host, port, exclusionList));

            return OK;
        }
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
+11 −0
Original line number Diff line number Diff line
@@ -814,4 +814,15 @@ status_t MediaPlayer::setNextMediaPlayer(const sp<MediaPlayer>& next) {
    return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer);
}

status_t MediaPlayer::updateProxyConfig(
        const char *host, int32_t port, const char *exclusionList) {
    const sp<IMediaPlayerService>& service = getMediaPlayerService();

    if (service != NULL) {
        return service->updateProxyConfig(host, port, exclusionList);
    }

    return INVALID_OPERATION;
}

}; // namespace android
Loading