mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
pad-monitor: add check for out of segment buffer data
This commit is contained in:
parent
a60c2efe4a
commit
95f81d7240
2 changed files with 15 additions and 0 deletions
|
@ -39,6 +39,7 @@ G_BEGIN_DECLS
|
|||
#define GST_QA_ELEMENT_MONITOR_CLASS_CAST(klass) ((GstQaElementMonitorClass*)(klass))
|
||||
|
||||
#define GST_QA_ELEMENT_MONITOR_GET_ELEMENT(m) (GST_ELEMENT_CAST (GST_QA_MONITOR_GET_OBJECT (m)))
|
||||
#define GST_QA_ELEMENT_MONITOR_ELEMENT_IS_DECODER(m) (GST_QA_ELEMENT_MONITOR_CAST (m)->is_decoder)
|
||||
|
||||
typedef struct _GstQaElementMonitor GstQaElementMonitor;
|
||||
typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "gst-qa-pad-monitor.h"
|
||||
#include "gst-qa-element-monitor.h"
|
||||
|
||||
/**
|
||||
* SECTION:gst-qa-pad-monitor
|
||||
|
@ -381,8 +382,21 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
|
|||
{
|
||||
GstQaPadMonitor *monitor = udata;
|
||||
|
||||
/* TODO should we assume that a pad-monitor should always have an
|
||||
* element-monitor as a parent? */
|
||||
if (G_LIKELY (GST_QA_MONITOR_GET_PARENT (monitor))) {
|
||||
/* a GstQaPadMonitor parent must be a GstQaElementMonitor */
|
||||
if (GST_QA_ELEMENT_MONITOR_ELEMENT_IS_DECODER (monitor)) {
|
||||
/* should not push out of segment data */
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)) &&
|
||||
GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)) &&
|
||||
!gst_segment_clip (&monitor->segment, monitor->segment.format,
|
||||
GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_TIMESTAMP (buffer) +
|
||||
GST_BUFFER_DURATION (buffer), NULL, NULL)) {
|
||||
/* TODO error */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue