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

Commit bcf09f8c authored by Andreas Huber's avatar Andreas Huber
Browse files

Only run the wifi display RTSP server on demand, and only on the wifi direct

interface.

Change-Id: I7d3c44cb79cd40e73499f2d7ccf35c69b628e6d7
parent 86b1961a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -50,7 +50,11 @@ public:
    virtual sp<IOMX>            getOMX() = 0;
    virtual sp<ICrypto>         makeCrypto() = 0;

    virtual status_t enableRemoteDisplay(bool enable) = 0;
    // If iface == NULL, disable remote display, otherwise
    // iface should be of the form "x.x.x.x:y", i.e. ip address
    // of the local interface to bind to and the port number
    // to listen on.
    virtual status_t enableRemoteDisplay(const char *iface) = 0;

    // codecs and audio devices usage tracking for the battery app
    enum BatteryDataBits {
+14 −4
Original line number Diff line number Diff line
@@ -121,10 +121,17 @@ public:
        return interface_cast<ICrypto>(reply.readStrongBinder());
    }

    virtual status_t enableRemoteDisplay(bool enable) {
    virtual status_t enableRemoteDisplay(const char *iface) {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
        data.writeInt32(enable);

        if (iface != NULL) {
            data.writeInt32(1);
            data.writeCString(iface);
        } else {
            data.writeInt32(0);
        }

        remote()->transact(ENABLE_REMOTE_DISPLAY, data, &reply);
        return reply.readInt32();
    }
@@ -217,8 +224,11 @@ status_t BnMediaPlayerService::onTransact(
        } break;
        case ENABLE_REMOTE_DISPLAY: {
            CHECK_INTERFACE(IMediaPlayerService, data, reply);
            bool enable = data.readInt32();
            reply->writeInt32(enableRemoteDisplay(enable));
            const char *iface = NULL;
            if (data.readInt32()) {
                iface = data.readCString();
            }
            reply->writeInt32(enableRemoteDisplay(iface));
            return NO_ERROR;
        } break;
        case ADD_BATTERY_DATA: {
+10 −4
Original line number Diff line number Diff line
@@ -279,13 +279,17 @@ sp<ICrypto> MediaPlayerService::makeCrypto() {
    return new Crypto;
}

status_t MediaPlayerService::enableRemoteDisplay(bool enable) {
status_t MediaPlayerService::enableRemoteDisplay(const char *iface) {
    Mutex::Autolock autoLock(mLock);

    if (enable && mRemoteDisplay == NULL) {
    if (iface != NULL) {
        if (mRemoteDisplay != NULL) {
            return INVALID_OPERATION;
        }

        mRemoteDisplay = new RemoteDisplay;

        status_t err = mRemoteDisplay->start();
        status_t err = mRemoteDisplay->start(iface);

        if (err != OK) {
            mRemoteDisplay.clear();
@@ -293,7 +297,9 @@ status_t MediaPlayerService::enableRemoteDisplay(bool enable) {
        }

        return OK;
    } else if (!enable && mRemoteDisplay != NULL) {
    }

    if (mRemoteDisplay != NULL) {
        mRemoteDisplay->stop();
        mRemoteDisplay.clear();
    }
+1 −1
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ public:
    virtual sp<IMemory>         decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat);
    virtual sp<IOMX>            getOMX();
    virtual sp<ICrypto>         makeCrypto();
    virtual status_t            enableRemoteDisplay(bool enable);
    virtual status_t            enableRemoteDisplay(const char *iface);

    virtual status_t            dump(int fd, const Vector<String16>& args);

+2 −4
Original line number Diff line number Diff line
@@ -32,13 +32,11 @@ RemoteDisplay::RemoteDisplay()
RemoteDisplay::~RemoteDisplay() {
}

status_t RemoteDisplay::start() {
status_t RemoteDisplay::start(const char *iface) {
    mNetSession->start();
    mLooper->start();

    // XXX replace with 8554 for bcom dongle (it doesn't respect the
    // default port or the one advertised in the wfd IE).
    mSource->start(WifiDisplaySource::kWifiDisplayDefaultPort);
    mSource->start(iface);

    return OK;
}
Loading