summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@collabora.com>2013-06-13 20:33:00 -0400
committerThibault Saunier <thibault.saunier@collabora.com>2013-06-23 16:57:29 -0400
commit5c026dfe236c6d6493e77c3eaafa643bb0dfd7ff (patch)
treea77aa76135a2be3141413ba61d79cb66e096a5fd
parent9545f1b58e42cf8a80744e7e269fbb650208f729 (diff)
gnlcomposition: Remove support for gaps
The way we were handling gap was weird and not natural at all for users, remove it for now. In the long term, we should have a proper way of filling gaps in the API and for now only emit an STREAM_ERROR message on the bus when a gap is detected. The user is now responsible for filling gaps in the composition https://bugzilla.gnome.org/show_bug.cgi?id=701287
-rw-r--r--gnl/gnlcomposition.c52
-rw-r--r--tests/check/gnl/complex.c41
2 files changed, 40 insertions, 53 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index e1626b4..d2258da 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -200,9 +200,9 @@ static void update_start_stop_duration (GnlComposition * comp);
(MAX (comp->priv->segment->start, GNL_OBJECT_START (comp)))
#define COMP_REAL_STOP(comp) \
- ((GST_CLOCK_TIME_IS_VALID (comp->priv->segment->stop) \
- ? (MIN (comp->priv->segment->stop, GNL_OBJECT_STOP (comp)))) \
- : GNL_OBJECT_STOP (comp))
+ (GST_CLOCK_TIME_IS_VALID (comp->priv->segment->stop) ? \
+ (MIN (comp->priv->segment->stop, GNL_OBJECT_STOP (comp))) : \
+ GNL_OBJECT_STOP (comp))
#define COMP_ENTRY(comp, object) \
(g_hash_table_lookup (comp->priv->objects_hash, (gconstpointer) object))
@@ -1629,7 +1629,6 @@ get_clean_toplevel_stack (GnlComposition * comp, GstClockTime * timestamp,
GstClockTime * start_time, GstClockTime * stop_time)
{
GNode *stack = NULL;
- GList *tmp;
GstClockTime start = G_MAXUINT64;
GstClockTime stop = G_MAXUINT64;
guint highprio;
@@ -1642,42 +1641,17 @@ get_clean_toplevel_stack (GnlComposition * comp, GstClockTime * timestamp,
stack = get_stack_list (comp, *timestamp, 0, TRUE, &start, &stop, &highprio);
- if (!stack) {
- GnlObject *object = NULL;
-
- /* Case for gaps, therefore no objects at specified *timestamp */
- GST_DEBUG_OBJECT (comp,
- "Got empty stack, checking if it really was after the last object");
-
- if (reverse) {
- /* Find the first active object just before *timestamp */
- for (tmp = comp->priv->objects_stop; tmp; tmp = g_list_next (tmp)) {
- object = (GnlObject *) tmp->data;
-
- if (object->stop < *timestamp && object->active)
- break;
- }
- } else {
- /* Find the first active object just after *timestamp */
- for (tmp = comp->priv->objects_start; tmp; tmp = g_list_next (tmp)) {
- object = (GnlObject *) tmp->data;
-
- if (object->start > *timestamp && object->active)
- break;
- }
- }
+ if (!stack &&
+ ((reverse && (*timestamp > COMP_REAL_START (comp))) ||
+ (!reverse && (*timestamp < COMP_REAL_STOP (comp))))) {
+ GST_ELEMENT_ERROR (comp, STREAM, WRONG_TYPE,
+ ("Gaps ( at %" GST_TIME_FORMAT
+ ") in the stream is not supported, the application is responsible"
+ " for filling them", GST_TIME_ARGS (*timestamp)),
+ ("Gap in the composition this should never"
+ "append, make sure to fill them"));
- if (tmp) {
- GST_DEBUG_OBJECT (comp,
- "Found a valid object %s %" GST_TIME_FORMAT " : %s [%"
- GST_TIME_FORMAT " - %" GST_TIME_FORMAT "]",
- (reverse ? "before" : "after"), GST_TIME_ARGS (*timestamp),
- GST_ELEMENT_NAME (object), GST_TIME_ARGS (object->start),
- GST_TIME_ARGS (object->stop));
- *timestamp = (reverse ? object->stop : object->start);
- stack =
- get_stack_list (comp, *timestamp, 0, TRUE, &start, &stop, &highprio);
- }
+ return NULL;
}
GST_DEBUG ("start:%" GST_TIME_FORMAT ", stop:%" GST_TIME_FORMAT,
diff --git a/tests/check/gnl/complex.c b/tests/check/gnl/complex.c
index 4dcecc3..f4b7eb8 100644
--- a/tests/check/gnl/complex.c
+++ b/tests/check/gnl/complex.c
@@ -1,7 +1,8 @@
#include "common.h"
static void
-fill_pipeline_and_check (GstElement * comp, GList * segments)
+fill_pipeline_and_check (GstElement * comp, GList * segments,
+ gint expected_error_domain)
{
GstElement *pipeline, *sink;
CollectStructure *collect;
@@ -56,7 +57,20 @@ fill_pipeline_and_check (GstElement * comp, GList * segments)
fail_if (TRUE);
break;
case GST_MESSAGE_ERROR:
- fail_error_message (message);
+ {
+ GError *error;
+
+ gst_message_parse_error (message, &error, NULL);
+ if (comp == GST_ELEMENT (GST_MESSAGE_SRC (message)) &&
+ expected_error_domain == error->domain) {
+ GST_DEBUG ("Expected Error Message from %s : %s",
+ GST_OBJECT_NAME (GST_MESSAGE_SRC (message)), error->message);
+
+ carry_on = FALSE;
+ } else
+ fail_error_message (message);
+ }
+ break;
default:
break;
}
@@ -66,9 +80,11 @@ fill_pipeline_and_check (GstElement * comp, GList * segments)
GST_DEBUG ("Setting pipeline to READY");
+
fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
+
fail_if (collect->expected_segments != NULL);
GST_DEBUG ("Resetted pipeline to READY");
@@ -77,6 +93,9 @@ fill_pipeline_and_check (GstElement * comp, GList * segments)
collect->gotsegment = FALSE;
collect->expected_base = 0;
+ if (expected_error_domain)
+ goto done;
+
GST_DEBUG ("Setting pipeline to PLAYING again");
fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
@@ -113,6 +132,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments)
fail_if (collect->expected_segments != NULL);
+done:
fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
@@ -197,11 +217,8 @@ GST_START_TEST (test_one_space_another)
/* Expected segments */
segments = g_list_append (segments,
segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
- segments = g_list_append (segments,
- segment_new (1.0, GST_FORMAT_TIME,
- 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND));
- fill_pipeline_and_check (comp, segments);
+ fill_pipeline_and_check (comp, segments, GST_STREAM_ERROR);
}
GST_END_TEST;
@@ -317,7 +334,7 @@ GST_START_TEST (test_one_default_another)
segment_new (1.0, GST_FORMAT_TIME,
4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND));
- fill_pipeline_and_check (comp, segments);
+ fill_pipeline_and_check (comp, segments, GST_STREAM_ERROR);
}
GST_END_TEST;
@@ -438,7 +455,7 @@ GST_START_TEST (test_one_expandable_another)
segment_new (1.0, GST_FORMAT_TIME,
4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND));
- fill_pipeline_and_check (comp, segments);
+ fill_pipeline_and_check (comp, segments, 0);
}
GST_END_TEST;
@@ -722,11 +739,7 @@ GST_START_TEST (test_one_bin_space_another)
segments = g_list_append (segments,
segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
- segments = g_list_append (segments,
- segment_new (1.0, GST_FORMAT_TIME,
- 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND));
-
- fill_pipeline_and_check (comp, segments);
+ fill_pipeline_and_check (comp, segments, GST_STREAM_ERROR);
}
GST_END_TEST;
@@ -796,7 +809,7 @@ GST_START_TEST (test_one_above_another)
segment_new (1.0, GST_FORMAT_TIME,
1 * GST_SECOND, 3 * GST_SECOND, 1 * GST_SECOND));
- fill_pipeline_and_check (comp, segments);
+ fill_pipeline_and_check (comp, segments, 0);
}
GST_END_TEST;