summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2017-10-10 18:03:15 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-12-01 11:58:32 +0200
commitacce0248d5bc03ff72ee025080e2b5f46d88b8fa (patch)
treeae679f1e0504b00465af4b08f1a06c74d883aad4
parent4d7625f0f9aa25bad20f89930a1f7760e4162de3 (diff)
downloadgstreamer-plugins-bad-acce0248d5bc03ff72ee025080e2b5f46d88b8fa.tar.gz
decklink: Print one "dropped N old frames" message, not one per frame
If we drop many frames at once, printing one message per video frame and one per audio packet would cause a lot of disk IO. Just print a total at the end. https://bugzilla.gnome.org/show_bug.cgi?id=788780
-rw-r--r--sys/decklink/gstdecklinkaudiosrc.cpp15
-rw-r--r--sys/decklink/gstdecklinkvideosrc.cpp15
2 files changed, 26 insertions, 4 deletions
diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp
index 43c2d4236..84153d2fc 100644
--- a/sys/decklink/gstdecklinkaudiosrc.cpp
+++ b/sys/decklink/gstdecklinkaudiosrc.cpp
@@ -518,16 +518,27 @@ gst_decklink_audio_src_got_packet (GstElement * element,
g_mutex_lock (&self->lock);
if (!self->flushing) {
CapturePacket p;
+ guint skipped_packets = 0;
+ GstClockTime from_timestamp = GST_CLOCK_TIME_NONE;
+ GstClockTime to_timestamp = GST_CLOCK_TIME_NONE;
while (gst_queue_array_get_length (self->current_packets) >=
self->buffer_size) {
CapturePacket *tmp = (CapturePacket *)
gst_queue_array_pop_head_struct (self->current_packets);
- GST_WARNING_OBJECT (self, "Dropping old packet at %" GST_TIME_FORMAT,
- GST_TIME_ARGS (tmp->timestamp));
+ if (skipped_packets == 0)
+ from_timestamp = tmp->timestamp;
+ skipped_packets++;
+ to_timestamp = tmp->timestamp;
capture_packet_clear (tmp);
}
+ if (skipped_packets > 0)
+ GST_WARNING_OBJECT (self,
+ "Dropped %u old packets from %" GST_TIME_FORMAT " to %"
+ GST_TIME_FORMAT, skipped_packets, GST_TIME_ARGS (from_timestamp),
+ GST_TIME_ARGS (to_timestamp));
+
memset (&p, 0, sizeof (p));
p.packet = packet;
p.timestamp = timestamp;
diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp
index 2a063931b..cfd120bbd 100644
--- a/sys/decklink/gstdecklinkvideosrc.cpp
+++ b/sys/decklink/gstdecklinkvideosrc.cpp
@@ -670,16 +670,27 @@ gst_decklink_video_src_got_frame (GstElement * element,
const GstDecklinkMode *bmode;
GstVideoTimeCodeFlags flags = GST_VIDEO_TIME_CODE_FLAGS_NONE;
guint field_count = 0;
+ guint skipped_frames = 0;
+ GstClockTime from_timestamp = GST_CLOCK_TIME_NONE;
+ GstClockTime to_timestamp = GST_CLOCK_TIME_NONE;
while (gst_queue_array_get_length (self->current_frames) >=
self->buffer_size) {
CaptureFrame *tmp = (CaptureFrame *)
gst_queue_array_pop_head_struct (self->current_frames);
- GST_WARNING_OBJECT (self, "Dropping old frame at %" GST_TIME_FORMAT,
- GST_TIME_ARGS (tmp->timestamp));
+ if (skipped_frames == 0)
+ from_timestamp = tmp->timestamp;
+ skipped_frames++;
+ to_timestamp = tmp->timestamp;
capture_frame_clear (tmp);
}
+ if (skipped_frames > 0)
+ GST_WARNING_OBJECT (self,
+ "Dropped %u old frames from %" GST_TIME_FORMAT " to %"
+ GST_TIME_FORMAT, skipped_frames, GST_TIME_ARGS (from_timestamp),
+ GST_TIME_ARGS (to_timestamp));
+
memset (&f, 0, sizeof (f));
f.frame = frame;
f.timestamp = timestamp;