lowest latency option of queueSize slider

This commit is contained in:
True Zhuanjia committed 2026-02-19 13:23:30 +08:00
1 parent 47b5ec2678
commit 1626f30bb6
8 files changed
+45 -20

No files matched your search

+5 -5
View File
@@ -368,7 +368,7 @@
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="2" minValue="1" maxValue="5" minimumValueImage="1.square" catalog="system" maximumValueImage="5.square" translatesAutoresizingMaskIntoConstraints="NO" id="oZa-8Y-icz" userLabel="Frame Queue Size Slider"> <slider verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="2" minValue="0.0" maxValue="5" minimumValueImage="1.square" catalog="system" maximumValueImage="5.square" translatesAutoresizingMaskIntoConstraints="NO" id="oZa-8Y-icz" userLabel="Frame Queue Size Slider">
<rect key="frame" x="0.0" y="25.5" width="380" height="34"/> <rect key="frame" x="0.0" y="25.5" width="380" height="34"/>
</slider> </slider>
</subviews> </subviews>
@@ -3216,19 +3216,19 @@
<image name="tray.full.fill" catalog="system" width="128" height="88"/> <image name="tray.full.fill" catalog="system" width="128" height="88"/>
<image name="video.and.waveform" catalog="system" width="128" height="94"/> <image name="video.and.waveform" catalog="system" width="128" height="94"/>
<systemColor name="linkColor"> <systemColor name="linkColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="systemBrownColor"> <systemColor name="systemBrownColor">
<color red="0.67450980392156867" green="0.49803921568627452" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemGray3Color"> <systemColor name="systemGray3Color">
<color red="0.7803921568627451" green="0.7803921568627451" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.78039215689999997" green="0.78039215689999997" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemTealColor"> <systemColor name="systemTealColor">
<color red="0.0" green="0.76470588235294112" blue="0.81568627450980391" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>
+5 -5
View File
@@ -1925,7 +1925,7 @@
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="2" minValue="1" maxValue="5" minimumValueImage="1.square" catalog="system" maximumValueImage="5.square" translatesAutoresizingMaskIntoConstraints="NO" id="thv-JE-onX" userLabel="Frame Queue Size Selector"> <slider verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="2" minValue="0.0" maxValue="5" minimumValueImage="1.square" catalog="system" maximumValueImage="5.square" translatesAutoresizingMaskIntoConstraints="NO" id="thv-JE-onX" userLabel="Frame Queue Size Selector">
<rect key="frame" x="0.0" y="25.5" width="380" height="34"/> <rect key="frame" x="0.0" y="25.5" width="380" height="34"/>
</slider> </slider>
</subviews> </subviews>
@@ -3106,16 +3106,16 @@
<image name="trash.fill" catalog="system" width="117" height="128"/> <image name="trash.fill" catalog="system" width="117" height="128"/>
<image name="tray.full.fill" catalog="system" width="128" height="88"/> <image name="tray.full.fill" catalog="system" width="128" height="88"/>
<systemColor name="linkColor"> <systemColor name="linkColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemBrownColor"> <systemColor name="systemBrownColor">
<color red="0.67450980392156867" green="0.49803921568627452" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemGray2Color"> <systemColor name="systemGray2Color">
<color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.68235294120000001" green="0.68235294120000001" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemTealColor"> <systemColor name="systemTealColor">
<color red="0.0" green="0.76470588235294112" blue="0.81568627450980391" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>
+24 -1
View File
@@ -3577,7 +3577,7 @@
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "- 关闭 = 无帧步进控制,即为之前的“最低延迟”.\n\n- 传统模式,相当于之前的“最高流畅度” (尽管已经不是最流畅的选项)." "value" : "- 关闭 = 无帧步进控制,即为moonlight的“最低延迟”.\n\n- 传统模式,相当于之前的“最高流畅度” (尽管已经不是最流畅的选项)."
} }
}, },
"zh-Hant" : { "zh-Hant" : {
@@ -4481,6 +4481,29 @@
} }
} }
}, },
"lowest latency" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "最低延迟"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "最低延遲"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "最低延遲"
}
}
}
},
"Manual_Add_Host_Fail" : { "Manual_Add_Host_Fail" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
+1
View File
@@ -115,6 +115,7 @@
} }
- (void) setNeedRequeuing:(bool)needRequeuing{ - (void) setNeedRequeuing:(bool)needRequeuing{
if (_videoRenderer.queueSize==0) return;
[_videoRenderer.frameQueue clear]; [_videoRenderer.frameQueue clear];
_videoRenderer.needRequeuing = needRequeuing; _videoRenderer.needRequeuing = needRequeuing;
} }
+1
View File
@@ -20,6 +20,7 @@
@property (atomic, readonly) PlotMetrics frameQueueMetrics; @property (atomic, readonly) PlotMetrics frameQueueMetrics;
@property (atomic, assign) bool needRequeuing; @property (atomic, assign) bool needRequeuing;
@property (nonatomic, strong) FrameQueue* frameQueue; @property (nonatomic, strong) FrameQueue* frameQueue;
@property (atomic, readonly) int32_t queueSize;
@property (nonatomic, strong, readonly) AVSampleBufferDisplayLayer *displayLayer; @property (nonatomic, strong, readonly) AVSampleBufferDisplayLayer *displayLayer;
+5 -6
View File
@@ -52,7 +52,6 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size,
VTDecompressionSessionRef _decompressionSession; VTDecompressionSessionRef _decompressionSession;
CADisplayLink *_displayLink; CADisplayLink *_displayLink;
uint8_t queueSize;
NSInteger _maxRefreshRate; NSInteger _maxRefreshRate;
RenderingBackend _renderingBackend; RenderingBackend _renderingBackend;
@@ -145,13 +144,13 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size,
_asyncFrameDequeue = tempSettings.asyncFrameDequeue; _asyncFrameDequeue = tempSettings.asyncFrameDequeue;
NSLog(@"_asyncFrameDequeue %d", _asyncFrameDequeue); NSLog(@"_asyncFrameDequeue %d", _asyncFrameDequeue);
_enableTimebase = false; _enableTimebase = false;
queueSize = tempSettings.frameQueueSize.intValue; _queueSize = tempSettings.frameQueueSize.intValue;
_needRequeuing = true; _needRequeuing = _queueSize>0;
isIPhone = [Utils isIPhone]; isIPhone = [Utils isIPhone];
_frameQueue = [FrameQueue sharedInstance]; _frameQueue = [FrameQueue sharedInstance];
[_frameQueue start]; [_frameQueue start];
[_frameQueue setHighWaterMark:(int)[tempSettings.frameQueueSize integerValue]]; [_frameQueue setHighWaterMark:MAX(1, _queueSize)];
[self reinitializeDisplayLayer]; [self reinitializeDisplayLayer];
// NSTimeInterval interval = 1.0/tempSettings.framerate.intValue; // NSTimeInterval interval = 1.0/tempSettings.framerate.intValue;
@@ -310,8 +309,8 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit);
waitFor = 0.0f; waitFor = 0.0f;
} }
*/ */
if(_needRequeuing ? _frameQueue.count>queueSize-1 : true){ if(_needRequeuing ? _frameQueue.count>MAX(_queueSize-1,0) : true){
// if(true){ // if(true){
_needRequeuing = false; _needRequeuing = false;
if(_asyncFrameDequeue){ if(_asyncFrameDequeue){
@@ -1170,7 +1170,7 @@ static NSMutableSet* hostList;
self.navigationItem.leftBarButtonItems = @[_settingsButton]; self.navigationItem.leftBarButtonItems = @[_settingsButton];
if(streamFrameViewController.streamMan){ if(streamFrameViewController.streamMan){
NSLog(@"setNeedRequeuing %f", CACurrentMediaTime()); // NSLog(@"setNeedRequeuing %f", CACurrentMediaTime());
double delayInSeconds = 0.1; double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^{ dispatch_after(popTime, dispatch_get_main_queue(), ^{
@@ -1994,7 +1994,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self updateBitrateText]; [self updateBitrateText];
[self updateResolutionDisplayLabel]; [self updateResolutionDisplayLabel];
[self.frameQueueSizeSlider setMinimumValue:1]; [self.frameQueueSizeSlider setMinimumValue:0];
[self.frameQueueSizeSlider setMaximumValue:5]; [self.frameQueueSizeSlider setMaximumValue:5];
[self.frameQueueSizeSlider setValue:self->tempSettings.frameQueueSize.intValue]; [self.frameQueueSizeSlider setValue:self->tempSettings.frameQueueSize.intValue];
[self.frameQueueSizeSlider addTarget:self action:@selector(frameQueueSizeSliderMoved:) forControlEvents:UIControlEventValueChanged]; [self.frameQueueSizeSlider addTarget:self action:@selector(frameQueueSizeSliderMoved:) forControlEvents:UIControlEventValueChanged];
@@ -3381,7 +3381,8 @@ BOOL isCustomResolution(int resolutionSelected) {
- (void) frameQueueSizeSliderMoved:(UISlider* )sender { - (void) frameQueueSizeSliderMoved:(UISlider* )sender {
assert(self.frameQueueSizeSlider.value >= 0 && self.frameQueueSizeSlider.value <= 5); assert(self.frameQueueSizeSlider.value >= 0 && self.frameQueueSizeSlider.value <= 5);
[self findDynamicLabelFromStack:_frameQueueSizeStack].text = [NSString stringWithFormat:@" %d ", (int)self.frameQueueSizeSlider.value]; int queueSize = self.frameQueueSizeSlider.value;
[self findDynamicLabelFromStack:_frameQueueSizeStack].text = queueSize==0 ? [LocalizationHelper localizedStringForKey:@"lowest latency"] : [NSString stringWithFormat: @" %d ", queueSize];
} }
- (void) enableGraphsChanged:(UISwitch* )sender { - (void) enableGraphsChanged:(UISwitch* )sender {