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

Commit 1ad3eb94 authored by Chong Zhang's avatar Chong Zhang
Browse files

wifi-display: fix resolution list and keepalive interval

- add all resolutions lower than 1280x720p30

- schedule next keepalive when sending M16

bug 9116665

Change-Id: I7b3fea2101d3d882c0af5c153af5c502b8ce98f6
parent fbb70ce4
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -178,6 +178,29 @@ void VideoFormats::enableAll() {
    }
}

void VideoFormats::enableResolutionUpto(
        ResolutionType type, size_t index,
        ProfileType profile, LevelType level) {
    size_t width, height, fps, score;
    bool interlaced;
    if (!GetConfiguration(type, index, &width, &height,
            &fps, &interlaced)) {
        ALOGE("Maximum resolution not found!");
        return;
    }
    score = width * height * fps * (!interlaced + 1);
    for (size_t i = 0; i < kNumResolutionTypes; ++i) {
        for (size_t j = 0; j < 32; j++) {
            if (GetConfiguration((ResolutionType)i, j,
                    &width, &height, &fps, &interlaced)
                    && score >= width * height * fps * (!interlaced + 1)) {
                setResolutionEnabled((ResolutionType)i, j);
                setProfileLevel((ResolutionType)i, j, profile, level);
            }
        }
    }
}

void VideoFormats::setResolutionEnabled(
        ResolutionType type, size_t index, bool enabled) {
    CHECK_LT(type, kNumResolutionTypes);
+3 −0
Original line number Diff line number Diff line
@@ -69,6 +69,9 @@ struct VideoFormats {

    void disableAll();
    void enableAll();
    void enableResolutionUpto(
            ResolutionType type, size_t index,
            ProfileType profile, LevelType level);

    void setResolutionEnabled(
            ResolutionType type, size_t index, bool enabled = true);
+4 −3
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ WifiDisplaySource::WifiDisplaySource(
    mSupportedSourceVideoFormats.setNativeResolution(
            VideoFormats::RESOLUTION_CEA, 5);  // 1280x720 p30

    mSupportedSourceVideoFormats.setProfileLevel(
    // Enable all resolutions up to 1280x720p30
    mSupportedSourceVideoFormats.enableResolutionUpto(
            VideoFormats::RESOLUTION_CEA, 5,
            VideoFormats::PROFILE_CHP,  // Constrained High Profile
            VideoFormats::LEVEL_32);    // Level 3.2
@@ -751,6 +752,8 @@ status_t WifiDisplaySource::sendM16(int32_t sessionID) {

    ++mNextCSeq;

    scheduleKeepAlive(sessionID);

    return OK;
}

@@ -1021,8 +1024,6 @@ status_t WifiDisplaySource::onReceiveM16Response(

    if (mClientInfo.mPlaybackSession != NULL) {
        mClientInfo.mPlaybackSession->updateLiveness();

        scheduleKeepAlive(sessionID);
    }

    return OK;