[PATCH 0/1] MR10713: mf: Handle no time and/or duration during markin.
This MR fixes handling of the `MF_TOPONODE_MARKIN_HERE` attribute when sample time and/or duration are missing. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10713
From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/mf/session.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index db837c369d7..095dfad3107 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -3645,7 +3645,7 @@ static void release_output_samples(struct topo_node *node, MFT_OUTPUT_DATA_BUFFE static BOOL transform_node_markin_need_more_input(const struct media_session *session, struct topo_node *node, MFT_OUTPUT_DATA_BUFFER *buffers) { - BOOL need_more_input, drop_sample; + BOOL need_more_input, drop_sample, have_duration, have_time; LONGLONG time, duration; HRESULT hr; UINT i; @@ -3659,7 +3659,7 @@ static BOOL transform_node_markin_need_more_input(const struct media_session *se { struct transform_stream *stream = &node->u.transform.outputs[i]; - drop_sample = FALSE; + drop_sample = have_duration = have_time = FALSE; if (buffers[i].pEvents) need_more_input = FALSE; @@ -3673,19 +3673,32 @@ static BOOL transform_node_markin_need_more_input(const struct media_session *se continue; } - if (FAILED(hr = IMFSample_GetSampleTime(buffers[i].pSample, &time))) - WARN("Failed to get sample time, hr %#lx\n", hr); - else if (FAILED(hr = IMFSample_GetSampleDuration(buffers[i].pSample, &duration))) + if (SUCCEEDED(hr = IMFSample_GetSampleTime(buffers[i].pSample, &time))) + { + have_time = TRUE; + if (SUCCEEDED(hr = IMFSample_GetSampleDuration(buffers[i].pSample, &duration))) + have_duration = TRUE; + else + WARN("Failed to get sample duration, hr %#lx\n", hr); + + if (have_duration && time + duration <= session->presentation.start_position.hVal.QuadPart) + drop_sample = TRUE; + } + else + { WARN("Failed to get sample time, hr %#lx\n", hr); - else if (time + duration <= session->presentation.start_position.hVal.QuadPart) - drop_sample = TRUE; + } - if (!drop_sample && time < session->presentation.start_position.hVal.QuadPart) + if (have_time && !drop_sample && time < session->presentation.start_position.hVal.QuadPart) { LONGLONG delta = session->presentation.start_position.hVal.QuadPart - time; - duration -= delta; IMFSample_SetSampleTime(buffers[i].pSample, session->presentation.start_position.hVal.QuadPart); - IMFSample_SetSampleDuration(buffers[i].pSample, duration); + + if (have_duration) + { + duration -= delta; + IMFSample_SetSampleDuration(buffers[i].pSample, duration); + } if (stream->raw_audio && stream->bytes_per_second && stream->block_alignment) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10713
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10713
participants (3)
-
Brendan McGrath -
Brendan McGrath (@redmcg) -
Nikolay Sivov (@nsivov)