mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
timecodestamper: Clean up old LTC timecodes on LTC discontinuity
We might have some old timecodes that are in the future now and have to drop those to make sure that our queue is correctly ordered and we don't have multiple timecodes for the same running time.
This commit is contained in:
parent
bbdb392abe
commit
a1443518e0
1 changed files with 26 additions and 5 deletions
|
@ -1659,8 +1659,8 @@ gst_timecodestamper_ltcpad_chain (GstPad * pad,
|
||||||
|
|
||||||
if (!timecodestamper->stream_align) {
|
if (!timecodestamper->stream_align) {
|
||||||
timecodestamper->stream_align =
|
timecodestamper->stream_align =
|
||||||
gst_audio_stream_align_new (timecodestamper->ainfo.rate, GST_SECOND,
|
gst_audio_stream_align_new (timecodestamper->ainfo.rate,
|
||||||
40 * GST_MSECOND);
|
500 * GST_MSECOND, 20 * GST_MSECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
discont =
|
discont =
|
||||||
|
@ -1669,8 +1669,11 @@ gst_timecodestamper_ltcpad_chain (GstPad * pad,
|
||||||
×tamp, &duration, NULL);
|
×tamp, &duration, NULL);
|
||||||
|
|
||||||
if (discont) {
|
if (discont) {
|
||||||
if (timecodestamper->ltc_dec)
|
if (timecodestamper->ltc_dec) {
|
||||||
|
GST_WARNING_OBJECT (timecodestamper, "Got discont at %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (timestamp));
|
||||||
ltc_decoder_queue_flush (timecodestamper->ltc_dec);
|
ltc_decoder_queue_flush (timecodestamper->ltc_dec);
|
||||||
|
}
|
||||||
timecodestamper->ltc_total = 0;
|
timecodestamper->ltc_total = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1750,8 +1753,26 @@ gst_timecodestamper_ltcpad_chain (GstPad * pad,
|
||||||
0, 0, timecodestamper->ltc_daily_jam, 0,
|
0, 0, timecodestamper->ltc_daily_jam, 0,
|
||||||
stc.hours, stc.mins, stc.secs, stc.frame, 0);
|
stc.hours, stc.mins, stc.secs, stc.frame, 0);
|
||||||
|
|
||||||
g_queue_push_tail (&timecodestamper->ltc_current_tcs,
|
/* If we have a discontinuity it might happen that we're getting
|
||||||
g_steal_pointer (<c_tc));
|
* timecodes that are in the past relative to timecodes we already have
|
||||||
|
* in our queue. We have to get rid of all the timecodes that are in the
|
||||||
|
* future now. */
|
||||||
|
if (discont) {
|
||||||
|
TimestampedTimecode *tmp;
|
||||||
|
|
||||||
|
while ((tmp = g_queue_peek_tail (&timecodestamper->ltc_current_tcs)) &&
|
||||||
|
tmp->running_time >= ltc_running_time) {
|
||||||
|
gst_video_time_code_clear (&tmp->timecode);
|
||||||
|
g_free (tmp);
|
||||||
|
g_queue_pop_tail (&timecodestamper->ltc_current_tcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_queue_push_tail (&timecodestamper->ltc_current_tcs,
|
||||||
|
g_steal_pointer (<c_tc));
|
||||||
|
} else {
|
||||||
|
g_queue_push_tail (&timecodestamper->ltc_current_tcs,
|
||||||
|
g_steal_pointer (<c_tc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue