mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
decklinkaudiosrc: Calculate the duration more accurately from the capture time and numbers of samples
This should prevent any accumulating rounding errors with the duration.
This commit is contained in:
parent
912e58c64c
commit
254337365a
1 changed files with 7 additions and 4 deletions
|
@ -499,16 +499,19 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
|
|||
ap->input->AddRef ();
|
||||
|
||||
timestamp = p->capture_time;
|
||||
duration =
|
||||
gst_util_uint64_scale_int (sample_count, GST_SECOND, self->info.rate);
|
||||
|
||||
// Jitter and discontinuity handling, based on audiobasesrc
|
||||
start_time = timestamp;
|
||||
end_time = p->capture_time + duration;
|
||||
|
||||
// Convert to the sample numbers
|
||||
start_offset = gst_util_uint64_scale (start_time, self->info.rate, GST_SECOND);
|
||||
start_offset =
|
||||
gst_util_uint64_scale (start_time, self->info.rate, GST_SECOND);
|
||||
|
||||
end_offset = start_offset + sample_count;
|
||||
end_time = gst_util_uint64_scale_int (end_offset, GST_SECOND,
|
||||
self->info.rate);
|
||||
|
||||
duration = end_time - start_time;
|
||||
|
||||
if (self->next_offset == (guint64) - 1) {
|
||||
discont = TRUE;
|
||||
|
|
Loading…
Reference in a new issue