fix: replay the last presented scope frame at the clip out point

这个提交包含在:
mac 于 2026-11-08 16:57:15 +08:00 提交
1 父节点 c791ddcb76
当前提交 98d80970e8
10 个文件已更改
+37 -35

没有与搜索条件相匹配的文件

+6 -9
查看文件
@@ -1,17 +1,14 @@
// Included in DYRenderer's implementation; final destination sampling is kept
// separate from the earlier input-analysis thumbnail used by auto-grade/LUTs.
- (void)setScopeProjectFrameDuration:(CMTime)duration{@synchronized(_previewLock){_scopeProjectFrameDuration=duration;}}
- (BOOL)scopeEnabled{@synchronized(_previewLock){return _scopeEnabled;}}
- (void)setScopeEnabled:(BOOL)enabled{[self setScopeEnabled:enabled atTime:kCMTimeInvalid frameDuration:kCMTimeInvalid];}
- (void)setScopeEnabled:(BOOL)enabled atTime:(CMTime)time frameDuration:(CMTime)frameDuration{
- (void)setScopeEnabled:(BOOL)enabled{[self setScopeEnabled:enabled atTime:kCMTimeInvalid frameDuration:kCMTimeInvalid exclusiveEnd:NO];}
- (void)setScopeEnabled:(BOOL)enabled atTime:(CMTime)time frameDuration:(CMTime)frameDuration exclusiveEnd:(BOOL)exclusiveEnd{
BOOL start=NO;@synchronized(_previewLock){if(_scopeEnabled==enabled)return;_scopeEnabled=enabled;_scopeGeneration++;[_scopePending release];_scopePending=nil;
if(enabled){
// Viewer output advances at project cadence even when the source is 60p.
if(CMTIME_IS_NUMERIC(_scopeProjectFrameDuration)&&_scopeProjectFrameDuration.value>0)frameDuration=_scopeProjectFrameDuration;
_scopeRequestedTime=time;_scopeRequestedFrameDuration=frameDuration;[_scopePreview release];_scopePreview=nil;[_scopeMetadata release];_scopeMetadata=nil;
_scopeRequestedTime=time;_scopeRequestedFrameDuration=frameDuration;_scopeRequestedExclusiveEnd=exclusiveEnd;[_scopePreview release];_scopePreview=nil;[_scopeMetadata release];_scopeMetadata=nil;
CMTime cached=_scopeLatest?CMTimeMakeWithEpoch([_scopeLatest.metadata[@"timeValue"]longLongValue],[_scopeLatest.metadata[@"timeScale"]intValue],[_scopeLatest.metadata[@"timeEpoch"]longLongValue]):kCMTimeInvalid;
BOOL replay=_scopeLatest&&(!CMTIME_IS_NUMERIC(time)||DYScopeFrameContainsTime(cached,time,frameDuration));
os_log(OS_LOG_DEFAULT,"dayu_scope_open requested=%{public}.9f cached=%{public}.9f frame=%{public}.9f replay=%{public}d",CMTimeGetSeconds(time),CMTimeGetSeconds(cached),CMTimeGetSeconds(frameDuration),replay);
BOOL replay=_scopeLatest&&(!CMTIME_IS_NUMERIC(time)||DYScopeFrameContainsTime(cached,time,frameDuration,exclusiveEnd));
os_log(OS_LOG_DEFAULT,"dayu_scope_open requested=%{public}.9f cached=%{public}.9f frame=%{public}.9f out=%{public}d replay=%{public}d",CMTimeGetSeconds(time),CMTimeGetSeconds(cached),CMTimeGetSeconds(frameDuration),exclusiveEnd,replay);
// Reuse this instance's final output when the host is still on that frame.
if(replay){DYScopeSample *sample=[DYScopeSample new];sample.pixels=_scopeLatest.pixels;sample.space=_scopeLatest.space;sample.metadata=_scopeLatest.metadata;sample.generation=_scopeGeneration;_scopePending=sample;if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}}
}
@@ -123,7 +120,7 @@
[_scopeLatest release];_scopeLatest=[sample retain];_scopeLatestSerial=readback.serial;
if(_outputObserved&&!_outputNotificationPending){_outputNotificationPending=YES;notifyOutput=YES;}
}
if(_scopeEnabled&&readback.serial==_scopeLatestSerial&&(readback.generation==_scopeGeneration||!CMTIME_IS_NUMERIC(_scopeRequestedTime)||DYScopeFrameContainsTime(time,_scopeRequestedTime,_scopeRequestedFrameDuration))){
if(_scopeEnabled&&readback.serial==_scopeLatestSerial&&(readback.generation==_scopeGeneration||!CMTIME_IS_NUMERIC(_scopeRequestedTime)||DYScopeFrameContainsTime(time,_scopeRequestedTime,_scopeRequestedFrameDuration,_scopeRequestedExclusiveEnd))){
sample.generation=_scopeGeneration;[_scopePending release];_scopePending=[sample retain];
if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}
}