hlssink2: first segment after re-start longer than target duration
Here is a short reproducer below. The dis_00000.ts
segment after pipeline restart is always significantly longer than 3 seconds specified in pipeline.
#include <glib.h>
#include <gst/gst.h>
#include <unistd.h>
int main (int argc, char *argv[])
{
GstElement *pipeline;
gst_init (&argc, &argv);
pipeline = gst_parse_launch ("videotestsrc is-live=true ! "
"video/x-raw,width=640,height=480 ! clockoverlay ! "
"x264enc bitrate=3000 tune=zerolatency key-int-max=75 ! "
"video/x-h264,profile=constrained-baseline,level=(string)5.1 ! "
"hlssink2 name=hls playlist-location=/var/video/p.m3u8 target-duration=3 playlist-length=0 location=/var/video/s%05d.ts",
NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print("Pipeline started\n");
sleep(10);
gst_element_set_state (pipeline, GST_STATE_READY);
GstElement *hls = gst_bin_get_by_name ( GST_BIN (pipeline), "hls");
gst_element_set_state (hls, GST_STATE_NULL);
g_print("Set pipeline to READY and hlssink to NULL\n");
sleep(5);
g_object_set(hls, "location", "/var/video/dis_%05d.ts", NULL);
g_print("Set hls location to have dis_ prefix\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print("Set pipeline to PLAYING\n");
sleep(20);
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Makefile
OBJS=pipeline.o
PKG_CONFIG=libsoup-2.4 json-glib-1.0 glib-2.0 gstreamer-1.0 gstreamer-webrtc-1.0 gstreamer-sdp-1.0
CFLAGS=-I include `pkg-config --cflags $(PKG_CONFIG)`
LDFLAGS=`pkg-config --libs $(PKG_CONFIG)`
pipeline: $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Edited by Aaron Boxer