Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
5981f2ed
Commit
5981f2ed
authored
Jul 04, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf/evr: Consistently check for shutdown flag within a lock.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
d4bb82af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
49 deletions
+66
-49
evr.c
dlls/mf/evr.c
+66
-49
No files found.
dlls/mf/evr.c
View file @
5981f2ed
...
@@ -1432,38 +1432,43 @@ static HRESULT WINAPI video_renderer_sink_GetPresentationClock(IMFMediaSink *ifa
...
@@ -1432,38 +1432,43 @@ static HRESULT WINAPI video_renderer_sink_GetPresentationClock(IMFMediaSink *ifa
static
HRESULT
WINAPI
video_renderer_sink_Shutdown
(
IMFMediaSink
*
iface
)
static
HRESULT
WINAPI
video_renderer_sink_Shutdown
(
IMFMediaSink
*
iface
)
{
{
struct
video_renderer
*
renderer
=
impl_from_IMFMediaSink
(
iface
);
struct
video_renderer
*
renderer
=
impl_from_IMFMediaSink
(
iface
);
HRESULT
hr
=
S_OK
;
size_t
i
;
size_t
i
;
TRACE
(
"%p.
\n
"
,
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
if
(
renderer
->
flags
&
EVR_SHUT_DOWN
)
return
MF_E_SHUTDOWN
;
EnterCriticalSection
(
&
renderer
->
cs
);
EnterCriticalSection
(
&
renderer
->
cs
);
renderer
->
flags
|=
EVR_SHUT_DOWN
;
/* Detach streams from the sink. */
if
(
renderer
->
flags
&
EVR_SHUT_DOWN
)
for
(
i
=
0
;
i
<
renderer
->
stream_count
;
++
i
)
hr
=
MF_E_SHUTDOWN
;
else
{
{
struct
video_stream
*
stream
=
renderer
->
streams
[
i
];
renderer
->
flags
|=
EVR_SHUT_DOWN
;
/* Detach streams from the sink. */
for
(
i
=
0
;
i
<
renderer
->
stream_count
;
++
i
)
{
struct
video_stream
*
stream
=
renderer
->
streams
[
i
];
EnterCriticalSection
(
&
stream
->
cs
);
EnterCriticalSection
(
&
stream
->
cs
);
stream
->
parent
=
NULL
;
stream
->
parent
=
NULL
;
LeaveCriticalSection
(
&
stream
->
cs
);
LeaveCriticalSection
(
&
stream
->
cs
);
IMFMediaEventQueue_Shutdown
(
stream
->
event_queue
);
IMFMediaEventQueue_Shutdown
(
stream
->
event_queue
);
IMFStreamSink_Release
(
&
stream
->
IMFStreamSink_iface
);
IMFStreamSink_Release
(
&
stream
->
IMFStreamSink_iface
);
IMFMediaSink_Release
(
iface
);
IMFMediaSink_Release
(
iface
);
renderer
->
streams
[
i
]
=
NULL
;
renderer
->
streams
[
i
]
=
NULL
;
}
free
(
renderer
->
streams
);
renderer
->
stream_count
=
0
;
renderer
->
stream_size
=
0
;
IMFMediaEventQueue_Shutdown
(
renderer
->
event_queue
);
video_renderer_set_presentation_clock
(
renderer
,
NULL
);
video_renderer_release_services
(
renderer
);
}
}
free
(
renderer
->
streams
);
renderer
->
stream_count
=
0
;
renderer
->
stream_size
=
0
;
IMFMediaEventQueue_Shutdown
(
renderer
->
event_queue
);
video_renderer_set_presentation_clock
(
renderer
,
NULL
);
video_renderer_release_services
(
renderer
);
LeaveCriticalSection
(
&
renderer
->
cs
);
LeaveCriticalSection
(
&
renderer
->
cs
);
return
S_OK
;
return
hr
;
}
}
static
const
IMFMediaSinkVtbl
video_renderer_sink_vtbl
=
static
const
IMFMediaSinkVtbl
video_renderer_sink_vtbl
=
...
@@ -1742,52 +1747,64 @@ static HRESULT video_renderer_initialize(struct video_renderer *renderer, IMFTra
...
@@ -1742,52 +1747,64 @@ static HRESULT video_renderer_initialize(struct video_renderer *renderer, IMFTra
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
video_renderer_InitializeRenderer
(
IMFVideoRenderer
*
iface
,
IMFTransform
*
mix
er
,
static
HRESULT
video_renderer_create_mixer_and_presenter
(
struct
video_renderer
*
render
er
,
IMF
VideoPresenter
*
presenter
)
IMF
Transform
**
mixer
,
IMFVideoPresenter
*
*
presenter
)
{
{
struct
video_renderer
*
renderer
=
impl_from_IMFVideoRenderer
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
mixer
,
presenter
);
if
(
*
mixer
)
EnterCriticalSection
(
&
renderer
->
cs
);
if
(
renderer
->
flags
&
EVR_SHUT_DOWN
)
{
{
LeaveCriticalSection
(
&
renderer
->
cs
);
IMFTransform_AddRef
(
*
mixer
);
return
MF_E_SHUTDOWN
;
}
}
else
if
(
FAILED
(
hr
=
video_renderer_create_mixer
(
NULL
,
mixer
)))
video_renderer_uninitialize
(
renderer
);
if
(
mixer
)
IMFTransform_AddRef
(
mixer
);
else
if
(
FAILED
(
hr
=
video_renderer_create_mixer
(
NULL
,
&
mixer
)))
{
{
WARN
(
"Failed to create default mixer object, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to create default mixer object, hr %#lx.
\n
"
,
hr
);
LeaveCriticalSection
(
&
renderer
->
cs
);
return
hr
;
return
hr
;
}
}
if
(
presenter
)
if
(
*
presenter
)
IMFVideoPresenter_AddRef
(
presenter
);
{
else
if
(
FAILED
(
hr
=
video_renderer_create_presenter
(
renderer
,
NULL
,
&
presenter
)))
IMFVideoPresenter_AddRef
(
*
presenter
);
}
else
if
(
FAILED
(
hr
=
video_renderer_create_presenter
(
renderer
,
NULL
,
presenter
)))
{
{
WARN
(
"Failed to create default presenter, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to create default presenter, hr %#lx.
\n
"
,
hr
);
LeaveCriticalSection
(
&
renderer
->
cs
);
IMFTransform_Release
(
*
mixer
);
IMFTransform_Release
(
mixer
);
return
hr
;
return
hr
;
}
}
/* FIXME: check clock state */
return
S_OK
;
/* FIXME: check that streams are not initialized */
}
hr
=
video_renderer_initialize
(
renderer
,
mixer
,
presenter
);
static
HRESULT
WINAPI
video_renderer_InitializeRenderer
(
IMFVideoRenderer
*
iface
,
IMFTransform
*
mixer
,
IMFVideoPresenter
*
presenter
)
{
struct
video_renderer
*
renderer
=
impl_from_IMFVideoRenderer
(
iface
);
HRESULT
hr
;
LeaveCriticalSection
(
&
renderer
->
cs
);
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
mixer
,
presenter
);
IMFTransform_Release
(
mixer
);
EnterCriticalSection
(
&
renderer
->
cs
);
IMFVideoPresenter_Release
(
presenter
);
if
(
renderer
->
flags
&
EVR_SHUT_DOWN
)
hr
=
MF_E_SHUTDOWN
;
else
{
video_renderer_uninitialize
(
renderer
);
if
(
SUCCEEDED
(
hr
=
video_renderer_create_mixer_and_presenter
(
renderer
,
&
mixer
,
&
presenter
)))
{
/* FIXME: check clock state */
/* FIXME: check that streams are not initialized */
hr
=
video_renderer_initialize
(
renderer
,
mixer
,
presenter
);
IMFTransform_Release
(
mixer
);
IMFVideoPresenter_Release
(
presenter
);
}
}
LeaveCriticalSection
(
&
renderer
->
cs
);
return
hr
;
return
hr
;
}
}
...
...
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