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
c45ae2c6
Commit
c45ae2c6
authored
Oct 31, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf/samplegrabber: Release current media type on shutdown.
parent
25f8698f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
samplegrabber.c
dlls/mf/samplegrabber.c
+26
-7
mf.c
dlls/mf/tests/mf.c
+2
-3
No files found.
dlls/mf/samplegrabber.c
View file @
c45ae2c6
...
@@ -655,34 +655,50 @@ static HRESULT WINAPI sample_grabber_stream_type_handler_GetCurrentMediaType(IMF
...
@@ -655,34 +655,50 @@ static HRESULT WINAPI sample_grabber_stream_type_handler_GetCurrentMediaType(IMF
IMFMediaType
**
media_type
)
IMFMediaType
**
media_type
)
{
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaTypeHandler
(
iface
);
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaTypeHandler
(
iface
);
HRESULT
hr
=
S_OK
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
media_type
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
media_type
);
if
(
!
media_type
)
if
(
!
media_type
)
return
E_POINTER
;
return
E_POINTER
;
EnterCriticalSection
(
&
grabber
->
cs
);
if
(
grabber
->
is_shut_down
)
if
(
grabber
->
is_shut_down
)
return
MF_E_STREAMSINK_REMOVED
;
{
hr
=
MF_E_STREAMSINK_REMOVED
;
}
else
{
*
media_type
=
grabber
->
current_media_type
;
IMFMediaType_AddRef
(
*
media_type
);
}
*
media_type
=
grabber
->
current_media_type
;
LeaveCriticalSection
(
&
grabber
->
cs
);
IMFMediaType_AddRef
(
*
media_type
);
return
S_OK
;
return
hr
;
}
}
static
HRESULT
WINAPI
sample_grabber_stream_type_handler_GetMajorType
(
IMFMediaTypeHandler
*
iface
,
GUID
*
type
)
static
HRESULT
WINAPI
sample_grabber_stream_type_handler_GetMajorType
(
IMFMediaTypeHandler
*
iface
,
GUID
*
type
)
{
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaTypeHandler
(
iface
);
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaTypeHandler
(
iface
);
HRESULT
hr
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
type
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
type
);
if
(
!
type
)
if
(
!
type
)
return
E_POINTER
;
return
E_POINTER
;
EnterCriticalSection
(
&
grabber
->
cs
);
if
(
grabber
->
is_shut_down
)
if
(
grabber
->
is_shut_down
)
return
MF_E_STREAMSINK_REMOVED
;
hr
=
MF_E_STREAMSINK_REMOVED
;
else
hr
=
IMFMediaType_GetMajorType
(
grabber
->
current_media_type
,
type
);
return
IMFMediaType_GetMajorType
(
grabber
->
current_media_type
,
type
);
LeaveCriticalSection
(
&
grabber
->
cs
);
return
hr
;
}
}
static
const
IMFMediaTypeHandlerVtbl
sample_grabber_stream_type_handler_vtbl
=
static
const
IMFMediaTypeHandlerVtbl
sample_grabber_stream_type_handler_vtbl
=
...
@@ -867,7 +883,8 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
...
@@ -867,7 +883,8 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
IMFSampleGrabberSinkCallback_Release
(
grabber
->
callback
);
IMFSampleGrabberSinkCallback_Release
(
grabber
->
callback
);
if
(
grabber
->
callback2
)
if
(
grabber
->
callback2
)
IMFSampleGrabberSinkCallback2_Release
(
grabber
->
callback2
);
IMFSampleGrabberSinkCallback2_Release
(
grabber
->
callback2
);
IMFMediaType_Release
(
grabber
->
current_media_type
);
if
(
grabber
->
current_media_type
)
IMFMediaType_Release
(
grabber
->
current_media_type
);
IMFMediaType_Release
(
grabber
->
media_type
);
IMFMediaType_Release
(
grabber
->
media_type
);
if
(
grabber
->
event_queue
)
if
(
grabber
->
event_queue
)
IMFMediaEventQueue_Release
(
grabber
->
event_queue
);
IMFMediaEventQueue_Release
(
grabber
->
event_queue
);
...
@@ -1091,6 +1108,8 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
...
@@ -1091,6 +1108,8 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
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
);
sample_grabber_set_presentation_clock
(
grabber
,
NULL
);
IMFMediaType_Release
(
grabber
->
current_media_type
);
grabber
->
current_media_type
=
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 @
c45ae2c6
...
@@ -4697,10 +4697,9 @@ static void test_sample_grabber(void)
...
@@ -4697,10 +4697,9 @@ static void test_sample_grabber(void)
ok
(
hr
==
S_OK
,
"Failed to get type count, hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get type count, hr %#lx.
\n
"
,
hr
);
ref
=
IMFMediaType_Release
(
media_type2
);
ref
=
IMFMediaType_Release
(
media_type2
);
todo_wine
ok
(
!
ref
,
"Unexpected refcount %ld.
\n
"
,
ref
);
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
ref
=
IMFMediaType_Release
(
media_type
);
ref
=
IMFMediaType_Release
(
media_type
);
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
ok
(
!
ref
,
"Unexpected refcount %ld.
\n
"
,
ref
);
hr
=
IMFMediaTypeHandler_GetMediaTypeByIndex
(
handler
,
0
,
&
media_type
);
hr
=
IMFMediaTypeHandler_GetMediaTypeByIndex
(
handler
,
0
,
&
media_type
);
ok
(
hr
==
MF_E_NO_MORE_TYPES
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
MF_E_NO_MORE_TYPES
,
"Unexpected hr %#lx.
\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