mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
feat(video): 事务化切换与前端统一编排,增强视频输入格式支持
- 后端:切换事务+transition_id,/stream/mode 返回 switching/transition_id 与实际 codec - 事件:新增 mode_switching/mode_ready,config/webrtc_ready/mode_changed 关联事务 - 编码/格式:扩展 NV21/NV16/NV24/RGB/BGR 输入与转换链路,RKMPP direct input 优化 - 前端:useVideoSession 统一切换,失败回退真实切回 MJPEG,菜单格式同步修复 - 清理:useVideoStream 降级为 MJPEG-only
This commit is contained in:
@@ -4,9 +4,9 @@ use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use tokio::sync::{broadcast, watch, Mutex};
|
||||
use tracing::{debug, error, info};
|
||||
use webrtc::rtp_transceiver::rtp_codec::RTCRtpCodecCapability;
|
||||
use webrtc::track::track_local::track_local_static_rtp::TrackLocalStaticRTP;
|
||||
use webrtc::track::track_local::TrackLocalWriter;
|
||||
use webrtc::rtp_transceiver::rtp_codec::RTCRtpCodecCapability;
|
||||
|
||||
use crate::video::frame::VideoFrame;
|
||||
|
||||
@@ -56,7 +56,9 @@ impl VideoCodecType {
|
||||
|
||||
pub fn sdp_fmtp(&self) -> &'static str {
|
||||
match self {
|
||||
VideoCodecType::H264 => "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",
|
||||
VideoCodecType::H264 => {
|
||||
"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"
|
||||
}
|
||||
VideoCodecType::VP8 => "",
|
||||
VideoCodecType::VP9 => "profile-id=0",
|
||||
}
|
||||
@@ -156,10 +158,7 @@ impl VideoTrack {
|
||||
}
|
||||
|
||||
/// Start sending frames from a broadcast receiver
|
||||
pub async fn start_sending(
|
||||
&self,
|
||||
mut frame_rx: broadcast::Receiver<VideoFrame>,
|
||||
) {
|
||||
pub async fn start_sending(&self, mut frame_rx: broadcast::Receiver<VideoFrame>) {
|
||||
let _ = self.running.send(true);
|
||||
let track = self.track.clone();
|
||||
let stats = self.stats.clone();
|
||||
|
||||
Reference in New Issue
Block a user