mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:17:14 +00:00
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.
This commit is contained in:
parent
5a80ace060
commit
13059c229e
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue