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
596dfad3
Commit
596dfad3
authored
Feb 28, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
May 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Don't pre-check sample size in wg_transform_read_mf().
parent
4d1a331c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
23 deletions
+21
-23
transform.c
dlls/mf/tests/transform.c
+0
-1
wg_sample.c
dlls/winegstreamer/wg_sample.c
+0
-5
wg_transform.c
dlls/winegstreamer/wg_transform.c
+21
-17
No files found.
dlls/mf/tests/transform.c
View file @
596dfad3
...
...
@@ -4133,7 +4133,6 @@ static void test_h264_decoder_concat_streams(void)
{
MFT_OUTPUT_DATA_BUFFER
data
=
{.
pSample
=
create_sample
(
NULL
,
1
)};
hr
=
IMFTransform_ProcessOutput
(
transform
,
0
,
1
,
&
data
,
&
output_status
);
todo_wine
ok
(
hr
==
MF_E_TRANSFORM_NEED_MORE_INPUT
,
"ProcessOutput returned %#lx
\n
"
,
hr
);
IMFSample_Release
(
data
.
pSample
);
hr
=
S_OK
;
...
...
dlls/winegstreamer/wg_sample.c
View file @
596dfad3
...
...
@@ -358,11 +358,6 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, IMFSample *sample,
return
hr
;
wg_sample
->
size
=
0
;
if
(
wg_sample
->
max_size
<
sample_size
)
{
wg_sample_release
(
wg_sample
);
return
MF_E_BUFFERTOOSMALL
;
}
if
(
FAILED
(
hr
=
wg_transform_read_data
(
transform
,
wg_sample
,
format
)))
{
...
...
dlls/winegstreamer/wg_transform.c
View file @
596dfad3
...
...
@@ -594,19 +594,19 @@ NTSTATUS wg_transform_push_data(void *args)
return
STATUS_SUCCESS
;
}
static
bool
copy_video_buffer
(
GstBuffer
*
buffer
,
GstCaps
*
caps
,
gsize
plane_align
,
static
NTSTATUS
copy_video_buffer
(
GstBuffer
*
buffer
,
GstCaps
*
caps
,
gsize
plane_align
,
struct
wg_sample
*
sample
,
gsize
*
total_size
)
{
NTSTATUS
status
=
STATUS_UNSUCCESSFUL
;
GstVideoFrame
src_frame
,
dst_frame
;
GstVideoInfo
src_info
,
dst_info
;
GstVideoAlignment
align
;
GstBuffer
*
dst_buffer
;
bool
ret
=
false
;
if
(
!
gst_video_info_from_caps
(
&
src_info
,
caps
))
{
GST_ERROR
(
"Failed to get video info from caps."
);
return
false
;
return
STATUS_UNSUCCESSFUL
;
}
dst_info
=
src_info
;
...
...
@@ -615,14 +615,14 @@ static bool copy_video_buffer(GstBuffer *buffer, GstCaps *caps, gsize plane_alig
if
(
sample
->
max_size
<
dst_info
.
size
)
{
GST_ERROR
(
"Output buffer is too small."
);
return
false
;
return
STATUS_BUFFER_TOO_SMALL
;
}
if
(
!
(
dst_buffer
=
gst_buffer_new_wrapped_full
(
0
,
sample
->
data
,
sample
->
max_size
,
0
,
sample
->
max_size
,
0
,
NULL
)))
{
GST_ERROR
(
"Failed to wrap wg_sample into GstBuffer"
);
return
false
;
return
STATUS_UNSUCCESSFUL
;
}
gst_buffer_set_size
(
dst_buffer
,
dst_info
.
size
);
*
total_size
=
sample
->
size
=
dst_info
.
size
;
...
...
@@ -635,7 +635,9 @@ static bool copy_video_buffer(GstBuffer *buffer, GstCaps *caps, gsize plane_alig
GST_ERROR
(
"Failed to map destination frame."
);
else
{
if
(
!
(
ret
=
gst_video_frame_copy
(
&
dst_frame
,
&
src_frame
)))
if
(
gst_video_frame_copy
(
&
dst_frame
,
&
src_frame
))
status
=
STATUS_SUCCESS
;
else
GST_ERROR
(
"Failed to copy video frame."
);
gst_video_frame_unmap
(
&
dst_frame
);
}
...
...
@@ -643,16 +645,16 @@ static bool copy_video_buffer(GstBuffer *buffer, GstCaps *caps, gsize plane_alig
}
gst_buffer_unref
(
dst_buffer
);
return
ret
;
return
status
;
}
static
bool
copy_buffer
(
GstBuffer
*
buffer
,
GstCaps
*
caps
,
struct
wg_sample
*
sample
,
static
NTSTATUS
copy_buffer
(
GstBuffer
*
buffer
,
GstCaps
*
caps
,
struct
wg_sample
*
sample
,
gsize
*
total_size
)
{
GstMapInfo
info
;
if
(
!
gst_buffer_map
(
buffer
,
&
info
,
GST_MAP_READ
))
return
false
;
return
STATUS_UNSUCCESSFUL
;
if
(
sample
->
max_size
>=
info
.
size
)
sample
->
size
=
info
.
size
;
...
...
@@ -669,14 +671,15 @@ static bool copy_buffer(GstBuffer *buffer, GstCaps *caps, struct wg_sample *samp
gst_buffer_resize
(
buffer
,
sample
->
size
,
-
1
);
*
total_size
=
info
.
size
;
return
true
;
return
STATUS_SUCCESS
;
}
static
NTSTATUS
read_transform_output_data
(
GstBuffer
*
buffer
,
GstCaps
*
caps
,
gsize
plane_align
,
struct
wg_sample
*
sample
)
{
bool
ret
,
needs_copy
;
gsize
total_size
;
bool
needs_copy
;
NTSTATUS
status
;
GstMapInfo
info
;
if
(
!
gst_buffer_map
(
buffer
,
&
info
,
GST_MAP_READ
))
...
...
@@ -686,20 +689,21 @@ static NTSTATUS read_transform_output_data(GstBuffer *buffer, GstCaps *caps, gsi
return
STATUS_UNSUCCESSFUL
;
}
needs_copy
=
info
.
data
!=
sample
->
data
;
total_size
=
sample
->
size
=
info
.
size
;
gst_buffer_unmap
(
buffer
,
&
info
);
if
(
(
ret
=
!
needs_copy
)
)
total_size
=
sample
->
size
=
info
.
size
;
if
(
!
needs_copy
)
status
=
STATUS_SUCCESS
;
else
if
(
stream_type_from_caps
(
caps
)
==
GST_STREAM_TYPE_VIDEO
)
ret
=
copy_video_buffer
(
buffer
,
caps
,
plane_align
,
sample
,
&
total_size
);
status
=
copy_video_buffer
(
buffer
,
caps
,
plane_align
,
sample
,
&
total_size
);
else
ret
=
copy_buffer
(
buffer
,
caps
,
sample
,
&
total_size
);
status
=
copy_buffer
(
buffer
,
caps
,
sample
,
&
total_size
);
if
(
!
ret
)
if
(
status
)
{
GST_ERROR
(
"Failed to copy buffer %p"
,
buffer
);
sample
->
size
=
0
;
return
STATUS_UNSUCCESSFUL
;
return
status
;
}
if
(
GST_BUFFER_PTS_IS_VALID
(
buffer
))
...
...
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