summaryrefslogtreecommitdiffstats
path: root/gst/liveadder
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2008-04-03 00:57:28 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-17 19:29:03 +0100
commit1e7eeda1155fe5c1099341f63d931b6db3a3249f (patch)
treeb913f2e9663d3e29d17922dee199f940719e3710 /gst/liveadder
parent56757b3ae2a379415b341d254b7e53281dfff485 (diff)
downloadgst-plugins-bad-1e7eeda1155fe5c1099341f63d931b6db3a3249f.tar.gz
gst-plugins-bad-1e7eeda1155fe5c1099341f63d931b6db3a3249f.tar.bz2
gst-plugins-bad-1e7eeda1155fe5c1099341f63d931b6db3a3249f.zip
[MOVED FROM GST-P-FARSIGHT] Rename next_ts into expected_ts, make sure all buffers have a duration
20080403005728-3e2dc-8245ce1bfeebebfb8f75073253b3c0e3c4b5f596.gz
Diffstat (limited to 'gst/liveadder')
-rw-r--r--gst/liveadder/liveadder.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c
index 1c126f99..fd452552 100644
--- a/gst/liveadder/liveadder.c
+++ b/gst/liveadder/liveadder.c
@@ -84,7 +84,7 @@ typedef struct _GstLiveAdderPadPrivate
GstSegment segment;
gboolean eos;
- GstClockTime next_timestamp;
+ GstClockTime expected_timestamp;
} GstLiveAdderPadPrivate;
@@ -818,22 +818,27 @@ gst_live_live_adder_chain (GstPad *pad, GstBuffer *buffer)
}
/* Just see if we receive invalid timestamp/durations */
- if (GST_CLOCK_TIME_IS_VALID (padprivate->next_timestamp) &&
+ if (GST_CLOCK_TIME_IS_VALID (padprivate->expected_timestamp) &&
!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT) &&
- GST_BUFFER_TIMESTAMP(buffer) != padprivate->next_timestamp)
+ GST_BUFFER_TIMESTAMP(buffer) != padprivate->expected_timestamp)
GST_ERROR_OBJECT (adder,
"Timestamp discontinuity without the DISCONT flag set"
" (expected %" GST_TIME_FORMAT ", got %" GST_TIME_FORMAT")",
- GST_TIME_ARGS (padprivate->next_timestamp),
+ GST_TIME_ARGS (padprivate->expected_timestamp),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
- if ( GST_BUFFER_DURATION_IS_VALID(buffer))
- padprivate->next_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
+ buffer = gst_buffer_make_metadata_writable (buffer);
+
+ /* If there is no duration, lets set one */
+ if (!GST_BUFFER_DURATION_IS_VALID (buffer)) {
+ GST_BUFFER_DURATION (buffer) =
+ gst_audio_duration_from_pad_buffer (pad, buffer);
+ padprivate->expected_timestamp = GST_CLOCK_TIME_NONE;
+ } else {
+ padprivate->expected_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
GST_BUFFER_DURATION (buffer);
- else
- padprivate->next_timestamp = GST_CLOCK_TIME_NONE;
+ }
- buffer = gst_buffer_make_metadata_writable (buffer);
/*
* Lets clip the buffer to the segment (so we don't have to worry about
@@ -1220,7 +1225,7 @@ gst_live_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
gst_segment_init (&padprivate->segment, GST_FORMAT_UNDEFINED);
padprivate->eos = FALSE;
- padprivate->next_timestamp = GST_CLOCK_TIME_NONE;
+ padprivate->expected_timestamp = GST_CLOCK_TIME_NONE;
gst_pad_set_element_private (newpad, padprivate);
@@ -1285,7 +1290,7 @@ reset_pad_private (gpointer data, gpointer user_data)
gst_segment_init (&padprivate->segment, GST_FORMAT_UNDEFINED);
- padprivate->next_timestamp = GST_CLOCK_TIME_NONE;
+ padprivate->expected_timestamp = GST_CLOCK_TIME_NONE;
padprivate->eos = FALSE;
}