Use a valid seed-only analysis range at backward boundary; host deadlock fix awaiting formal validation

这个提交包含在:
mac 于 2026-11-02 01:43:59 +08:00 提交
1 父节点 b3176f854d
当前提交 123a6c8507
7 个文件已更改
+13 -10

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

+1 -1
查看文件
@@ -61,7 +61,7 @@
}
- (BOOL)desiredAnalysisTimeRange:(CMTimeRange*)out forInputWithTimeRange:(CMTimeRange)input error:(NSError**)error {
CMTime end=CMTimeRangeGetEnd(input),ref=_trackingReferenceTime,step=_trackingFrameDuration;if(!CMTIME_IS_NUMERIC(input.start)||!CMTIME_IS_NUMERIC(end)||!CMTIME_IS_NUMERIC(ref)||ref.epoch!=input.start.epoch||ref.epoch!=end.epoch||CMTimeCompare(ref,input.start)<0||CMTimeCompare(ref,end)>=0||!CMTIME_IS_NUMERIC(step)||step.value<=0)return [self stopToolAnalysis:@"跟踪起点或帧长无效" error:error];
CMTime lo=_trackingBackward?input.start:ref,hi=_trackingBackward?CMTimeAdd(ref,step):end;if(_trackingSingle){if(_trackingBackward){lo=CMTimeSubtract(ref,step);if(CMTimeCompare(lo,input.start)<0)lo=input.start;}else hi=CMTimeAdd(ref,CMTimeMultiply(step,2));}if(CMTimeCompare(hi,end)>0)hi=end;if(_trackingBackward&&CMTimeCompare(ref,input.start)==0)return [self finishToolAnalysis:@"已到片段边界,未产生新轨迹" error:error];*out=CMTimeRangeFromTimeToTime(lo,hi);return out->duration.value>0;
CMTime lo=_trackingBackward?input.start:ref,hi=_trackingBackward?CMTimeAdd(ref,step):end;if(_trackingSingle){if(_trackingBackward){lo=CMTimeSubtract(ref,step);if(CMTimeCompare(lo,input.start)<0)lo=input.start;}else hi=CMTimeAdd(ref,CMTimeMultiply(step,2));}if(CMTimeCompare(hi,end)>0)hi=end;if(_trackingBackward&&CMTimeCompare(ref,input.start)==0&&!_trackingBoth){[_trackingMessage release];_trackingMessage=[@"已到片段边界,未产生新轨迹" copy];}*out=CMTimeRangeFromTimeToTime(lo,hi);return out->duration.value>0;
}
- (BOOL)setupAnalysisForTimeRange:(CMTimeRange)range frameDuration:(CMTime)duration error:(NSError**)error {
if(!CMTIME_IS_NUMERIC(duration)||duration.value<=0||duration.epoch!=0)return [self stopToolAnalysis:@"宿主分析帧长无效" error:error];_trackingFrameDuration=duration;_trackingPreviousTime=kCMTimeInvalid;_trackingFlip=NO;[_trackingSamples removeAllObjects];auto backend=DYToolCreateMetalFlow([[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"],error);if(!backend)return [self stopToolAnalysis:@"Metal 跟踪后端无法启动" error:error];_toolTracker.setBackend(backend);
@@ -23,7 +23,7 @@
// An expected loss must end the host job, not only our local tracking state.
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}
Pixels flat(tw*th*4,.1f);for(size_t i=3;i<flat.size();i+=4)flat[i]=1;[[frame metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,tw,th) mipmapLevel:0 withBytes:flat.data() bytesPerRow:tw*8];NSError *lossError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(3) error:&lossError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"texture-loss-keeps-prefix-and-sends-sdk-quiet-termination",callbacks&&stopped&&[tracked[@"keys"]count]==3&&[lossError.domain isEqual:FxPlugErrorDomain]&&lossError.code==kFxError_UserCancelled);
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(-1);NSError *boundaryError=nil;stopped=![plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:&boundaryError];drain();run.record(@"boundary-stop-sends-sdk-quiet-analysis-termination",stopped&&[boundaryError.domain isEqual:FxPlugErrorDomain]&&boundaryError.code==kFxError_UserCancelled);
DYWriteTools(base,doc,kCMTimeZero);capture(0);request(-1);NSError *boundaryError=nil;callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:&boundaryError]&&CMTimeCompare(desired.start,kCMTimeZero)==0&&CMTimeCompare(desired.duration,timeAt(1))==0&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:&boundaryError];setFrame(0);callbacks&=[plugin analyzeFrame:frame atTime:kCMTimeZero error:&boundaryError];host->_state=kFxAnalysisState_AnalysisCompleted;[plugin cleanupAnalysis:nil];drain();run.record(@"boundary-seed-only-range-completes-without-author-write-or-rejected-range",callbacks&&!boundaryError&&[DYReadTools(base,kCMTimeZero).document isEqual:doc]);
NSError *lateError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&lateError];run.record(@"late-analysis-frame-also-terminates-host-job-quietly",stopped&&[lateError.domain isEqual:FxPlugErrorDomain]&&lateError.code==kFxError_UserCancelled);
// A host cache hit can move the playhead without re-entering renderDestinationImage.
// Starting at a middle frame must use analyzer input even on a fresh instance.
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.2</string>
<key>CFBundleVersion</key>
<string>30</string>
<string>31</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>