This commit is contained in:
lxmou666 2020-12-28 17:38:42 +08:00
parent f047cd3139
commit c09f307a79
1 changed files with 15 additions and 10 deletions

View File

@ -178,9 +178,11 @@ namespace JianGongYun.TRTC.ViewModels
}
}
static object ScreenListLock = new object();
private SIZE thumbSize = new SIZE { cx = 300, cy = 200 };
private SIZE iconSize = new SIZE { cx = 50, cy = 50 };
private ObservableCollection<TRTCScreenEntity> _LiveScreens = new ObservableCollection<TRTCScreenEntity>();
private ObservableCollection<TRTCScreenEntity> _LiveScreens;
/// <summary>
/// 可分享桌面
/// </summary>
@ -188,17 +190,20 @@ namespace JianGongYun.TRTC.ViewModels
{
get
{
_LiveScreens.Clear();
var temp = LiveClassroom.lTRTCCloud.getScreenCaptureSources(ref thumbSize, ref iconSize);
var count = temp.getCount();
for (uint i = 0; i < count; i++)
lock (ScreenListLock)
{
var info = temp.getSourceInfo(i);
//var icon = Util.ToWriteableBitmap(ref info.iconBGRA);
var thumb = info.thumbBGRA.ToWriteableBitmap();
_LiveScreens.Add(new TRTCScreenEntity { SourceId = info.sourceId, SourceName = info.sourceName, Type = info.type, Thumb = thumb, Info = info });
_LiveScreens.Clear();
var temp = LiveClassroom.lTRTCCloud.getScreenCaptureSources(ref thumbSize, ref iconSize);
var count = temp.getCount();
for (uint i = 0; i < count; i++)
{
var info = temp.getSourceInfo(i);
//var icon = Util.ToWriteableBitmap(ref info.iconBGRA);
var thumb = info.thumbBGRA.ToWriteableBitmap();
_LiveScreens.Add(new TRTCScreenEntity { SourceId = info.sourceId, SourceName = info.sourceName, Type = info.type, Thumb = thumb, Info = info });
}
temp.release();
}
temp.release();
return _LiveScreens;
}
}