mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +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_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_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 _GstQaElementMonitor GstQaElementMonitor;
|
||||||
typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
|
typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gst-qa-pad-monitor.h"
|
#include "gst-qa-pad-monitor.h"
|
||||||
|
#include "gst-qa-element-monitor.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gst-qa-pad-monitor
|
* SECTION:gst-qa-pad-monitor
|
||||||
|
@ -381,8 +382,21 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
{
|
{
|
||||||
GstQaPadMonitor *monitor = udata;
|
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))) {
|
if (G_LIKELY (GST_QA_MONITOR_GET_PARENT (monitor))) {
|
||||||
/* a GstQaPadMonitor parent must be a GstQaElementMonitor */
|
/* 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue