livehttp: remove leftover segments if delsegs is on
authorIlkka Ollakka <ileoo@videolan.org>
Mon, 28 Oct 2013 16:13:42 +0000 (18:13 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Mon, 28 Oct 2013 16:22:53 +0000 (18:22 +0200)
Also check if i_numsegs is setted as delsegs is tru by default
and we don't want to cause suprises to people creating VOD-stuff.

modules/access_output/livehttp.c

index 65b104a..60bb0c7 100644 (file)
@@ -781,6 +781,12 @@ static void Close( vlc_object_t * p_this )
     {
         output_segment_t *segment = vlc_array_item_at_index( p_sys->segments_t, 0 );
         vlc_array_remove( p_sys->segments_t, 0 );
+        if( p_sys->b_delsegs && p_sys->i_numsegs && segment->psz_filename )
+        {
+            msg_Dbg( p_access, "Removing segment number %d name %s", segment->i_segment_number, segment->psz_filename );
+            vlc_unlink( segment->psz_filename );
+        }
+
         destroySegment( segment );
     }
     vlc_array_destroy( p_sys->segments_t );