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

Commit 3c438389 authored by Huihong Luo's avatar Huihong Luo Committed by Android (Google) Code Review
Browse files

Merge "Sync with ISurfaceComposer changes"

parents 1099c563 8da9cacc
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -22,8 +22,8 @@
#include <utils/String16.h>
#include <utils/String16.h>


#include <binder/IServiceManager.h>
#include <binder/IServiceManager.h>
#include <gui/ISurfaceComposer.h>
#include <android/gui/ISurfaceComposer.h>
#include <ui/DisplayStatInfo.h>
#include <android/gui/DisplayStatInfo.h>


#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/foundation/AUtils.h>
@@ -39,21 +39,22 @@ void VideoFrameScheduler::updateVsync() {
    mVsyncTime = 0;
    mVsyncTime = 0;
    mVsyncPeriod = 0;
    mVsyncPeriod = 0;


    // TODO(b/220021255): wrap this into SurfaceComposerClient
    if (mComposer == NULL) {
    if (mComposer == NULL) {
        String16 name("SurfaceFlinger");
        String16 name("SurfaceFlingerAIDL");
        sp<IServiceManager> sm = defaultServiceManager();
        sp<IServiceManager> sm = defaultServiceManager();
        mComposer = interface_cast<ISurfaceComposer>(sm->checkService(name));
        mComposer = interface_cast<gui::ISurfaceComposer>(sm->checkService(name));
    }
    }
    if (mComposer != NULL) {
    if (mComposer != NULL) {
        DisplayStatInfo stats;
        gui::DisplayStatInfo stats;
        status_t res = mComposer->getDisplayStats(NULL /* display */, &stats);
        binder::Status status = mComposer->getDisplayStats(nullptr/* display */, &stats);
        if (res == OK) {
        if (status.isOk()) {
            ALOGV("vsync time:%lld period:%lld",
            ALOGV("vsync time:%lld period:%lld",
                    (long long)stats.vsyncTime, (long long)stats.vsyncPeriod);
                    (long long)stats.vsyncTime, (long long)stats.vsyncPeriod);
            mVsyncTime = stats.vsyncTime;
            mVsyncTime = stats.vsyncTime;
            mVsyncPeriod = stats.vsyncPeriod;
            mVsyncPeriod = stats.vsyncPeriod;
        } else {
        } else {
            ALOGW("getDisplayStats returned %d", res);
            ALOGW("getDisplayStats returned %d", status.transactionError());
        }
        }
    } else {
    } else {
        ALOGW("could not get surface mComposer service");
        ALOGW("could not get surface mComposer service");
+4 −2
Original line number Original line Diff line number Diff line
@@ -21,7 +21,9 @@


namespace android {
namespace android {


namespace gui {
    class ISurfaceComposer;
    class ISurfaceComposer;
}


struct VideoFrameScheduler : public VideoFrameSchedulerBase {
struct VideoFrameScheduler : public VideoFrameSchedulerBase {
    VideoFrameScheduler();
    VideoFrameScheduler();
@@ -32,7 +34,7 @@ protected:


private:
private:
    void updateVsync() override;
    void updateVsync() override;
    sp<ISurfaceComposer> mComposer;
    sp<gui::ISurfaceComposer> mComposer;
};
};


}  // namespace android
}  // namespace android