summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-04-05 14:49:51 +0300
committerTim-Philipp Müller <tim@centricular.com>2016-04-06 14:35:49 +0100
commitf5cdddb5d620adb5f0a908b9e37b8127f9a2fe61 (patch)
treeae313ce4b2b44652d40ef9c1c0c6fddd20e759ca
parentc9596c9b82245434cfc07fa70cfc9115ba62ad74 (diff)
downloadgstreamer-plugins-bad-f5cdddb5d620adb5f0a908b9e37b8127f9a2fe61.tar.gz
decklinkaudiosrc: Don't accept packets without timestamps after a discont
We have no idea which timestamps they are supposed to have so the only thing we can do at this point is to drop them. Packets without timestamps happen if audio was captured but no corresponding video, which shouldn't happen under normal circumstances. https://bugzilla.gnome.org/show_bug.cgi?id=747633
-rw-r--r--sys/decklink/gstdecklinkaudiosrc.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp
index 6360c2a72..34488d4d1 100644
--- a/sys/decklink/gstdecklinkaudiosrc.cpp
+++ b/sys/decklink/gstdecklinkaudiosrc.cpp
@@ -412,7 +412,8 @@ gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
static void
gst_decklink_audio_src_got_packet (GstElement * element,
- IDeckLinkAudioInputPacket * packet, GstClockTime capture_time, gboolean discont)
+ IDeckLinkAudioInputPacket * packet, GstClockTime capture_time,
+ gboolean discont)
{
GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (element);
GstDecklinkVideoSrc *videosrc = NULL;
@@ -471,6 +472,7 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
guint64 start_offset, end_offset;
gboolean discont = FALSE;
+retry:
g_mutex_lock (&self->lock);
while (g_queue_is_empty (&self->current_packets) && !self->flushing) {
g_cond_wait (&self->cond, &self->lock);
@@ -490,6 +492,13 @@ gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
sample_count = p->packet->GetSampleFrameCount ();
data_size = self->info.bpf * sample_count;
+ if (p->capture_time == GST_CLOCK_TIME_NONE && self->next_offset == (guint64) - 1) {
+ GST_DEBUG_OBJECT (self, "Got packet without timestamp before initial "
+ "timestamp after discont - dropping");
+ capture_packet_free (p);
+ goto retry;
+ }
+
ap = (AudioPacket *) g_malloc0 (sizeof (AudioPacket));
*buffer =