123
This commit is contained in:
parent
b5da99ae9e
commit
a63abac88a
|
@ -8,7 +8,7 @@
|
|||
<NoWarn>$(NoWarn);0067</NoWarn>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject />
|
||||
<StartupObject></StartupObject>
|
||||
<Platforms>AnyCPU;x64;x86</Platforms>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -17,6 +17,7 @@ using Window = System.Windows.Window;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Windows.Data;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace JianGongYun.TRTC
|
||||
{
|
||||
|
@ -99,12 +100,6 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
lTRTCCloud.stopSystemAudioLoopback();
|
||||
}
|
||||
var encParams = settingWindowViewModel.EncParams;
|
||||
var qosParams = settingWindowViewModel.QosParams;
|
||||
var renderParams = settingWindowViewModel.RenderParams;
|
||||
lTRTCCloud.setVideoEncoderParam(ref encParams);
|
||||
lTRTCCloud.setNetworkQosParam(ref qosParams);
|
||||
lTRTCCloud.setLocalRenderParams(ref renderParams);
|
||||
//设备完结
|
||||
|
||||
//liveWinMode.LoadAllScreen();
|
||||
|
@ -148,6 +143,12 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
if (!liveWinMode.CameraRunning)
|
||||
{
|
||||
var encParams = settingWindowViewModel.MainEncParams;
|
||||
var qosParams = settingWindowViewModel.MainQosParams;
|
||||
var renderParams = settingWindowViewModel.MainRenderParams;
|
||||
lTRTCCloud.setVideoEncoderParam(ref encParams);
|
||||
lTRTCCloud.setNetworkQosParam(ref qosParams);
|
||||
lTRTCCloud.setLocalRenderParams(ref renderParams);
|
||||
lTRTCCloud.startLocalPreview(IntPtr.Zero);
|
||||
liveWinMode.CameraRunning = true;
|
||||
var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeBig, true);
|
||||
|
@ -186,7 +187,7 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
liveWinMode.ScreenRunning = true;
|
||||
SelectVieoSub();
|
||||
lTRTCCloud.startScreenCapture(IntPtr.Zero, TRTCVideoStreamType.TRTCVideoStreamTypeSub, settingWindowViewModel.EncParams);
|
||||
lTRTCCloud.startScreenCapture(IntPtr.Zero, TRTCVideoStreamType.TRTCVideoStreamTypeSub, settingWindowViewModel.SubEncParams);
|
||||
var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeSub, true);
|
||||
if (liveWinMode.IsLive)
|
||||
{
|
||||
|
@ -234,7 +235,7 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
liveWinMode.AudioRecordRunning = true;
|
||||
var time = Util.TimeStr();
|
||||
var pars = new TRTCAudioRecordingParams { filePath = Path.Combine(RecoderDir, $"{time}audio.pcm") };
|
||||
var pars = new TRTCAudioRecordingParams { filePath = Path.Combine(RecoderDir, $"{time}audio.wav") };
|
||||
var res = lTRTCCloud.startAudioRecording(ref pars);
|
||||
Console.WriteLine(res);
|
||||
}
|
||||
|
@ -272,10 +273,15 @@ namespace JianGongYun.TRTC
|
|||
public static void VedioRecordTask(TXLiteAVVideoView view, TRTCVideoStreamType streamType)
|
||||
{
|
||||
var end = false;
|
||||
Stopwatch sw1 = new Stopwatch();
|
||||
Stopwatch sw2 = new Stopwatch();
|
||||
ConcurrentQueue<Mat> bitmaps = new ConcurrentQueue<Mat>();
|
||||
view.OnRenderVideoFrameHandler += (b) =>
|
||||
{
|
||||
sw1.Restart();
|
||||
bitmaps.Enqueue(b.ToMat());
|
||||
sw1.Stop();
|
||||
//Debug.Print("a" + sw1.Elapsed.TotalMilliseconds.ToString());
|
||||
};
|
||||
view.OnViewRemove += () =>
|
||||
{
|
||||
|
@ -289,6 +295,13 @@ namespace JianGongYun.TRTC
|
|||
var videoFile = Path.Combine(_recoderDir, $"{Util.TimeStr()}_{streamType}.avi");
|
||||
VideoWriter vw = new VideoWriter();
|
||||
bool videoWriterInit = false;
|
||||
var frameCount = 0;
|
||||
Timer timer = new Timer((a) =>
|
||||
{
|
||||
//Console.WriteLine($"{streamType} fps {frameCount}");
|
||||
Debug.Print($"{streamType} fps {frameCount}");
|
||||
Interlocked.Exchange(ref frameCount, 0);
|
||||
}, null, 0, 1000);
|
||||
while (!end || bitmaps.Count > 0)
|
||||
{
|
||||
if (bitmaps.Count == 0)
|
||||
|
@ -298,6 +311,7 @@ namespace JianGongYun.TRTC
|
|||
}
|
||||
if (bitmaps.TryDequeue(out var mat))
|
||||
{
|
||||
sw2.Restart();
|
||||
//mat.SaveImage(imgTemp);
|
||||
//mat.Dispose();
|
||||
//mat = Cv2.ImRead(imgTemp, ImreadModes.AnyColor);
|
||||
|
@ -305,11 +319,13 @@ namespace JianGongYun.TRTC
|
|||
//Cv2.WaitKey(1);
|
||||
if (!videoWriterInit)
|
||||
{
|
||||
vw.Open(videoFile, FourCC.H264, settingWindowViewModel.EncParams.videoFps, mat.Size());
|
||||
vw.Open(videoFile, FourCC.H264, settingWindowViewModel.LiveFps, mat.Size());
|
||||
videoWriterInit = true;
|
||||
}
|
||||
vw.Write(mat);
|
||||
mat.Dispose();
|
||||
Interlocked.Increment(ref frameCount);
|
||||
//Debug.Print("b"+sw2.Elapsed.TotalMilliseconds.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -322,6 +338,7 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
File.Delete(imgTemp);
|
||||
}
|
||||
timer.Dispose();
|
||||
Console.WriteLine($"VedioRecordTask End {streamType}");
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
}
|
||||
|
@ -333,7 +350,7 @@ namespace JianGongYun.TRTC
|
|||
{
|
||||
TXLiteAVVideoView videoView = new TXLiteAVVideoView();
|
||||
videoView.RegEngine(userId, streamType, lTRTCCloud, local);
|
||||
videoView.SetRenderMode(streamType == TRTCVideoStreamType.TRTCVideoStreamTypeBig ? settingWindowViewModel.RenderParams.fillMode : TRTCVideoFillMode.TRTCVideoFillMode_Fit);
|
||||
videoView.SetRenderMode(streamType == TRTCVideoStreamType.TRTCVideoStreamTypeBig ? settingWindowViewModel.MainRenderParams.fillMode : settingWindowViewModel.SubRenderParams.fillMode);
|
||||
//videoView.Width = parent.ActualWidth;
|
||||
videoView.SetBinding(TXLiteAVVideoView.WidthProperty, new Binding("ActualWidth") { Source = parent });
|
||||
//videoView.Height = parent.ActualHeight;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace JianGongYun.TRTC.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 直播画质
|
||||
/// </summary>
|
||||
public enum LiveLevelEnum
|
||||
{
|
||||
Low = 0,
|
||||
Mormal,
|
||||
High
|
||||
}
|
||||
}
|
|
@ -73,7 +73,7 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
|
||||
public LiveWindowViewModel()
|
||||
{
|
||||
timer = new DispatcherTimer();
|
||||
timer = new DispatcherTimer(DispatcherPriority.Render);
|
||||
timer.Interval = TimeSpan.FromSeconds(1);
|
||||
timer.Tick += new EventHandler((a, b) => LiveTimeCount = "");
|
||||
}
|
||||
|
|
|
@ -308,125 +308,125 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
|
||||
#region 录屏属性
|
||||
|
||||
/// <summary>
|
||||
/// 视频帧率(fps)
|
||||
/// </summary>
|
||||
private string _ScreenRecordingFps = "60";
|
||||
public string ScreenRecordingFps
|
||||
{
|
||||
get
|
||||
{
|
||||
var screenRecordingFps = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS);//本地缓存
|
||||
if (string.IsNullOrEmpty(screenRecordingFps))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS, _ScreenRecordingFps);//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScreenRecordingFps = screenRecordingFps;
|
||||
}
|
||||
return _ScreenRecordingFps;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ScreenRecordingFps = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS, value);//生成保存本地
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingFps"));
|
||||
}
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// 视频帧率(fps)
|
||||
///// </summary>
|
||||
//private string _ScreenRecordingFps = "60";
|
||||
//public string ScreenRecordingFps
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// var screenRecordingFps = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS);//本地缓存
|
||||
// if (string.IsNullOrEmpty(screenRecordingFps))
|
||||
// {
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS, _ScreenRecordingFps);//生成初始数据
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _ScreenRecordingFps = screenRecordingFps;
|
||||
// }
|
||||
// return _ScreenRecordingFps;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _ScreenRecordingFps = value;
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_FPS, value);//生成保存本地
|
||||
// if (PropertyChanged != null)
|
||||
// {
|
||||
// PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingFps"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 音频码率
|
||||
/// </summary>
|
||||
private string _ScreenRecordingAudioBitrate = "320000";
|
||||
public string ScreenRecordingAudioBitrate
|
||||
{
|
||||
get
|
||||
{
|
||||
var screenRecordingAudioBitrate = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE);//本地缓存
|
||||
if (string.IsNullOrEmpty(screenRecordingAudioBitrate))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE, _ScreenRecordingAudioBitrate);//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScreenRecordingAudioBitrate = screenRecordingAudioBitrate;
|
||||
}
|
||||
return _ScreenRecordingAudioBitrate;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ScreenRecordingAudioBitrate = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE, value);//生成保存本地
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingAudioBitrate"));
|
||||
}
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// 音频码率
|
||||
///// </summary>
|
||||
//private string _ScreenRecordingAudioBitrate = "320000";
|
||||
//public string ScreenRecordingAudioBitrate
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// var screenRecordingAudioBitrate = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE);//本地缓存
|
||||
// if (string.IsNullOrEmpty(screenRecordingAudioBitrate))
|
||||
// {
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE, _ScreenRecordingAudioBitrate);//生成初始数据
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _ScreenRecordingAudioBitrate = screenRecordingAudioBitrate;
|
||||
// }
|
||||
// return _ScreenRecordingAudioBitrate;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _ScreenRecordingAudioBitrate = value;
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE, value);//生成保存本地
|
||||
// if (PropertyChanged != null)
|
||||
// {
|
||||
// PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingAudioBitrate"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 音频采样率
|
||||
/// </summary>
|
||||
private string _ScreenRecordingAudioFreq = "48000";
|
||||
public string ScreenRecordingAudioFreq
|
||||
{
|
||||
get
|
||||
{
|
||||
var screenRecordingAudioFreq = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ);//本地缓存
|
||||
if (string.IsNullOrEmpty(screenRecordingAudioFreq))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ, _ScreenRecordingAudioFreq);//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScreenRecordingAudioFreq = screenRecordingAudioFreq;
|
||||
}
|
||||
return _ScreenRecordingAudioFreq;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ScreenRecordingAudioFreq = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ, value);//生成保存本地
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingAudioFreq"));
|
||||
}
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// 音频采样率
|
||||
///// </summary>
|
||||
//private string _ScreenRecordingAudioFreq = "48000";
|
||||
//public string ScreenRecordingAudioFreq
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// var screenRecordingAudioFreq = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ);//本地缓存
|
||||
// if (string.IsNullOrEmpty(screenRecordingAudioFreq))
|
||||
// {
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ, _ScreenRecordingAudioFreq);//生成初始数据
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _ScreenRecordingAudioFreq = screenRecordingAudioFreq;
|
||||
// }
|
||||
// return _ScreenRecordingAudioFreq;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _ScreenRecordingAudioFreq = value;
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_AUDIO_FREQ, value);//生成保存本地
|
||||
// if (PropertyChanged != null)
|
||||
// {
|
||||
// PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingAudioFreq"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 编码级别
|
||||
/// </summary>
|
||||
private string _ScreenRecordingProfileLevel = "-profile:v high -level 5.1";
|
||||
public string ScreenRecordingProfileLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
var screenRecordingProfileLevel = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL);//本地缓存
|
||||
if (string.IsNullOrEmpty(screenRecordingProfileLevel))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL, _ScreenRecordingProfileLevel);//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScreenRecordingProfileLevel = screenRecordingProfileLevel;
|
||||
}
|
||||
return _ScreenRecordingProfileLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ScreenRecordingProfileLevel = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL, value);//生成保存本地
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingProfileLevel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// 编码级别
|
||||
///// </summary>
|
||||
//private string _ScreenRecordingProfileLevel = "-profile:v high -level 5.1";
|
||||
//public string ScreenRecordingProfileLevel
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// var screenRecordingProfileLevel = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL);//本地缓存
|
||||
// if (string.IsNullOrEmpty(screenRecordingProfileLevel))
|
||||
// {
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL, _ScreenRecordingProfileLevel);//生成初始数据
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _ScreenRecordingProfileLevel = screenRecordingProfileLevel;
|
||||
// }
|
||||
// return _ScreenRecordingProfileLevel;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _ScreenRecordingProfileLevel = value;
|
||||
// storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL, value);//生成保存本地
|
||||
// if (PropertyChanged != null)
|
||||
// {
|
||||
// PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingProfileLevel"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 录制倒计时
|
||||
|
@ -536,7 +536,7 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
var liveFps = storage.GetValue(INI_ROOT_KEY, INI_KEY_LIVE_FPS);//本地缓存
|
||||
if (string.IsNullOrEmpty(liveFps))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_MAIN_FPS, _LiveFps.ToString());//生成初始数据
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_FPS, _LiveFps.ToString());//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -556,10 +556,42 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 摄像画面级别
|
||||
/// 网络调控策略
|
||||
/// </summary>
|
||||
private TRTCVideoQosPreference _LiveMainLevel = TRTCVideoQosPreference.TRTCVideoQosPreferenceClear;
|
||||
public TRTCVideoQosPreference LiveMainLevel
|
||||
private TRTCVideoQosPreference _LiveMainQos = TRTCVideoQosPreference.TRTCVideoQosPreferenceClear;
|
||||
public TRTCVideoQosPreference LiveMainQos
|
||||
{
|
||||
get
|
||||
{
|
||||
var liveMainQos = storage.GetValue(INI_ROOT_KEY, INI_KEY_LIVE_MAIN_QOS);//本地缓存
|
||||
if (string.IsNullOrEmpty(liveMainQos))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_MAIN_QOS, _LiveMainQos.ToString());//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_LiveMainQos = (TRTCVideoQosPreference)Enum.Parse(typeof(TRTCVideoQosPreference), liveMainQos);
|
||||
}
|
||||
return _LiveMainQos;
|
||||
}
|
||||
set
|
||||
{
|
||||
_LiveMainQos = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_MAIN_QOS, value.ToString());//生成保存本地
|
||||
//var pars = MainQosParams;
|
||||
//LiveClassroom.lTRTCCloud.setNetworkQosParam(ref pars);//重设参数
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("LiveMainQos"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 摄像头画质
|
||||
/// </summary>
|
||||
private LiveLevelEnum _LiveMainLevel = LiveLevelEnum.High;
|
||||
public LiveLevelEnum LiveMainLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -570,7 +602,7 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
_LiveMainLevel = (TRTCVideoQosPreference)Enum.Parse(typeof(TRTCVideoQosPreference), liveMainLevel);
|
||||
_LiveMainLevel = (LiveLevelEnum)Enum.Parse(typeof(LiveLevelEnum), liveMainLevel);
|
||||
}
|
||||
return _LiveMainLevel;
|
||||
}
|
||||
|
@ -578,14 +610,41 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
{
|
||||
_LiveMainLevel = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_MAIN_LEVEL, value.ToString());//生成保存本地
|
||||
var pars = QosParams;
|
||||
LiveClassroom.lTRTCCloud.setNetworkQosParam(ref pars);//重设参数
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("LiveMainLevel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 屏幕分享画质
|
||||
/// </summary>
|
||||
private LiveLevelEnum _LiveSubLevel = LiveLevelEnum.High;
|
||||
public LiveLevelEnum LiveSubLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
var liveSubLevel = storage.GetValue(INI_ROOT_KEY, INI_KEY_LIVE_SUB_LEVEL);//本地缓存
|
||||
if (string.IsNullOrEmpty(liveSubLevel))
|
||||
{
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_SUB_LEVEL, _LiveSubLevel.ToString());//生成初始数据
|
||||
}
|
||||
else
|
||||
{
|
||||
_LiveSubLevel = (LiveLevelEnum)Enum.Parse(typeof(LiveLevelEnum), liveSubLevel);
|
||||
}
|
||||
return _LiveSubLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
_LiveSubLevel = value;
|
||||
storage.SetValue(INI_ROOT_KEY, INI_KEY_LIVE_SUB_LEVEL, value.ToString());//生成保存本地
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs("LiveSubLevel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 摄像画面帧率
|
||||
|
@ -711,27 +770,71 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
#endregion
|
||||
|
||||
#region 参数
|
||||
public TRTCVideoEncParam EncParams
|
||||
public TRTCVideoEncParam MainEncParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return new TRTCVideoEncParam { enableAdjustRes = false, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape, videoBitrate = LiveMainBitrate, videoFps = LiveMainFps };
|
||||
var videoResolution = TRTCVideoResolution.TRTCVideoResolution_1280_720;
|
||||
uint videoBitrate = 1600;
|
||||
switch (LiveMainLevel)
|
||||
{
|
||||
case LiveLevelEnum.Low:
|
||||
videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_480;
|
||||
videoBitrate = 600;
|
||||
break;
|
||||
case LiveLevelEnum.Mormal:
|
||||
videoResolution = TRTCVideoResolution.TRTCVideoResolution_960_720;
|
||||
videoBitrate = 1000;
|
||||
break;
|
||||
case LiveLevelEnum.High:
|
||||
break;
|
||||
}
|
||||
return new TRTCVideoEncParam { enableAdjustRes = false, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape, videoResolution = videoResolution, minVideoBitrate = videoBitrate, videoBitrate = videoBitrate, videoFps = LiveFps };
|
||||
}
|
||||
}
|
||||
public TRTCNetworkQosParam QosParams
|
||||
public TRTCVideoEncParam SubEncParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return new TRTCNetworkQosParam { preference = LiveMainLevel };
|
||||
var videoResolution = TRTCVideoResolution.TRTCVideoResolution_1920_1080;
|
||||
uint videoBitrate = 2000;
|
||||
switch (LiveMainLevel)
|
||||
{
|
||||
case LiveLevelEnum.Low:
|
||||
videoResolution = TRTCVideoResolution.TRTCVideoResolution_960_540;
|
||||
videoBitrate = 850;
|
||||
break;
|
||||
case LiveLevelEnum.Mormal:
|
||||
videoResolution = TRTCVideoResolution.TRTCVideoResolution_1280_720;
|
||||
videoBitrate = 1600;
|
||||
break;
|
||||
case LiveLevelEnum.High:
|
||||
break;
|
||||
}
|
||||
return new TRTCVideoEncParam { enableAdjustRes = false, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape, videoResolution = videoResolution, minVideoBitrate = videoBitrate, videoBitrate = videoBitrate, videoFps = LiveFps };
|
||||
}
|
||||
}
|
||||
public TRTCRenderParams RenderParams
|
||||
public TRTCNetworkQosParam MainQosParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return new TRTCNetworkQosParam { preference = LiveMainQos };
|
||||
}
|
||||
}
|
||||
public TRTCRenderParams MainRenderParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return new TRTCRenderParams { fillMode = TRTCVideoFillMode.TRTCVideoFillMode_Fill, mirrorType = TRTCVideoMirrorType.TRTCVideoMirrorType_Enable, rotation = TRTCVideoRotation.TRTCVideoRotation0 };
|
||||
}
|
||||
}
|
||||
public TRTCRenderParams SubRenderParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return new TRTCRenderParams { fillMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit, mirrorType = TRTCVideoMirrorType.TRTCVideoMirrorType_Enable, rotation = TRTCVideoRotation.TRTCVideoRotation0 };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 磁盘剩余空间
|
||||
|
@ -788,24 +891,26 @@ namespace JianGongYun.TRTC.ViewModels
|
|||
private const string INI_KEY_CHOOSE_MIC = "INI_KEY_CHOOSE_MIC";//当前麦克风
|
||||
private const string INI_KEY_CHOOSE_CAMERA = "INI_KEY_CHOOSE_CAMERA";//当前摄像头
|
||||
private const string INI_KEY_AUDIO_MIC_VOLUME = "INI_KEY_AUDIO_MIC_VOLUME";//麦克风音量
|
||||
private const string INI_KEY_AUDIO_SPEAKER_VOLUME = "INI_KEY_AUDIO_SOURCE";//播放音量
|
||||
//private const string INI_KEY_AUDIO_SPEAKER_VOLUME = "INI_KEY_AUDIO_SOURCE";//播放音量
|
||||
private const string INI_KEY_AUDIO_SOURCE = "INI_KEY_AUDIO_SOURCE";//音频来源
|
||||
private const string INI_KEY_AUDIO_SYSTEM_GATHER_VOLUME = "INI_KEY_AUDIO_SYSTEM_GATHER_VOLUME";//麦克风音量
|
||||
//录屏
|
||||
private const string INI_KEY_SCREEN_RECORDING_FPS = "INI_KEY_SCREEN_RECORDING_FPS";//视频帧率(fps)
|
||||
private const string INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE = "INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE";//音频码率
|
||||
private const string INI_KEY_SCREEN_RECORDING_AUDIO_FREQ = "INI_KEY_SCREEN_RECORDING_AUDIO_FREQ";//音频采样率
|
||||
private const string INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL = "INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL";//编码级别
|
||||
//private const string INI_KEY_SCREEN_RECORDING_FPS = "INI_KEY_SCREEN_RECORDING_FPS";//视频帧率(fps)
|
||||
//private const string INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE = "INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE";//音频码率
|
||||
//private const string INI_KEY_SCREEN_RECORDING_AUDIO_FREQ = "INI_KEY_SCREEN_RECORDING_AUDIO_FREQ";//音频采样率
|
||||
//private const string INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL = "INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL";//编码级别
|
||||
private const string INI_KEY_SCREEN_RECORDING_COUNTDOWN = "INI_KEY_SCREEN_RECORDING_COUNTDOWN";//录制倒计时
|
||||
private const string INI_KEY_SCREEN_RECORDING_DIR = "INI_KEY_SCREEN_RECORDING_DIR";//录制保存路径
|
||||
//直播
|
||||
private const string INI_KEY_LIVE_AUDIO_LEVEL = "INI_KEY_LIVE_AUDIO_LEVEL";//直播音频等级
|
||||
private const string INI_KEY_LIVE_FPS = "INI_KEY_LIVE_FPS";//直播帧率
|
||||
private const string INI_KEY_LIVE_MAIN_FPS = "INI_KEY_LIVE_MAIN_FPS";//直播主帧率
|
||||
private const string INI_KEY_LIVE_MAIN_BITTRATE = "INI_KEY_LIVE_MAIN_BITTRATE";//直播主码率
|
||||
private const string INI_KEY_LIVE_MAIN_LEVEL = "INI_KEY_LIVE_MAIN_LEVEL";//主画面级别
|
||||
private const string INI_KEY_LIVE_SUB_FPS = "INI_KEY_LIVE_SUB_FPS";//屏幕分享帧率
|
||||
private const string INI_KEY_LIVE_SUB_BITTRATE = "INI_KEY_LIVE_SUB_BITTRATE";//屏幕分享码率
|
||||
//private const string INI_KEY_LIVE_MAIN_FPS = "INI_KEY_LIVE_MAIN_FPS";//直播主帧率
|
||||
//private const string INI_KEY_LIVE_MAIN_BITTRATE = "INI_KEY_LIVE_MAIN_BITTRATE";//直播主码率
|
||||
private const string INI_KEY_LIVE_MAIN_QOS = "INI_KEY_LIVE_MAIN_QOS";//网络调控策略
|
||||
private const string INI_KEY_LIVE_MAIN_LEVEL = "INI_KEY_LIVE_MAIN_LEVEL";//摄像头画质
|
||||
private const string INI_KEY_LIVE_SUB_LEVEL = "INI_KEY_LIVE_SUB_LEVEL";//屏幕画质
|
||||
//private const string INI_KEY_LIVE_SUB_FPS = "INI_KEY_LIVE_SUB_FPS";//屏幕分享帧率
|
||||
//private const string INI_KEY_LIVE_SUB_BITTRATE = "INI_KEY_LIVE_SUB_BITTRATE";//屏幕分享码率
|
||||
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -139,16 +139,32 @@
|
|||
<ComboBoxItem Content="12" />
|
||||
<ComboBoxItem Content="15" />
|
||||
<ComboBoxItem Content="20" />
|
||||
<ComboBoxItem Content="24" />
|
||||
<!--<ComboBoxItem Content="24" />-->
|
||||
</Metro:AduComboBox>
|
||||
</DockPanel>
|
||||
<DockPanel Style="{StaticResource SettingItem}">
|
||||
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 网络调控策略</TextBlock>
|
||||
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding Path=LiveMainLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
|
||||
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding Path=LiveMainQos}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
|
||||
<ComboBoxItem Content="弱网下保流畅" Tag="TRTCVideoQosPreferenceSmooth" />
|
||||
<ComboBoxItem Content="弱网下保清晰" Tag="TRTCVideoQosPreferenceClear"/>
|
||||
</Metro:AduComboBox>
|
||||
</DockPanel>
|
||||
<DockPanel Style="{StaticResource SettingItem}">
|
||||
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 摄像头画质</TextBlock>
|
||||
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveMainLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
|
||||
<ComboBoxItem Content="低" Tag="Low" />
|
||||
<ComboBoxItem Content="中" Tag="Mormal"/>
|
||||
<ComboBoxItem Content="高" Tag="High"/>
|
||||
</Metro:AduComboBox>
|
||||
</DockPanel>
|
||||
<DockPanel Style="{StaticResource SettingItem}">
|
||||
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 屏幕分享画质</TextBlock>
|
||||
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveSubLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
|
||||
<ComboBoxItem Content="低" Tag="Low" />
|
||||
<ComboBoxItem Content="中" Tag="Mormal"/>
|
||||
<ComboBoxItem Content="高" Tag="High"/>
|
||||
</Metro:AduComboBox>
|
||||
</DockPanel>
|
||||
<!--<DockPanel Style="{StaticResource SettingItem}">
|
||||
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 摄像画面帧率(fps)</TextBlock>
|
||||
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Content" SelectedValue="{Binding LiveMainFps}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
|
||||
|
|
Loading…
Reference in New Issue