Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
568b4bc9
Commit
568b4bc9
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/sar: Consistently check for shutdown flag within a lock.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
5981f2ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
sar.c
dlls/mf/sar.c
+31
-21
No files found.
dlls/mf/sar.c
View file @
568b4bc9
...
@@ -451,21 +451,26 @@ static HRESULT WINAPI audio_renderer_sink_GetPresentationClock(IMFMediaSink *ifa
...
@@ -451,21 +451,26 @@ static HRESULT WINAPI audio_renderer_sink_GetPresentationClock(IMFMediaSink *ifa
static
HRESULT
WINAPI
audio_renderer_sink_Shutdown
(
IMFMediaSink
*
iface
)
static
HRESULT
WINAPI
audio_renderer_sink_Shutdown
(
IMFMediaSink
*
iface
)
{
{
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaSink
(
iface
);
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaSink
(
iface
);
HRESULT
hr
=
S_OK
;
TRACE
(
"%p.
\n
"
,
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
EnterCriticalSection
(
&
renderer
->
cs
);
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
return
MF_E_SHUTDOWN
;
hr
=
MF_E_SHUTDOWN
;
else
{
renderer
->
flags
|=
SAR_SHUT_DOWN
;
IMFMediaEventQueue_Shutdown
(
renderer
->
event_queue
);
IMFMediaEventQueue_Shutdown
(
renderer
->
stream_event_queue
);
audio_renderer_set_presentation_clock
(
renderer
,
NULL
);
audio_renderer_release_audio_client
(
renderer
);
}
EnterCriticalSection
(
&
renderer
->
cs
);
renderer
->
flags
|=
SAR_SHUT_DOWN
;
IMFMediaEventQueue_Shutdown
(
renderer
->
event_queue
);
IMFMediaEventQueue_Shutdown
(
renderer
->
stream_event_queue
);
audio_renderer_set_presentation_clock
(
renderer
,
NULL
);
audio_renderer_release_audio_client
(
renderer
);
LeaveCriticalSection
(
&
renderer
->
cs
);
LeaveCriticalSection
(
&
renderer
->
cs
);
return
S_OK
;
return
hr
;
}
}
static
const
IMFMediaSinkVtbl
audio_renderer_sink_vtbl
=
static
const
IMFMediaSinkVtbl
audio_renderer_sink_vtbl
=
...
@@ -1364,19 +1369,22 @@ static HRESULT WINAPI audio_renderer_stream_ProcessSample(IMFStreamSink *iface,
...
@@ -1364,19 +1369,22 @@ static HRESULT WINAPI audio_renderer_stream_ProcessSample(IMFStreamSink *iface,
if
(
!
sample
)
if
(
!
sample
)
return
E_POINTER
;
return
E_POINTER
;
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
return
MF_E_STREAMSINK_REMOVED
;
EnterCriticalSection
(
&
renderer
->
cs
);
EnterCriticalSection
(
&
renderer
->
cs
);
if
(
renderer
->
state
==
STREAM_STATE_RUNNING
)
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
hr
=
stream_queue_sample
(
renderer
,
sample
);
hr
=
MF_E_STREAMSINK_REMOVED
;
renderer
->
flags
&=
~
SAR_SAMPLE_REQUESTED
;
else
if
(
renderer
->
queued_frames
<
renderer
->
max_frames
&&
renderer
->
state
==
STREAM_STATE_RUNNING
)
{
{
IMFMediaEventQueue_QueueEventParamVar
(
renderer
->
stream_event_queue
,
MEStreamSinkRequestSample
,
&
GUID_NULL
,
S_OK
,
NULL
);
if
(
renderer
->
state
==
STREAM_STATE_RUNNING
)
renderer
->
flags
|=
SAR_SAMPLE_REQUESTED
;
hr
=
stream_queue_sample
(
renderer
,
sample
);
renderer
->
flags
&=
~
SAR_SAMPLE_REQUESTED
;
if
(
renderer
->
queued_frames
<
renderer
->
max_frames
&&
renderer
->
state
==
STREAM_STATE_RUNNING
)
{
IMFMediaEventQueue_QueueEventParamVar
(
renderer
->
stream_event_queue
,
MEStreamSinkRequestSample
,
&
GUID_NULL
,
S_OK
,
NULL
);
renderer
->
flags
|=
SAR_SAMPLE_REQUESTED
;
}
}
}
LeaveCriticalSection
(
&
renderer
->
cs
);
LeaveCriticalSection
(
&
renderer
->
cs
);
...
@@ -1414,11 +1422,13 @@ static HRESULT WINAPI audio_renderer_stream_PlaceMarker(IMFStreamSink *iface, MF
...
@@ -1414,11 +1422,13 @@ static HRESULT WINAPI audio_renderer_stream_PlaceMarker(IMFStreamSink *iface, MF
TRACE
(
"%p, %d, %p, %p.
\n
"
,
iface
,
marker_type
,
marker_value
,
context_value
);
TRACE
(
"%p, %d, %p, %p.
\n
"
,
iface
,
marker_type
,
marker_value
,
context_value
);
EnterCriticalSection
(
&
renderer
->
cs
);
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
if
(
renderer
->
flags
&
SAR_SHUT_DOWN
)
return
MF_E_STREAMSINK_REMOVED
;
hr
=
MF_E_STREAMSINK_REMOVED
;
else
hr
=
stream_place_marker
(
renderer
,
marker_type
,
context_value
);
EnterCriticalSection
(
&
renderer
->
cs
);
hr
=
stream_place_marker
(
renderer
,
marker_type
,
context_value
);
LeaveCriticalSection
(
&
renderer
->
cs
);
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