summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-11-26 17:08:12 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-11-30 12:04:44 -0300
commitd33af6d0f18e12df3e039be4e0de2b423b8f9809 (patch)
treedbc26a31c89d77f66a3df6e367c8d4a17621ed3b
parent2c0d94028eccd3af9523a3f9cc7aec0c9a903a24 (diff)
media-descriptor-writer: track running time of buffersmedia-check-frames
PTS and DTS can be deceiving as a change in segment can dramatically change playback synchronization. Track the running-time as well to properly get any change in synchronization
-rw-r--r--validate/gst/validate/media-descriptor-parser.c2
-rw-r--r--validate/gst/validate/media-descriptor-writer.c42
-rw-r--r--validate/gst/validate/media-descriptor.c1
-rw-r--r--validate/gst/validate/media-descriptor.h2
4 files changed, 41 insertions, 6 deletions
diff --git a/validate/gst/validate/media-descriptor-parser.c b/validate/gst/validate/media-descriptor-parser.c
index 9d19696..8cde648 100644
--- a/validate/gst/validate/media-descriptor-parser.c
+++ b/validate/gst/validate/media-descriptor-parser.c
@@ -135,6 +135,8 @@ deserialize_framenode (const gchar ** names, const gchar ** values)
framenode->pts = g_ascii_strtoull (values[i], NULL, 0);
else if (g_strcmp0 (names[i], "dts") == 0)
framenode->dts = g_ascii_strtoull (values[i], NULL, 0);
+ else if (g_strcmp0 (names[i], "running-time") == 0)
+ framenode->running_time = g_ascii_strtoull (values[i], NULL, 0);
else if (g_strcmp0 (names[i], "checksum") == 0)
framenode->checksum = g_strdup (values[i]);
else if (g_strcmp0 (names[i], "is-keyframe") == 0) {
diff --git a/validate/gst/validate/media-descriptor-writer.c b/validate/gst/validate/media-descriptor-writer.c
index 9e79cb2..d97f49e 100644
--- a/validate/gst/validate/media-descriptor-writer.c
+++ b/validate/gst/validate/media-descriptor-writer.c
@@ -293,7 +293,31 @@ static GstPadProbeReturn
_uridecodebin_probe (GstPad * pad, GstPadProbeInfo * info,
GstMediaDescriptorWriter * writer)
{
- gst_media_descriptor_writer_add_frame (writer, pad, info->data);
+ if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
+ gst_media_descriptor_writer_add_frame (writer, pad, info->data);
+ } else if (GST_PAD_PROBE_INFO_TYPE (info) &
+ GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
+ GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_SEGMENT:{
+ const GstSegment *segment;
+ StreamNode *streamnode;
+
+ streamnode =
+ gst_media_descriptor_find_stream_node_by_pad ((GstMediaDescriptor *)
+ writer, pad);
+ if (streamnode) {
+ gst_event_parse_segment (event, &segment);
+ gst_segment_copy_into (segment, &streamnode->segment);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ } else {
+ g_assert_not_reached ();
+ }
return GST_PAD_PROBE_OK;
}
@@ -409,7 +433,8 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
}
}
- gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BUFFER,
+ gst_pad_add_probe (srcpad,
+ GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
(GstPadProbeCallback) _uridecodebin_probe, writer, NULL);
}
@@ -817,16 +842,21 @@ gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter
fnode->duration = GST_BUFFER_DURATION (buf);
fnode->pts = GST_BUFFER_PTS (buf);
fnode->dts = GST_BUFFER_DTS (buf);
- fnode->is_keyframe = (GST_BUFFER_FLAG_IS_SET (buf,
- GST_BUFFER_FLAG_DELTA_UNIT) == FALSE);
+ fnode->running_time =
+ gst_segment_to_running_time (&streamnode->segment, GST_FORMAT_TIME,
+ GST_BUFFER_PTS (buf));
+ fnode->is_keyframe =
+ (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT) == FALSE);
fnode->str_open =
g_markup_printf_escaped (" <frame duration=\"%" G_GUINT64_FORMAT
"\" id=\"%i\" is-keyframe=\"%s\" offset=\"%" G_GUINT64_FORMAT
"\" offset-end=\"%" G_GUINT64_FORMAT "\" pts=\"%" G_GUINT64_FORMAT
- "\" dts=\"%" G_GUINT64_FORMAT "\" checksum=\"%s\"/>",
+ "\" dts=\"%" G_GUINT64_FORMAT "\" running-time=\"%" G_GUINT64_FORMAT
+ "\" checksum=\"%s\"/>",
fnode->duration, id, fnode->is_keyframe ? "true" : "false",
- fnode->offset, fnode->offset_end, fnode->pts, fnode->dts, checksum);
+ fnode->offset, fnode->offset_end, fnode->pts, fnode->dts,
+ fnode->running_time, checksum);
fnode->str_close = NULL;
diff --git a/validate/gst/validate/media-descriptor.c b/validate/gst/validate/media-descriptor.c
index 8521184..7ce23d2 100644
--- a/validate/gst/validate/media-descriptor.c
+++ b/validate/gst/validate/media-descriptor.c
@@ -359,6 +359,7 @@ compare_frames (GstMediaDescriptor * ref, FrameNode * rframe,
CHECK_FRAME_FIELD (pts, "%" G_GUINT64_FORMAT);
CHECK_FRAME_FIELD (dts, "%" G_GUINT64_FORMAT);
CHECK_FRAME_FIELD (duration, "%" G_GUINT64_FORMAT);
+ CHECK_FRAME_FIELD (running_time, "%" G_GUINT64_FORMAT);
CHECK_FRAME_FIELD (offset, "%" G_GUINT64_FORMAT);
CHECK_FRAME_FIELD (offset_end, "%" G_GUINT64_FORMAT);
CHECK_FRAME_FIELD (is_keyframe, "%d");
diff --git a/validate/gst/validate/media-descriptor.h b/validate/gst/validate/media-descriptor.h
index 30afebc..e2d486d 100644
--- a/validate/gst/validate/media-descriptor.h
+++ b/validate/gst/validate/media-descriptor.h
@@ -85,6 +85,7 @@ typedef struct
/* Attributes */
GstCaps *caps;
+ GstSegment segment;
gchar *id;
gchar *padname;
@@ -104,6 +105,7 @@ typedef struct
guint64 offset_end;
GstClockTime duration;
GstClockTime pts, dts;
+ GstClockTime running_time;
gboolean is_keyframe;
GstBuffer *buf;