fix: property inspector - read sample rate from node.latency, not node.rate
- node.rate was a PipeWire internal flag (always 1), not sample rate - Now reads from node.latency (format: '256/48000') for quantum + rate - Fallback to clock.rate if latency not available - Reuses rate field for ALSA period-size - Shows 'Latency: 256 samples @ 48000 Hz' and 'Period Size: 256'
This commit is contained in:
@@ -693,8 +693,8 @@
|
|||||||
{#if nd.sample_rate > 0}<tr><td class="pk">Sample Rate</td><td>{nd.sample_rate} Hz</td></tr>{/if}
|
{#if nd.sample_rate > 0}<tr><td class="pk">Sample Rate</td><td>{nd.sample_rate} Hz</td></tr>{/if}
|
||||||
{#if nd.channels > 0}<tr><td class="pk">Channels</td><td>{nd.channels}</td></tr>{/if}
|
{#if nd.channels > 0}<tr><td class="pk">Channels</td><td>{nd.channels}</td></tr>{/if}
|
||||||
{#if nd.format}<tr><td class="pk">Format</td><td>{nd.format}</td></tr>{/if}
|
{#if nd.format}<tr><td class="pk">Format</td><td>{nd.format}</td></tr>{/if}
|
||||||
{#if nd.quantum > 0}<tr><td class="pk">Quantum</td><td>{nd.quantum}</td></tr>{/if}
|
{#if nd.quantum > 0}<tr><td class="pk">Latency</td><td>{nd.quantum} samples @ {nd.sample_rate} Hz</td></tr>{/if}
|
||||||
{#if nd.rate > 0}<tr><td class="pk">Rate</td><td>{nd.rate}</td></tr>{/if}
|
{#if nd.rate > 0}<tr><td class="pk">Period Size</td><td>{nd.rate}</td></tr>{/if}
|
||||||
{#if nd.device_name}<tr><td class="pk">Device</td><td>{nd.device_name}</td></tr>{/if}
|
{#if nd.device_name}<tr><td class="pk">Device</td><td>{nd.device_name}</td></tr>{/if}
|
||||||
{#if nd.device_bus}<tr><td class="pk">Bus</td><td>{nd.device_bus}</td></tr>{/if}
|
{#if nd.device_bus}<tr><td class="pk">Bus</td><td>{nd.device_bus}</td></tr>{/if}
|
||||||
{#if nd.api}<tr><td class="pk">API</td><td>{nd.api}</td></tr>{/if}
|
{#if nd.api}<tr><td class="pk">API</td><td>{nd.api}</td></tr>{/if}
|
||||||
|
|||||||
@@ -125,8 +125,26 @@ static void on_node_info(void *data, const struct pw_node_info *info) {
|
|||||||
str = spa_dict_lookup(info->props, "priority.driver");
|
str = spa_dict_lookup(info->props, "priority.driver");
|
||||||
if (str) nobj->node.priority = atoi(str);
|
if (str) nobj->node.priority = atoi(str);
|
||||||
|
|
||||||
str = spa_dict_lookup(info->props, "node.rate");
|
// Latency info
|
||||||
if (str) nobj->node.rate = (uint32_t)atoi(str);
|
str = spa_dict_lookup(info->props, "node.latency");
|
||||||
|
if (str) {
|
||||||
|
// Format: "256/48000" -> quantum=256 rate=48000
|
||||||
|
uint32_t q = 0, r = 0;
|
||||||
|
if (sscanf(str, "%u/%u", &q, &r) == 2) {
|
||||||
|
nobj->node.quantum = q;
|
||||||
|
nobj->node.sample_rate = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: read clock rate from device props
|
||||||
|
if (nobj->node.sample_rate == 0) {
|
||||||
|
str = spa_dict_lookup(info->props, "clock.rate");
|
||||||
|
if (str) nobj->node.sample_rate = (uint32_t)atoi(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ALSA latency
|
||||||
|
str = spa_dict_lookup(info->props, "api.alsa.period-size");
|
||||||
|
if (str) nobj->node.rate = (uint32_t)atoi(str); // reuse rate field for period-size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user