-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(screencast):Unstable video frame rate due to accumulated timestam… #35777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Test results for "tests 1"17 failed 9 flaky39065 passed, 809 skipped Merge workflow run. |
@microsoft-github-policy-service agree [company="Tencent"] |
@microsoft-github-policy-service agree company="Tencent" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious to me that this improves our video recording logic. Can you add a test that clearly demonstrates the benefit?
|
||
const expectedFrames = Math.round(fps * (timestamp - this._firstFrameTimestamp)); | ||
|
||
const repeatCount = Math.max(0, expectedFrames - this._framesWritten); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be max(1,..
to not miss the frame.
this._isStopped = true; | ||
|
||
if (this._firstFrameTimestamp === null || !this._lastFrameBuffer) { | ||
if (this._gracefullyClose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback should never be null at this point. We didn't have this check before, why do you need it now?
|
||
const expectedFrames = Math.round(fps * (finalTimestamp - this._firstFrameTimestamp)); | ||
|
||
const repeatCount = Math.max(0, expectedFrames - this._framesWritten); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't lose frames, max(1,...
} | ||
|
||
if (repeatCount > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should stay under the if above, as that's where the queue is populated.
const repeatCount = Math.max(0, expectedFrames - this._framesWritten); | ||
|
||
for (let i = 0; i < repeatCount; ++i) | ||
this._frameQueue.push(this._lastFrameBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire enqueue logic is repeated twice and should be in a shared method.
…p (#35776)