Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6320d82e
Commit
6320d82e
authored
Sep 14, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Oct 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
direct3d11: avoid crashing when we can't allocate the picture pool
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
c5db60a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
modules/video_output/msw/direct3d11.c
modules/video_output/msw/direct3d11.c
+11
-4
No files found.
modules/video_output/msw/direct3d11.c
View file @
6320d82e
...
...
@@ -534,15 +534,14 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
texDesc
.
BindFlags
=
D3D11_BIND_SHADER_RESOURCE
;
texDesc
.
CPUAccessFlags
=
D3D11_CPU_ACCESS_WRITE
;
unsigned
surface_count
;
for
(
surface_count
=
0
;
surface_count
<
pool_size
;
surface_count
++
)
{
for
(
picture_count
=
0
;
picture_count
<
pool_size
;
picture_count
++
)
{
picture_sys_t
*
picsys
=
calloc
(
1
,
sizeof
(
*
picsys
));
if
(
unlikely
(
picsys
==
NULL
))
goto
error
;
hr
=
ID3D11Device_CreateTexture2D
(
vd
->
sys
->
d3ddevice
,
&
texDesc
,
NULL
,
&
picsys
->
texture
);
if
(
FAILED
(
hr
))
{
msg_Err
(
vd
,
"CreateTexture2D %d failed
. (hr=0x%0lx)"
,
pool_size
,
hr
);
msg_Err
(
vd
,
"CreateTexture2D %d failed
on picture %d of the pool. (hr=0x%0lx)"
,
pool_size
,
picture_count
,
hr
);
goto
error
;
}
...
...
@@ -556,10 +555,11 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
picture_t
*
picture
=
picture_NewFromResource
(
&
vd
->
fmt
,
&
resource
);
if
(
unlikely
(
picture
==
NULL
))
{
free
(
picsys
);
msg_Err
(
vd
,
"Failed to create picture %d in the pool."
,
picture_count
);
goto
error
;
}
pictures
[
surfac
e_count
]
=
picture
;
pictures
[
pictur
e_count
]
=
picture
;
/* each picture_t holds a ref to the context and release it on Destroy */
ID3D11DeviceContext_AddRef
(
picsys
->
context
);
}
...
...
@@ -578,6 +578,13 @@ error:
for
(
unsigned
i
=
0
;
i
<
picture_count
;
++
i
)
DestroyDisplayPoolPicture
(
pictures
[
i
]);
free
(
pictures
);
/* create an empty pool to avoid crashing */
picture_pool_configuration_t
pool_cfg
;
memset
(
&
pool_cfg
,
0
,
sizeof
(
pool_cfg
)
);
pool_cfg
.
picture_count
=
0
;
vd
->
sys
->
pool
=
picture_pool_NewExtended
(
&
pool_cfg
);
}
#endif
return
vd
->
sys
->
pool
;
...
...
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