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
0066be78
Commit
0066be78
authored
Nov 12, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evr/allocator: Fix reference counting for returned samples.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2ef767dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
sample.c
dlls/evr/sample.c
+4
-2
evr.c
dlls/evr/tests/evr.c
+3
-4
No files found.
dlls/evr/sample.c
View file @
0066be78
...
@@ -459,7 +459,6 @@ static void sample_allocator_release_samples(struct sample_allocator *allocator)
...
@@ -459,7 +459,6 @@ static void sample_allocator_release_samples(struct sample_allocator *allocator)
LIST_FOR_EACH_ENTRY_SAFE
(
iter
,
iter2
,
&
allocator
->
used_samples
,
struct
queued_sample
,
entry
)
LIST_FOR_EACH_ENTRY_SAFE
(
iter
,
iter2
,
&
allocator
->
used_samples
,
struct
queued_sample
,
entry
)
{
{
list_remove
(
&
iter
->
entry
);
list_remove
(
&
iter
->
entry
);
IMFSample_Release
(
iter
->
sample
);
heap_free
(
iter
);
heap_free
(
iter
);
}
}
}
}
...
@@ -676,8 +675,10 @@ static HRESULT WINAPI sample_allocator_AllocateSample(IMFVideoSampleAllocator *i
...
@@ -676,8 +675,10 @@ static HRESULT WINAPI sample_allocator_AllocateSample(IMFVideoSampleAllocator *i
list_add_tail
(
&
allocator
->
used_samples
,
head
);
list_add_tail
(
&
allocator
->
used_samples
,
head
);
allocator
->
free_sample_count
--
;
allocator
->
free_sample_count
--
;
/* Reference counter is not increased when sample is returned, so next release could trigger
tracking condition. This is balanced by incremented reference counter when sample is returned
back to the free list. */
*
out
=
sample
;
*
out
=
sample
;
IMFSample_AddRef
(
*
out
);
}
}
}
}
...
@@ -816,6 +817,7 @@ static HRESULT WINAPI sample_allocator_tracking_callback_Invoke(IMFAsyncCallback
...
@@ -816,6 +817,7 @@ static HRESULT WINAPI sample_allocator_tracking_callback_Invoke(IMFAsyncCallback
{
{
list_remove
(
&
iter
->
entry
);
list_remove
(
&
iter
->
entry
);
list_add_tail
(
&
allocator
->
free_samples
,
&
iter
->
entry
);
list_add_tail
(
&
allocator
->
free_samples
,
&
iter
->
entry
);
IMFSample_AddRef
(
iter
->
sample
);
allocator
->
free_sample_count
++
;
allocator
->
free_sample_count
++
;
break
;
break
;
}
}
...
...
dlls/evr/tests/evr.c
View file @
0066be78
...
@@ -1326,13 +1326,13 @@ static void test_MFCreateVideoSampleAllocator(void)
...
@@ -1326,13 +1326,13 @@ static void test_MFCreateVideoSampleAllocator(void)
IDirect3DSurface9
*
surface
;
IDirect3DSurface9
*
surface
;
IDirect3DDevice9
*
device
;
IDirect3DDevice9
*
device
;
IMFMediaBuffer
*
buffer
;
IMFMediaBuffer
*
buffer
;
LONG
refcount
,
count
;
unsigned
int
token
;
unsigned
int
token
;
IMFGetService
*
gs
;
IMFGetService
*
gs
;
IDirect3D9
*
d3d
;
IDirect3D9
*
d3d
;
IUnknown
*
unk
;
IUnknown
*
unk
;
HWND
window
;
HWND
window
;
HRESULT
hr
;
HRESULT
hr
;
LONG
count
;
BYTE
*
data
;
BYTE
*
data
;
hr
=
MFCreateVideoSampleAllocator
(
&
IID_IUnknown
,
(
void
**
)
&
unk
);
hr
=
MFCreateVideoSampleAllocator
(
&
IID_IUnknown
,
(
void
**
)
&
unk
);
...
@@ -1397,7 +1397,7 @@ todo_wine
...
@@ -1397,7 +1397,7 @@ todo_wine
sample
=
NULL
;
sample
=
NULL
;
hr
=
IMFVideoSampleAllocator_AllocateSample
(
allocator
,
&
sample
);
hr
=
IMFVideoSampleAllocator_AllocateSample
(
allocator
,
&
sample
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
get_refcount
(
sample
)
==
3
,
"Unexpected refcount %u.
\n
"
,
get_refcount
(
sample
)
);
refcount
=
get_refcount
(
sample
);
hr
=
IMFVideoSampleAllocator_AllocateSample
(
allocator
,
&
sample2
);
hr
=
IMFVideoSampleAllocator_AllocateSample
(
allocator
,
&
sample2
);
ok
(
hr
==
MF_E_SAMPLEALLOCATOR_EMPTY
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MF_E_SAMPLEALLOCATOR_EMPTY
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
@@ -1405,8 +1405,7 @@ todo_wine
...
@@ -1405,8 +1405,7 @@ todo_wine
/* Reinitialize with active sample. */
/* Reinitialize with active sample. */
hr
=
IMFVideoSampleAllocator_InitializeSampleAllocator
(
allocator
,
4
,
video_type
);
hr
=
IMFVideoSampleAllocator_InitializeSampleAllocator
(
allocator
,
4
,
video_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
refcount
==
get_refcount
(
sample
),
"Unexpected refcount %u.
\n
"
,
get_refcount
(
sample
));
ok
(
get_refcount
(
sample
)
==
3
,
"Unexpected refcount %u.
\n
"
,
get_refcount
(
sample
));
hr
=
IMFVideoSampleAllocatorCallback_GetFreeSampleCount
(
allocator_cb
,
&
count
);
hr
=
IMFVideoSampleAllocatorCallback_GetFreeSampleCount
(
allocator_cb
,
&
count
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected 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