mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-02 02:51:53 +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:
@@ -84,7 +84,7 @@ pub fn setup_parent_death_signal() {
|
||||
pub fn child_exit_when_parent_exit(child_process_id: u32) -> bool {
|
||||
unsafe {
|
||||
extern "C" {
|
||||
fn add_process_to_new_job(child_process_id: u32) -> i32;
|
||||
fn add_process_to_new_job(child_process_id: u32) -> i32;
|
||||
}
|
||||
let result = add_process_to_new_job(child_process_id);
|
||||
result == 0
|
||||
|
||||
@@ -3,7 +3,8 @@ use crate::{
|
||||
ffmpeg::{init_av_log, AVPixelFormat},
|
||||
ffmpeg_ram::{
|
||||
ffmpeg_linesize_offset_length, ffmpeg_ram_encode, ffmpeg_ram_free_encoder,
|
||||
ffmpeg_ram_new_encoder, ffmpeg_ram_request_keyframe, ffmpeg_ram_set_bitrate, CodecInfo, AV_NUM_DATA_POINTERS,
|
||||
ffmpeg_ram_new_encoder, ffmpeg_ram_request_keyframe, ffmpeg_ram_set_bitrate, CodecInfo,
|
||||
AV_NUM_DATA_POINTERS,
|
||||
},
|
||||
};
|
||||
use log::trace;
|
||||
@@ -123,6 +124,12 @@ impl Encoder {
|
||||
self.frames as *const _ as *const c_void,
|
||||
ms,
|
||||
);
|
||||
// ffmpeg_ram_encode returns AVERROR(EAGAIN) when the encoder accepts the frame
|
||||
// but does not output a packet yet (e.g., startup delay / internal buffering).
|
||||
// Treat this as a successful call with an empty output list.
|
||||
if result == -11 {
|
||||
return Ok(&mut *self.frames);
|
||||
}
|
||||
if result != 0 {
|
||||
return Err(result);
|
||||
}
|
||||
@@ -358,7 +365,8 @@ impl Encoder {
|
||||
if frames[0].key == 1 && elapsed < TEST_TIMEOUT_MS as _ {
|
||||
debug!(
|
||||
"Encoder {} test passed on attempt {}",
|
||||
codec.name, attempt + 1
|
||||
codec.name,
|
||||
attempt + 1
|
||||
);
|
||||
res.push(codec.clone());
|
||||
passed = true;
|
||||
|
||||
Reference in New Issue
Block a user