[fix] accept web video settings and update MiniRTC QoS

This commit is contained in:
dijunkun
2026-10-16 13:44:24 +08:00
parent 33cbfa5b8a
commit 40670de954
3 changed files with 12 additions and 2 deletions
@@ -4,6 +4,7 @@
#include <app_version.h>
#include <remote_action.h>
#include <stream_names.h>
#include <nlohmann/json.hpp>
#include <algorithm>
@@ -233,7 +234,10 @@ void PeerEventHandler::OnReceiveDataBuffer(
return;
}
if (remote_action.type == ControlType::video_settings) {
if (source_id != runtime->control_data_label_ ||
// Web multiplexes its reliable control actions on a single DataChannel.
// Accept that transport's source alias while retaining controller admission.
if ((source_id != runtime->control_data_label_ &&
source_id != kWebControlStream) ||
!runtime->IsAuthorizedController(remote_id))
return;
const auto& settings = remote_action.vs;
@@ -242,6 +246,10 @@ void PeerEventHandler::OnReceiveDataBuffer(
runtime->peer_, remote_id.data(), remote_id.size(),
static_cast<VideoQuality>(settings.quality), settings.frame_rate,
static_cast<VideoDegradationPreference>(settings.preference)) == 0;
LOG_INFO("Video settings: peer={} source={} request={} quality={} fps={} "
"preference={} accepted={}",
remote_id, source_id, settings.request_id, settings.quality,
settings.frame_rate, settings.preference, remote_action.vs.accepted);
remote_action.type = ControlType::video_settings_status;
const auto message = remote_action.to_json();
SendReliableDataFrameToPeer(runtime->peer_, message.data(), message.size(),
+2
View File
@@ -16,6 +16,8 @@ inline constexpr char kDataStream[] = "data";
inline constexpr char kMouseStream[] = "mouse";
inline constexpr char kKeyboardStream[] = "keyboard";
inline constexpr char kControlStream[] = "control_data";
// MiniRTC's reliable WebRTC control channel uses this legacy callback source.
inline constexpr char kWebControlStream[] = "data-stream";
inline constexpr char kFileStream[] = "file";
inline constexpr char kFileFeedbackStream[] = "file_feedback";
inline constexpr char kClipboardStream[] = "clipboard";