Avoid network-scoped max-quality confirmations
Make RNDR_SRVR_MAX_AUDIO_QUALITY_CHANGED send network_type only when explicitly provided so controllers can treat the update as generic renderer quality.
This commit is contained in:
@@ -385,10 +385,12 @@ fn msg_volume_changed(volume: u64) -> Vec<u8> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// RNDR_SRVR_MAX_AUDIO_QUALITY_CHANGED (28): renderer confirms quality setting.
|
/// RNDR_SRVR_MAX_AUDIO_QUALITY_CHANGED (28): renderer confirms quality setting.
|
||||||
/// Includes maxAudioQuality (field 1) and networkType (field 2: 1=WIFI, 2=CELLULAR, 3=UNKNOWN).
|
/// networkType (field 2) is optional; when absent, quality applies generically.
|
||||||
fn msg_max_audio_quality_changed(quality: u64) -> Vec<u8> {
|
fn msg_max_audio_quality_changed(quality: u64, network_type: Option<u64>) -> Vec<u8> {
|
||||||
let mut payload = encode_field_varint(1, quality);
|
let mut payload = encode_field_varint(1, quality);
|
||||||
payload.extend(encode_field_varint(2, 1)); // networkType = WIFI
|
if let Some(network_type) = network_type {
|
||||||
|
payload.extend(encode_field_varint(2, network_type));
|
||||||
|
}
|
||||||
build_qconnect_message(28, &payload)
|
build_qconnect_message(28, &payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1312,7 +1314,7 @@ async fn run_connection(
|
|||||||
max_audio_quality = *quality;
|
max_audio_quality = *quality;
|
||||||
|
|
||||||
// Confirm quality change to server
|
// Confirm quality change to server
|
||||||
let resp = msg_max_audio_quality_changed(*quality as u64);
|
let resp = msg_max_audio_quality_changed(*quality as u64, None);
|
||||||
ws_tx.send(Message::Binary(build_payload_frame(msg_id, &resp).into())).await?;
|
ws_tx.send(Message::Binary(build_payload_frame(msg_id, &resp).into())).await?;
|
||||||
msg_id += 1;
|
msg_id += 1;
|
||||||
|
|
||||||
@@ -1390,6 +1392,11 @@ async fn run_connection(
|
|||||||
ws_tx.send(Message::Binary(build_payload_frame(msg_id, &dev_msg).into())).await?;
|
ws_tx.send(Message::Binary(build_payload_frame(msg_id, &dev_msg).into())).await?;
|
||||||
msg_id += 1;
|
msg_id += 1;
|
||||||
}
|
}
|
||||||
|
// Re-emit quality confirmation after successful restart
|
||||||
|
// so controllers observing the currently active stream update promptly.
|
||||||
|
let confirm = msg_max_audio_quality_changed(*quality as u64, None);
|
||||||
|
ws_tx.send(Message::Binary(build_payload_frame(msg_id, &confirm).into())).await?;
|
||||||
|
msg_id += 1;
|
||||||
current_buffer_state = 2; // OK(2)
|
current_buffer_state = 2; // OK(2)
|
||||||
info!("Restarted at format_id={}", format_id);
|
info!("Restarted at format_id={}", format_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user