This commit is contained in:
Aiden
2026-05-12 01:21:42 +10:00
parent f1f4e3421b
commit ea31d0ca13
8 changed files with 527 additions and 35 deletions

View File

@@ -54,8 +54,15 @@ public:
return true;
}
bool Start() override
bool PrepareOutputSchedule() override
{
mPreparedOutputSchedule = true;
return true;
}
bool StartInputStreams() override
{
mInputStreamsStarted = true;
mState.hasInputSource = true;
VideoIOFrame input;
input.bytes = mInputBytes.data();
@@ -65,11 +72,22 @@ public:
input.pixelFormat = mState.inputPixelFormat;
if (mInputCallback)
mInputCallback(input);
return true;
}
bool StartScheduledPlayback() override
{
mScheduledPlaybackStarted = true;
if (mOutputCallback)
mOutputCallback(VideoIOCompletion{ VideoIOCompletionResult::Completed });
return true;
}
bool Start() override
{
return PrepareOutputSchedule() && StartInputStreams() && StartScheduledPlayback();
}
bool Stop() override { return true; }
const VideoIOState& State() const override { return mState; }
VideoIOState& MutableState() override { return mState; }
@@ -103,6 +121,9 @@ public:
}
unsigned ScheduledFrames() const { return mScheduledFrames; }
bool PreparedOutputSchedule() const { return mPreparedOutputSchedule; }
bool InputStreamsStarted() const { return mInputStreamsStarted; }
bool ScheduledPlaybackStarted() const { return mScheduledPlaybackStarted; }
VideoIOCompletionResult LastCompletion() const { return mLastCompletion; }
uint64_t LastReadyQueueDepth() const { return mLastReadyQueueDepth; }
@@ -113,6 +134,9 @@ private:
std::array<unsigned char, 3840> mInputBytes = {};
std::array<unsigned char, 7680> mOutputBytes = {};
unsigned mScheduledFrames = 0;
bool mPreparedOutputSchedule = false;
bool mInputStreamsStarted = false;
bool mScheduledPlaybackStarted = false;
VideoIOCompletionResult mLastCompletion = VideoIOCompletionResult::Unknown;
uint64_t mLastReadyQueueDepth = 0;
};
@@ -144,6 +168,9 @@ int main()
Expect(inputSeen, "fake input callback emits generic frame");
Expect(outputSeen, "fake output callback emits generic completion");
Expect(device.PreparedOutputSchedule(), "fake output schedule was prepared");
Expect(device.InputStreamsStarted(), "fake input streams started");
Expect(device.ScheduledPlaybackStarted(), "fake scheduled playback started");
Expect(device.ScheduledFrames() == 1, "fake backend schedules one frame");
Expect(device.LastCompletion() == VideoIOCompletionResult::Completed, "fake backend records generic completion");
Expect(device.LastReadyQueueDepth() == 2, "fake backend records ready queue depth");