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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
61 deletions
+108
-61
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
+91
-39
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
...
@@ -138,6 +138,11 @@ namespace VIZ.Framework.Common
else
else
{
{
StopRendering
();
StopRendering
();
// 在丢失前景缓冲区后重新创建
this
.
CreateAndBindTargets
();
StartRendering
();
}
}
}
}
...
...
VIZ.Framework.Common/VideoControl/Control/Plugin/ClipBox/ClipBoxPlugin.cs
View file @
19cf2a85
...
@@ -132,14 +132,6 @@ namespace VIZ.Framework.Common
...
@@ -132,14 +132,6 @@ namespace VIZ.Framework.Common
SolidColorBrush
brush
=
new
SolidColorBrush
(
context
.
Target
,
info
.
DrawingBorderColor
);
SolidColorBrush
brush
=
new
SolidColorBrush
(
context
.
Target
,
info
.
DrawingBorderColor
);
context
.
Target
.
DrawRectangle
(
drawRect
,
brush
,
info
.
DrawingBorderWidth
);
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
...
@@ -136,14 +136,6 @@ namespace VIZ.Framework.Common
if
(
renderInfo
==
null
)
if
(
renderInfo
==
null
)
return
;
return
;
#if DEBUG
//StringBuilder sb = new StringBuilder();
//sb.AppendLine($"========================= BEGIN =========================");
//sb.Append($"【渲染视频】 {renderInfo.Frame.TimeStamp}");
//log.Debug(sb.ToString());
#endif
context
.
VideoRenderInfo
=
renderInfo
;
context
.
VideoRenderInfo
=
renderInfo
;
// 绘制视频
// 绘制视频
...
...
VIZ.Framework.Common/VideoControl/Stream/IVideoFrame.cs
View file @
19cf2a85
...
@@ -11,7 +11,7 @@ namespace VIZ.Framework.Common
...
@@ -11,7 +11,7 @@ namespace VIZ.Framework.Common
/// <summary>
/// <summary>
/// 视频帧
/// 视频帧
/// </summary>
/// </summary>
public
interface
IVideoFrame
:
IDisposable
public
interface
IVideoFrame
:
I
VideoControlSync
,
I
Disposable
{
{
/// <summary>
/// <summary>
/// 宽度
/// 宽度
...
@@ -29,11 +29,6 @@ namespace VIZ.Framework.Common
...
@@ -29,11 +29,6 @@ namespace VIZ.Framework.Common
int
Length
{
get
;
set
;
}
int
Length
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 时间戳
/// </summary>
long
TimeStamp
{
get
;
set
;
}
/// <summary>
/// 是否是最后一帧
/// 是否是最后一帧
/// </summary>
/// </summary>
bool
IsEnd
{
get
;
set
;
}
bool
IsEnd
{
get
;
set
;
}
...
...
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
View file @
19cf2a85
...
@@ -26,7 +26,10 @@ namespace VIZ.Framework.Common
...
@@ -26,7 +26,10 @@ namespace VIZ.Framework.Common
/// <summary>
/// <summary>
/// 最大队列长度
/// 最大队列长度
/// </summary>
/// </summary>
public
int
MaxQueueCount
{
get
;
set
;
}
=
100
;
/// <remarks>
/// 40ms * 50 = 2s
/// </remarks>
public
int
MaxQueueCount
{
get
;
set
;
}
=
50
;
/// <summary>
/// <summary>
/// 帧同步时触发
/// 帧同步时触发
...
@@ -36,12 +39,12 @@ namespace VIZ.Framework.Common
...
@@ -36,12 +39,12 @@ namespace VIZ.Framework.Common
/// <summary>
/// <summary>
/// 视频帧队列
/// 视频帧队列
/// </summary>
/// </summary>
p
ublic
ConcurrentQueue
<
IVideoControlSync
>
VideoFrameQueue
{
get
;
private
set
;
}
=
new
ConcurrentQueue
<
IVideoControlSync
>();
p
rivate
ConcurrentQueue
<
IVideoControlSync
>
VideoFrameQueue
=
new
ConcurrentQueue
<
IVideoControlSync
>();
/// <summary>
/// <summary>
/// 数据帧队列
/// 数据帧队列
/// </summary>
/// </summary>
p
ublic
ConcurrentQueue
<
IVideoControlSync
>
DataFrameQueue
{
get
;
private
set
;
}
=
new
ConcurrentQueue
<
IVideoControlSync
>();
p
rivate
ConcurrentQueue
<
IVideoControlSync
>
DataFrameQueue
=
new
ConcurrentQueue
<
IVideoControlSync
>();
/// <summary>
/// <summary>
/// 视频帧待处理数据
/// 视频帧待处理数据
...
@@ -63,58 +66,107 @@ namespace VIZ.Framework.Common
...
@@ -63,58 +66,107 @@ namespace VIZ.Framework.Common
}
}
/// <summary>
/// <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>
/// </summary>
public
void
Execute
()
public
void
Execute
Sync
()
{
{
try
try
{
{
IVideoControlSync
video
=
this
.
VideoFrame
;
while
(
true
)
IVideoControlSync
data
=
this
.
DataFrame
;
if
(
this
.
VideoFrame
==
null
)
{
{
this
.
VideoFrameQueue
.
TryDequeue
(
out
video
)
;
IVideoControlSync
video
=
this
.
VideoFrame
;
}
IVideoControlSync
data
=
this
.
DataFrame
;
if
(
this
.
Data
Frame
==
null
)
if
(
this
.
Video
Frame
==
null
)
{
{
this
.
DataFrameQueue
.
TryDequeue
(
out
data
);
this
.
VideoFrameQueue
.
TryDequeue
(
out
video
);
}
}
int
videoQueueCount
=
this
.
VideoFrameQueue
.
Count
;
if
(
this
.
DataFrame
==
null
)
{
this
.
DataFrameQueue
.
TryDequeue
(
out
data
);
}
// 没有视频帧时不处理
int
videoQueueCount
=
this
.
VideoFrameQueue
.
Count
;
if
(
video
==
null
)
return
;
// 有视频帧 没有数据帧
// 没有视频帧时不处理
if
(
data
==
null
)
if
(
video
==
null
)
{
// 如果视频帧队列在等待队列长度范围内,那么不处理
if
(
videoQueueCount
<
this
.
MaxQueueCount
)
return
;
return
;
// 处理数据
// 有视频帧 没有数据帧
this
.
triggerEvent
(
video
,
null
);
if
(
data
==
null
)
this
.
VideoFrame
=
null
;
{
// 如果视频帧队列在等待队列长度范围内,那么不处理
if
(
videoQueueCount
<
this
.
MaxQueueCount
)
return
;
return
;
// 处理数据
}
this
.
triggerEvent
(
video
,
null
);
this
.
VideoFrame
=
null
;
// 如果视频帧的时间戳小于数据的时间戳
return
;
if
(
video
.
TimeStamp
<
data
.
TimeStamp
)
}
{
this
.
triggerEvent
(
video
,
null
);
this
.
VideoFrame
=
null
;
return
;
// 如果视频帧的时间戳小于数据的时间戳
}
if
(
video
.
TimeStamp
<
data
.
TimeStamp
)
{
this
.
triggerEvent
(
video
,
null
);
this
.
VideoFrame
=
null
;
return
;
}
// 如果视频帧的时间等于数据帧时间那么正常处理
if
(
video
.
TimeStamp
==
data
.
TimeStamp
)
{
// 处理数据
this
.
triggerEvent
(
video
,
data
);
this
.
VideoFrame
=
null
;
this
.
DataFrame
=
null
;
// 处理数据
return
;
this
.
triggerEvent
(
video
,
data
);
}
this
.
VideoFrame
=
null
;
this
.
DataFrame
=
null
;
// 抛弃该数据帧
this
.
DataFrame
=
null
;
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
VIZ.Framework.Connection/Provider/SingleJson/ConnSingleJsonPackageProvider.cs
View file @
19cf2a85
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -14,6 +15,10 @@ namespace VIZ.Framework.Connection
...
@@ -14,6 +15,10 @@ namespace VIZ.Framework.Connection
[
ConnPackageProvider
(
ConnPackageProviderType
.
UDP
)]
[
ConnPackageProvider
(
ConnPackageProviderType
.
UDP
)]
public
class
ConnSingleJsonPackageProvider
:
IConnPackageProvider
public
class
ConnSingleJsonPackageProvider
:
IConnPackageProvider
{
{
public
ConnSingleJsonPackageProvider
()
{
}
/// <summary>
/// <summary>
/// 日志
/// 日志
/// </summary>
/// </summary>
...
...
VIZ.Framework.UnitTest/NetTest.cs
View file @
19cf2a85
...
@@ -55,5 +55,11 @@ namespace VIZ.Framework.UnitTest
...
@@ -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'}"
;
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
);
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