Commit 13059c22 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

winegstreamer: Set the discontinuity flag in wg_transform.

This is required to avoid glitches when seeking, as some formats (e.g. MP3) may use data from previous frames.
parent 5a80ace0
......@@ -135,6 +135,7 @@ enum wg_sample_flag
WG_SAMPLE_FLAG_HAS_PTS = 2,
WG_SAMPLE_FLAG_HAS_DURATION = 4,
WG_SAMPLE_FLAG_SYNC_POINT = 8,
WG_SAMPLE_FLAG_DISCONTINUITY = 0x10,
};
struct wg_sample
......
......@@ -277,6 +277,8 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
}
if (SUCCEEDED(IMFSample_GetUINT32(sample, &MFSampleExtension_CleanPoint, &value)) && value)
wg_sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
if (SUCCEEDED(IMFSample_GetUINT32(sample, &MFSampleExtension_Discontinuity, &value)) && value)
wg_sample->flags |= WG_SAMPLE_FLAG_DISCONTINUITY;
wg_sample_queue_begin_append(queue, wg_sample);
hr = wg_transform_push_data(transform, wg_sample);
......@@ -320,6 +322,8 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, IMFSample *sample,
IMFSample_SetSampleDuration(sample, wg_sample->duration);
if (wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT)
IMFSample_SetUINT32(sample, &MFSampleExtension_CleanPoint, 1);
if (wg_sample->flags & WG_SAMPLE_FLAG_DISCONTINUITY)
IMFSample_SetUINT32(sample, &MFSampleExtension_Discontinuity, 1);
if (SUCCEEDED(hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer)))
{
......@@ -354,6 +358,8 @@ HRESULT wg_transform_push_quartz(struct wg_transform *transform, struct wg_sampl
if (IMediaSample_IsSyncPoint(sample->u.quartz.sample) == S_OK)
wg_sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
if (IMediaSample_IsDiscontinuity(sample->u.quartz.sample) == S_OK)
wg_sample->flags |= WG_SAMPLE_FLAG_DISCONTINUITY;
wg_sample_queue_begin_append(queue, wg_sample);
hr = wg_transform_push_data(transform, wg_sample);
......@@ -397,6 +403,8 @@ HRESULT wg_transform_read_quartz(struct wg_transform *transform, struct wg_sampl
value = !!(wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT);
IMediaSample_SetSyncPoint(sample->u.quartz.sample, value);
value = !!(wg_sample->flags & WG_SAMPLE_FLAG_DISCONTINUITY);
IMediaSample_SetDiscontinuity(sample->u.quartz.sample, value);
return S_OK;
}
......@@ -648,6 +648,8 @@ NTSTATUS wg_transform_push_data(void *args)
GST_BUFFER_DURATION(buffer) = sample->duration * 100;
if (!(sample->flags & WG_SAMPLE_FLAG_SYNC_POINT))
GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);
if (sample->flags & WG_SAMPLE_FLAG_DISCONTINUITY)
GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DISCONT);
gst_atomic_queue_push(transform->input_queue, buffer);
params->result = S_OK;
......@@ -781,6 +783,8 @@ static NTSTATUS read_transform_output_data(GstBuffer *buffer, GstCaps *caps, gsi
}
if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT))
sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT))
sample->flags |= WG_SAMPLE_FLAG_DISCONTINUITY;
if (needs_copy)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment