diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2010-09-29 10:08:17 +0200 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2010-09-29 11:30:00 +0200 |
commit | 636d1caf0db5d206ee77fafb8749ea407927ecb5 (patch) | |
tree | 5e02b60bf2b8a1096a9f405e41ecea1ad06a6835 /ext/faad | |
parent | 4e43e8bc677f52c5a6e88c4861f4d5e448fe60f8 (diff) | |
download | gstreamer-plugins-bad-636d1caf0db5d206ee77fafb8749ea407927ecb5.tar.gz |
faad: tweak output buffer timestamping
In particular, avoid packetised input leading to initial to non-0 output ts.
Diffstat (limited to 'ext/faad')
-rw-r--r-- | ext/faad/gstfaad.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 5e4570095..527503a2b 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -263,8 +263,8 @@ gst_faad_reset (GstFaad * faad) faad->packetised = FALSE; g_free (faad->channel_positions); faad->channel_positions = NULL; - faad->next_ts = 0; - faad->prev_ts = GST_CLOCK_TIME_NONE; + faad->next_ts = GST_CLOCK_TIME_NONE; + faad->prev_ts = 0; faad->bytes_in = 0; faad->sum_dur_out = 0; faad->error_count = 0; @@ -698,8 +698,8 @@ gst_faad_sink_event (GstPad * pad, GstEvent * event) " - %" GST_TIME_FORMAT, GST_TIME_ARGS (new_start), GST_TIME_ARGS (new_end)); - faad->next_ts = new_start; - faad->prev_ts = GST_CLOCK_TIME_NONE; + faad->next_ts = GST_CLOCK_TIME_NONE; + faad->prev_ts = new_start; } res = gst_pad_push_event (faad->srcpad, event); @@ -1045,16 +1045,22 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer) next = FALSE; } - ts = gst_adapter_prev_timestamp (faad->adapter, NULL); - if (GST_CLOCK_TIME_IS_VALID (ts) && (ts != faad->prev_ts)) - faad->prev_ts = faad->next_ts = ts; - available = gst_adapter_available (faad->adapter); input_size = available; - if (G_UNLIKELY (!available)) goto out; + ts = gst_adapter_prev_timestamp (faad->adapter, NULL); + if (GST_CLOCK_TIME_IS_VALID (ts) && (ts != faad->prev_ts)) { + faad->prev_ts = ts; + } else { + /* nothing new */ + ts = GST_CLOCK_TIME_NONE; + } + + if (!GST_CLOCK_TIME_IS_VALID (faad->next_ts)) + faad->next_ts = faad->prev_ts; + input_data = (guchar *) gst_adapter_peek (faad->adapter, available); if (!faad->packetised) { @@ -1211,6 +1217,12 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer) } } } + + /* adjust to incoming new timestamp, if any, after decoder delay */ + if (GST_CLOCK_TIME_IS_VALID (ts)) { + faad->next_ts = ts; + ts = GST_CLOCK_TIME_NONE; + } } out: |