ReleaseCallbackId 是 SurfaceFlinger 在显示之后设置的,通过 onTransactionCompleted()
传递给 client。Client 通过该对象查找回调函数执行 release 操作。
class ReleaseCallbackId : public Parcelable {
public:
static const ReleaseCallbackId INVALID_ID;
uint64_t bufferId;
uint64_t framenumber;
ReleaseCallbackId() {}
ReleaseCallbackId(uint64_t bufferId, uint64_t framenumber)
: bufferId(bufferId), framenumber(framenumber) {}
status_t writeToParcel(Parcel* output) const override;
status_t readFromParcel(const Parcel* input) override;
bool operator==(const ReleaseCallbackId& rhs) const {
return bufferId == rhs.bufferId && framenumber == rhs.framenumber;
}
bool operator!=(const ReleaseCallbackId& rhs) const { return !operator==(rhs); }
std::string to_string() const {
if (*this == INVALID_ID) return "INVALID_ID";
return "bufferId:" + std::to_string(bufferId) +
" framenumber:" + std::to_string(framenumber);
}
};