Skip to content

Commit ac06ae2

Browse files
mariannasbMarianna Smidth Buschle
authored andcommitted
Fix event queue handling
Send all queued events with "timestamp < buffer timestamp" instead of just the 1st one before sending the buffer. Only the 1st event of the event queue with "timestamp < buffer timestamp" was being send before the buffer. But there could be several events in the queue that should sent before the buffer. Fixes #96 The segment event was not being handled properly when using x264enc + mpegtsmux together with interpipesrc/sink. Which was causing 2 segment to be delivered to the mpegtsmux: 1st one generated by the interpipesrc (starting from zero) because no segment existed. 2nd coming from the x264 encoder (correcting the 1000 hours offset added by the encoder). The 1st segment resulted in all subsequent DTS being seen as invalid (backwards) by the muxer. This happened because the event queue contained the following: stream-start, segment, tag, tag, tag. All with timestamp 0. But only the stream-start was sent, then the 1st buffer, then the segment. Which caused the DTS issues.
1 parent 3f63a50 commit ac06ae2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

gst/interpipe/gstinterpipesrc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,14 @@ gst_inter_pipe_src_create (GstBaseSrc * base, guint64 offset, guint size,
479479
"Dequeue buffer %p with timestamp (PTS) %" GST_TIME_FORMAT, *buf,
480480
GST_TIME_ARGS (GST_BUFFER_PTS (*buf)));
481481

482-
if (!g_queue_is_empty (src->pending_serial_events)) {
482+
while (!g_queue_is_empty (src->pending_serial_events)) {
483483
guint curr_bytes;
484484
/*Pending Serial Events Queue */
485485
serial_event = g_queue_peek_head (src->pending_serial_events);
486486

487487
GST_DEBUG_OBJECT (src,
488-
"Got event with timestamp %" GST_TIME_FORMAT,
488+
"Got event %s with timestamp %" GST_TIME_FORMAT,
489+
GST_EVENT_TYPE_NAME (serial_event),
489490
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (serial_event)));
490491

491492
curr_bytes = gst_app_src_get_current_level_bytes (GST_APP_SRC (src));
@@ -501,6 +502,7 @@ gst_inter_pipe_src_create (GstBaseSrc * base, guint64 offset, guint size,
501502
GST_DEBUG_OBJECT (src, "Event %s timestamp is greater than the "
502503
"buffer timestamp, can't send serial event yet",
503504
GST_EVENT_TYPE_NAME (serial_event));
505+
break;
504506
}
505507
}
506508

0 commit comments

Comments
 (0)