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
e49c550b
Commit
e49c550b
authored
Apr 22, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Release presentation clock on sample grabber shutdown.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a0035b84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
+30
-23
samplegrabber.c
dlls/mf/samplegrabber.c
+27
-21
mf.c
dlls/mf/tests/mf.c
+3
-2
No files found.
dlls/mf/samplegrabber.c
View file @
e49c550b
...
@@ -956,6 +956,31 @@ static HRESULT WINAPI sample_grabber_sink_GetStreamSinkById(IMFMediaSink *iface,
...
@@ -956,6 +956,31 @@ static HRESULT WINAPI sample_grabber_sink_GetStreamSinkById(IMFMediaSink *iface,
return
hr
;
return
hr
;
}
}
static
void
sample_grabber_set_presentation_clock
(
struct
sample_grabber
*
grabber
,
IMFPresentationClock
*
clock
)
{
if
(
grabber
->
clock
)
{
IMFPresentationClock_RemoveClockStateSink
(
grabber
->
clock
,
&
grabber
->
IMFClockStateSink_iface
);
IMFPresentationClock_Release
(
grabber
->
clock
);
if
(
grabber
->
timer
)
{
IMFTimer_Release
(
grabber
->
timer
);
grabber
->
timer
=
NULL
;
}
}
grabber
->
clock
=
clock
;
if
(
grabber
->
clock
)
{
IMFPresentationClock_AddRef
(
grabber
->
clock
);
IMFPresentationClock_AddClockStateSink
(
grabber
->
clock
,
&
grabber
->
IMFClockStateSink_iface
);
if
(
FAILED
(
IMFPresentationClock_QueryInterface
(
grabber
->
clock
,
&
IID_IMFTimer
,
(
void
**
)
&
grabber
->
timer
)))
{
WARN
(
"Failed to get IMFTimer interface.
\n
"
);
grabber
->
timer
=
NULL
;
}
}
}
static
HRESULT
WINAPI
sample_grabber_sink_SetPresentationClock
(
IMFMediaSink
*
iface
,
IMFPresentationClock
*
clock
)
static
HRESULT
WINAPI
sample_grabber_sink_SetPresentationClock
(
IMFMediaSink
*
iface
,
IMFPresentationClock
*
clock
)
{
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaSink
(
iface
);
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaSink
(
iface
);
...
@@ -968,27 +993,7 @@ static HRESULT WINAPI sample_grabber_sink_SetPresentationClock(IMFMediaSink *ifa
...
@@ -968,27 +993,7 @@ static HRESULT WINAPI sample_grabber_sink_SetPresentationClock(IMFMediaSink *ifa
if
(
SUCCEEDED
(
hr
=
IMFSampleGrabberSinkCallback_OnSetPresentationClock
(
sample_grabber_get_callback
(
grabber
),
if
(
SUCCEEDED
(
hr
=
IMFSampleGrabberSinkCallback_OnSetPresentationClock
(
sample_grabber_get_callback
(
grabber
),
clock
)))
clock
)))
{
{
if
(
grabber
->
clock
)
sample_grabber_set_presentation_clock
(
grabber
,
clock
);
{
IMFPresentationClock_RemoveClockStateSink
(
grabber
->
clock
,
&
grabber
->
IMFClockStateSink_iface
);
IMFPresentationClock_Release
(
grabber
->
clock
);
if
(
grabber
->
timer
)
{
IMFTimer_Release
(
grabber
->
timer
);
grabber
->
timer
=
NULL
;
}
}
grabber
->
clock
=
clock
;
if
(
grabber
->
clock
)
{
IMFPresentationClock_AddRef
(
grabber
->
clock
);
IMFPresentationClock_AddClockStateSink
(
grabber
->
clock
,
&
grabber
->
IMFClockStateSink_iface
);
if
(
FAILED
(
IMFPresentationClock_QueryInterface
(
grabber
->
clock
,
&
IID_IMFTimer
,
(
void
**
)
&
grabber
->
timer
)))
{
WARN
(
"Failed to get IMFTimer interface.
\n
"
);
grabber
->
timer
=
NULL
;
}
}
}
}
LeaveCriticalSection
(
&
grabber
->
cs
);
LeaveCriticalSection
(
&
grabber
->
cs
);
...
@@ -1035,6 +1040,7 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
...
@@ -1035,6 +1040,7 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
grabber
->
is_shut_down
=
TRUE
;
grabber
->
is_shut_down
=
TRUE
;
if
(
SUCCEEDED
(
hr
=
IMFSampleGrabberSinkCallback_OnShutdown
(
sample_grabber_get_callback
(
grabber
))))
if
(
SUCCEEDED
(
hr
=
IMFSampleGrabberSinkCallback_OnShutdown
(
sample_grabber_get_callback
(
grabber
))))
{
{
sample_grabber_set_presentation_clock
(
grabber
,
NULL
);
IMFMediaEventQueue_Shutdown
(
grabber
->
stream_event_queue
);
IMFMediaEventQueue_Shutdown
(
grabber
->
stream_event_queue
);
IMFMediaEventQueue_Shutdown
(
grabber
->
event_queue
);
IMFMediaEventQueue_Shutdown
(
grabber
->
event_queue
);
}
}
...
...
dlls/mf/tests/mf.c
View file @
e49c550b
...
@@ -2102,8 +2102,6 @@ static void test_sample_grabber(void)
...
@@ -2102,8 +2102,6 @@ static void test_sample_grabber(void)
ok
(
hr
==
S_OK
,
"Failed to set time source, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to set time source, hr %#x.
\n
"
,
hr
);
IMFPresentationTimeSource_Release
(
time_source
);
IMFPresentationTimeSource_Release
(
time_source
);
IMFPresentationClock_Release
(
clock
);
hr
=
IMFMediaSink_GetCharacteristics
(
sink
,
&
flags
);
hr
=
IMFMediaSink_GetCharacteristics
(
sink
,
&
flags
);
ok
(
hr
==
S_OK
,
"Failed to get sink flags, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get sink flags, hr %#x.
\n
"
,
hr
);
...
@@ -2221,8 +2219,10 @@ static void test_sample_grabber(void)
...
@@ -2221,8 +2219,10 @@ static void test_sample_grabber(void)
hr
=
IMFStreamSink_GetEvent
(
stream
,
MF_EVENT_FLAG_NO_WAIT
,
&
event
);
hr
=
IMFStreamSink_GetEvent
(
stream
,
MF_EVENT_FLAG_NO_WAIT
,
&
event
);
ok
(
hr
==
MF_E_NO_EVENTS_AVAILABLE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MF_E_NO_EVENTS_AVAILABLE
,
"Unexpected hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
clock
,
3
);
hr
=
IMFMediaSink_Shutdown
(
sink
);
hr
=
IMFMediaSink_Shutdown
(
sink
);
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
clock
,
1
);
hr
=
IMFMediaEventGenerator_GetEvent
(
eg
,
MF_EVENT_FLAG_NO_WAIT
,
&
event
);
hr
=
IMFMediaEventGenerator_GetEvent
(
eg
,
MF_EVENT_FLAG_NO_WAIT
,
&
event
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
@@ -2355,6 +2355,7 @@ static void test_sample_grabber(void)
...
@@ -2355,6 +2355,7 @@ static void test_sample_grabber(void)
IMFActivate_Release
(
activate
);
IMFActivate_Release
(
activate
);
IMFMediaType_Release
(
media_type
);
IMFMediaType_Release
(
media_type
);
IMFPresentationClock_Release
(
clock
);
hr
=
MFShutdown
();
hr
=
MFShutdown
();
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
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