Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王永辉
VIZ.Framework
Commits
19cf2a85
Commit
19cf2a85
authored
Aug 31, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复分辨率改变导致视频渲染停止的问题
parent
9a970560
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
26 deletions
+73
-26
VIZ.Framework.Common/SharpDx/WPF/D2dControl.cs
+5
-0
VIZ.Framework.Common/VideoControl/Control/Plugin/ClipBox/ClipBoxPlugin.cs
+0
-8
VIZ.Framework.Common/VideoControl/Control/VideoCustomRender.cs
+0
-8
VIZ.Framework.Common/VideoControl/Stream/IVideoFrame.cs
+1
-6
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
+56
-4
VIZ.Framework.Connection/Provider/SingleJson/ConnSingleJsonPackageProvider.cs
+5
-0
VIZ.Framework.UnitTest/NetTest.cs
+6
-0
No files found.
VIZ.Framework.Common/SharpDx/WPF/D2dControl.cs
View file @
19cf2a85
...
...
@@ -138,6 +138,11 @@ namespace VIZ.Framework.Common
else
{
StopRendering
();
// 在丢失前景缓冲区后重新创建
this
.
CreateAndBindTargets
();
StartRendering
();
}
}
...
...
VIZ.Framework.Common/VideoControl/Control/Plugin/ClipBox/ClipBoxPlugin.cs
View file @
19cf2a85
...
...
@@ -132,14 +132,6 @@ namespace VIZ.Framework.Common
SolidColorBrush
brush
=
new
SolidColorBrush
(
context
.
Target
,
info
.
DrawingBorderColor
);
context
.
Target
.
DrawRectangle
(
drawRect
,
brush
,
info
.
DrawingBorderWidth
);
#if DEBUG
//StringBuilder sb = new StringBuilder();
//sb.AppendLine($"【渲染裁切框】 {info.TimeCode}");
//sb.Append($"========================= END =========================");
//log.Debug(sb.ToString());
#endif
}
}
}
VIZ.Framework.Common/VideoControl/Control/VideoCustomRender.cs
View file @
19cf2a85
...
...
@@ -136,14 +136,6 @@ namespace VIZ.Framework.Common
if
(
renderInfo
==
null
)
return
;
#if DEBUG
//StringBuilder sb = new StringBuilder();
//sb.AppendLine($"========================= BEGIN =========================");
//sb.Append($"【渲染视频】 {renderInfo.Frame.TimeStamp}");
//log.Debug(sb.ToString());
#endif
context
.
VideoRenderInfo
=
renderInfo
;
// 绘制视频
...
...
VIZ.Framework.Common/VideoControl/Stream/IVideoFrame.cs
View file @
19cf2a85
...
...
@@ -11,7 +11,7 @@ namespace VIZ.Framework.Common
/// <summary>
/// 视频帧
/// </summary>
public
interface
IVideoFrame
:
IDisposable
public
interface
IVideoFrame
:
I
VideoControlSync
,
I
Disposable
{
/// <summary>
/// 宽度
...
...
@@ -29,11 +29,6 @@ namespace VIZ.Framework.Common
int
Length
{
get
;
set
;
}
/// <summary>
/// 时间戳
/// </summary>
long
TimeStamp
{
get
;
set
;
}
/// <summary>
/// 是否是最后一帧
/// </summary>
bool
IsEnd
{
get
;
set
;
}
...
...
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
View file @
19cf2a85
...
...
@@ -26,7 +26,10 @@ namespace VIZ.Framework.Common
/// <summary>
/// 最大队列长度
/// </summary>
public
int
MaxQueueCount
{
get
;
set
;
}
=
100
;
/// <remarks>
/// 40ms * 50 = 2s
/// </remarks>
public
int
MaxQueueCount
{
get
;
set
;
}
=
50
;
/// <summary>
/// 帧同步时触发
...
...
@@ -36,12 +39,12 @@ namespace VIZ.Framework.Common
/// <summary>
/// 视频帧队列
/// </summary>
p
ublic
ConcurrentQueue
<
IVideoControlSync
>
VideoFrameQueue
{
get
;
private
set
;
}
=
new
ConcurrentQueue
<
IVideoControlSync
>();
p
rivate
ConcurrentQueue
<
IVideoControlSync
>
VideoFrameQueue
=
new
ConcurrentQueue
<
IVideoControlSync
>();
/// <summary>
/// 数据帧队列
/// </summary>
p
ublic
ConcurrentQueue
<
IVideoControlSync
>
DataFrameQueue
{
get
;
private
set
;
}
=
new
ConcurrentQueue
<
IVideoControlSync
>();
p
rivate
ConcurrentQueue
<
IVideoControlSync
>
DataFrameQueue
=
new
ConcurrentQueue
<
IVideoControlSync
>();
/// <summary>
/// 视频帧待处理数据
...
...
@@ -63,12 +66,51 @@ namespace VIZ.Framework.Common
}
/// <summary>
/// 添加
/// </summary>
/// <param name="videoFrame">视频帧</param>
public
void
AppendVideoFrame
(
IVideoControlSync
videoFrame
)
{
this
.
VideoFrameQueue
.
Enqueue
(
videoFrame
);
}
/// <summary>
/// 添加数据帧
/// </summary>
/// <param name="dataFrame">数据帧</param>
public
void
AppendDataFrame
(
IVideoControlSync
dataFrame
)
{
this
.
DataFrameQueue
.
Enqueue
(
dataFrame
);
}
/// <summary>
/// 执行不需要对齐并且处理视频帧
/// </summary>
public
void
ExecuteVideo
()
{
IVideoControlSync
video
=
this
.
VideoFrame
;
if
(
this
.
VideoFrame
==
null
)
{
this
.
VideoFrameQueue
.
TryDequeue
(
out
video
);
}
if
(
video
==
null
)
return
;
this
.
triggerEvent
(
video
,
null
);
this
.
VideoFrame
=
null
;
}
/// <summary>
/// 执行对齐
/// </summary>
public
void
Execute
()
public
void
Execute
Sync
()
{
try
{
while
(
true
)
{
IVideoControlSync
video
=
this
.
VideoFrame
;
IVideoControlSync
data
=
this
.
DataFrame
;
...
...
@@ -111,10 +153,20 @@ namespace VIZ.Framework.Common
return
;
}
// 如果视频帧的时间等于数据帧时间那么正常处理
if
(
video
.
TimeStamp
==
data
.
TimeStamp
)
{
// 处理数据
this
.
triggerEvent
(
video
,
data
);
this
.
VideoFrame
=
null
;
this
.
DataFrame
=
null
;
return
;
}
// 抛弃该数据帧
this
.
DataFrame
=
null
;
}
}
catch
(
Exception
ex
)
{
...
...
VIZ.Framework.Connection/Provider/SingleJson/ConnSingleJsonPackageProvider.cs
View file @
19cf2a85
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
...
...
@@ -14,6 +15,10 @@ namespace VIZ.Framework.Connection
[
ConnPackageProvider
(
ConnPackageProviderType
.
UDP
)]
public
class
ConnSingleJsonPackageProvider
:
IConnPackageProvider
{
public
ConnSingleJsonPackageProvider
()
{
}
/// <summary>
/// 日志
/// </summary>
...
...
VIZ.Framework.UnitTest/NetTest.cs
View file @
19cf2a85
...
...
@@ -55,5 +55,11 @@ namespace VIZ.Framework.UnitTest
string
str
=
"{'signal': 'detect', 'bboxes': [[914.5606, 144.6889, 1877.504, 380.21176]], 'id': 'E0:4F:43:E6:48:C2__CAM_1'}"
;
AlgorithmPackageBase
@base
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
AlgorithmPackageBase
>(
str
);
}
[
TestMethod
]
public
void
TimeTest
()
{
long
l
=
TimeSpan
.
FromSeconds
(
1
).
Ticks
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment