mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:56:14 +00:00
decklink*src: Aggregate dropped frame/packet logging
decklink*src currently prints a log entry for every dropped frame and audio packet. That completely spams the logs. This change aggregates information about dropped packets and only prints a message once when dropping starts, and a summary when dropping ends. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/705 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/378>
This commit is contained in:
parent
9d810bbd81
commit
a45b0c8f1a
4 changed files with 44 additions and 16 deletions
|
@ -237,6 +237,10 @@ gst_decklink_audio_src_init (GstDecklinkAudioSrc * self)
|
||||||
self->current_packets =
|
self->current_packets =
|
||||||
gst_queue_array_new_for_struct (sizeof (CapturePacket),
|
gst_queue_array_new_for_struct (sizeof (CapturePacket),
|
||||||
DEFAULT_BUFFER_SIZE);
|
DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
|
self->skipped_last = 0;
|
||||||
|
self->skip_from_timestamp = GST_CLOCK_TIME_NONE;
|
||||||
|
self->skip_to_timestamp = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -526,25 +530,31 @@ gst_decklink_audio_src_got_packet (GstElement * element,
|
||||||
if (!self->flushing) {
|
if (!self->flushing) {
|
||||||
CapturePacket p;
|
CapturePacket p;
|
||||||
guint skipped_packets = 0;
|
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) >=
|
while (gst_queue_array_get_length (self->current_packets) >=
|
||||||
self->buffer_size) {
|
self->buffer_size) {
|
||||||
CapturePacket *tmp = (CapturePacket *)
|
CapturePacket *tmp = (CapturePacket *)
|
||||||
gst_queue_array_pop_head_struct (self->current_packets);
|
gst_queue_array_pop_head_struct (self->current_packets);
|
||||||
if (skipped_packets == 0)
|
if (skipped_packets == 0 && self->skipped_last == 0)
|
||||||
from_timestamp = tmp->timestamp;
|
self->skip_from_timestamp = tmp->timestamp;
|
||||||
skipped_packets++;
|
skipped_packets++;
|
||||||
to_timestamp = tmp->timestamp;
|
self->skip_to_timestamp = tmp->timestamp;
|
||||||
capture_packet_clear (tmp);
|
capture_packet_clear (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipped_packets > 0)
|
if (self->skipped_last == 0 && skipped_packets > 0) {
|
||||||
|
GST_WARNING_OBJECT (self, "Starting to drop audio packets");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipped_packets == 0 && self->skipped_last > 0) {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self,
|
||||||
"Dropped %u old packets from %" GST_TIME_FORMAT " to %"
|
"Dropped %u old packets from %" GST_TIME_FORMAT " to %"
|
||||||
GST_TIME_FORMAT, skipped_packets, GST_TIME_ARGS (from_timestamp),
|
GST_TIME_FORMAT, self->skipped_last,
|
||||||
GST_TIME_ARGS (to_timestamp));
|
GST_TIME_ARGS (self->skip_from_timestamp),
|
||||||
|
GST_TIME_ARGS (self->skip_to_timestamp));
|
||||||
|
self->skipped_last = 0;
|
||||||
|
}
|
||||||
|
self->skipped_last += skipped_packets;
|
||||||
|
|
||||||
memset (&p, 0, sizeof (p));
|
memset (&p, 0, sizeof (p));
|
||||||
p.packet = packet;
|
p.packet = packet;
|
||||||
|
|
|
@ -81,6 +81,10 @@ struct _GstDecklinkAudioSrc
|
||||||
GstClockTime discont_time;
|
GstClockTime discont_time;
|
||||||
|
|
||||||
guint buffer_size;
|
guint buffer_size;
|
||||||
|
|
||||||
|
guint skipped_last;
|
||||||
|
GstClockTime skip_from_timestamp;
|
||||||
|
GstClockTime skip_to_timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDecklinkAudioSrcClass
|
struct _GstDecklinkAudioSrcClass
|
||||||
|
|
|
@ -408,6 +408,9 @@ gst_decklink_video_src_init (GstDecklinkVideoSrc * self)
|
||||||
self->window_fill = 0;
|
self->window_fill = 0;
|
||||||
self->window_skip = 1;
|
self->window_skip = 1;
|
||||||
self->window_skip_count = 0;
|
self->window_skip_count = 0;
|
||||||
|
self->skipped_last = 0;
|
||||||
|
self->skip_from_timestamp = GST_CLOCK_TIME_NONE;
|
||||||
|
self->skip_to_timestamp = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
gst_base_src_set_live (GST_BASE_SRC (self), TRUE);
|
gst_base_src_set_live (GST_BASE_SRC (self), TRUE);
|
||||||
gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_TIME);
|
gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_TIME);
|
||||||
|
@ -837,27 +840,34 @@ gst_decklink_video_src_got_frame (GstElement * element,
|
||||||
GstVideoTimeCodeFlags flags = GST_VIDEO_TIME_CODE_FLAGS_NONE;
|
GstVideoTimeCodeFlags flags = GST_VIDEO_TIME_CODE_FLAGS_NONE;
|
||||||
guint field_count = 0;
|
guint field_count = 0;
|
||||||
guint skipped_frames = 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) >=
|
while (gst_queue_array_get_length (self->current_frames) >=
|
||||||
self->buffer_size) {
|
self->buffer_size) {
|
||||||
CaptureFrame *tmp = (CaptureFrame *)
|
CaptureFrame *tmp = (CaptureFrame *)
|
||||||
gst_queue_array_pop_head_struct (self->current_frames);
|
gst_queue_array_pop_head_struct (self->current_frames);
|
||||||
if (tmp->frame) {
|
if (tmp->frame) {
|
||||||
if (skipped_frames == 0)
|
if (skipped_frames == 0 && self->skipped_last == 0)
|
||||||
from_timestamp = tmp->timestamp;
|
self->skip_from_timestamp = tmp->timestamp;
|
||||||
skipped_frames++;
|
skipped_frames++;
|
||||||
to_timestamp = tmp->timestamp;
|
self->skip_to_timestamp = tmp->timestamp;
|
||||||
}
|
}
|
||||||
capture_frame_clear (tmp);
|
capture_frame_clear (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipped_frames > 0)
|
if (self->skipped_last == 0 && skipped_frames > 0) {
|
||||||
|
GST_WARNING_OBJECT (self, "Starting to drop frames");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipped_frames == 0 && self->skipped_last > 0) {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self,
|
||||||
"Dropped %u old frames from %" GST_TIME_FORMAT " to %"
|
"Dropped %u old frames from %" GST_TIME_FORMAT " to %"
|
||||||
GST_TIME_FORMAT, skipped_frames, GST_TIME_ARGS (from_timestamp),
|
GST_TIME_FORMAT, self->skipped_last,
|
||||||
GST_TIME_ARGS (to_timestamp));
|
GST_TIME_ARGS (self->skip_from_timestamp),
|
||||||
|
GST_TIME_ARGS (self->skip_to_timestamp));
|
||||||
|
self->skipped_last = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
self->skipped_last += skipped_frames;
|
||||||
|
|
||||||
memset (&f, 0, sizeof (f));
|
memset (&f, 0, sizeof (f));
|
||||||
f.frame = frame;
|
f.frame = frame;
|
||||||
|
|
|
@ -111,6 +111,10 @@ struct _GstDecklinkVideoSrc
|
||||||
gboolean output_afd_bar;
|
gboolean output_afd_bar;
|
||||||
gint last_afd_bar_vbi_line;
|
gint last_afd_bar_vbi_line;
|
||||||
gint last_afd_bar_vbi_line_field2;
|
gint last_afd_bar_vbi_line_field2;
|
||||||
|
|
||||||
|
guint skipped_last;
|
||||||
|
GstClockTime skip_from_timestamp;
|
||||||
|
GstClockTime skip_to_timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDecklinkVideoSrcClass
|
struct _GstDecklinkVideoSrcClass
|
||||||
|
|
Loading…
Reference in a new issue