@@ -158,6 +158,7 @@ type stream = {
158
158
codecs : string Lazy .t ; (* * codecs (see RFC 6381) *)
159
159
extname : string ;
160
160
mutable init_state : init_state ;
161
+ mutable init_position : int ;
161
162
mutable position : int ;
162
163
mutable current_segment : segment option ;
163
164
mutable discontinuity_count : int ;
@@ -346,7 +347,8 @@ class hls_output p =
346
347
video_size;
347
348
extname;
348
349
init_state = `Todo ;
349
- position = 0 ;
350
+ init_position = 0 ;
351
+ position = 1 ;
350
352
current_segment = None ;
351
353
discontinuity_count = 0 ;
352
354
}
@@ -607,19 +609,21 @@ class hls_output p =
607
609
(fun stream (name , pos , discontinuity_count ) ->
608
610
assert (name = stream.name);
609
611
stream.discontinuity_count < - discontinuity_count;
610
- stream.position < - pos)
612
+ stream.init_position < - pos;
613
+ stream.position < - pos + 1 )
611
614
streams p;
612
615
segments < - s
613
616
614
- method private process_init ~init ({ extname; name; position } as s ) =
617
+ method private process_init ~init ({ extname; name; init_position } as s ) =
615
618
match init with
616
619
| None -> s.init_state < - `No_init
617
620
| Some data ->
618
- let init_filename = segment_name ~position ~extname name in
621
+ let init_filename =
622
+ segment_name ~position: init_position ~extname name
623
+ in
619
624
let oc = self#open_out init_filename in
620
625
Strings. iter (output_substring oc) data;
621
626
self#close_out ~filename: init_filename oc;
622
- s.position < - s.position + 1 ;
623
627
s.init_state < - `Has_init init_filename
624
628
625
629
method encode frame ofs len =
0 commit comments