The following commit has been merged in the master branch:
commit 5c8983f47f7dbbd7b27b2b1abd90476a39a1111f
Author: Romain Beauxis <to...@rastageeks.org>
Date:   Thu Jun 11 02:20:27 2009 +0200

    Added patch from upstream

diff --git a/debian/changelog b/debian/changelog
index 90938c2..f078375 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+liquidsoap (0.9.0-4) unstable; urgency=low
+
+  * Added patch from upstream:
+    o Fix task end for queued sources.
+    o Fix append operator. 
+
+ -- Romain Beauxis <to...@rastageeks.org>  Thu, 11 Jun 2009 02:18:50 +0200
+
 liquidsoap (0.9.0-3) unstable; urgency=low
 
   * Fixed math.h usage in src/rgb_c.c
diff --git a/debian/patches/fix_append.patch b/debian/patches/fix_append.patch
new file mode 100644
index 0000000..b031000
--- /dev/null
+++ b/debian/patches/fix_append.patch
@@ -0,0 +1,30 @@
+Index: liquidsoap/src/operators/append.ml
+===================================================================
+--- liquidsoap.orig/src/operators/append.ml    2009-04-02 11:47:59.000000000 
+0200
++++ liquidsoap/src/operators/append.ml 2009-06-11 02:17:48.000000000 +0200
+@@ -51,7 +51,11 @@
+                       if finished then
+                         if append#is_ready then begin
+                           state <- `Append append ;
+-                          if merge then self#get_frame buf
++                          if merge then
++                            let pos = Frame.position buf in
++                              self#get_frame buf ;
++                              Frame.set_breaks buf
++                                (Utils.remove_one ((=) pos) (Frame.breaks 
buf))
+                         end else begin
+                           self#log#f 3
+                             "Track ends and append source is not ready: \
+@@ -74,7 +78,11 @@
+           if Frame.is_partial buf then
+             if a#is_ready then begin
+               state <- `Append a ;
+-              if merge then self#get_frame buf
++              if merge then
++                let pos = Frame.position buf in
++                  self#get_frame buf ;
++                  Frame.set_breaks buf
++                    (Utils.remove_one ((=) pos) (Frame.breaks buf))
+             end else begin
+               self#log#f 3
+                 "Track ends and append source is not ready: won't append." ;
diff --git a/debian/patches/fix_req_task.patch 
b/debian/patches/fix_req_task.patch
new file mode 100644
index 0000000..3354db1
--- /dev/null
+++ b/debian/patches/fix_req_task.patch
@@ -0,0 +1,204 @@
+Index: liquidsoap/src/sources/request_source.ml
+===================================================================
+--- liquidsoap.orig/src/sources/request_source.ml      2009-04-02 
11:47:59.000000000 +0200
++++ liquidsoap/src/sources/request_source.ml   2009-06-11 02:15:52.000000000 
+0200
+@@ -167,42 +167,41 @@
+   val mutable queue_length = 0 (* Frames *)
+   val mutable resolving = None
+ 
+-  (** State should be `Sleeping on awakening, and is then turned to `Running.
+-    * Eventually #sleep puts it to `Tired, then waits for it to be `Sleeping,
+-    * meaning that the feeding tasks exited. *)
+-  val mutable state = `Sleeping
+-  val state_lock = Mutex.create ()
+-  val state_cond = Condition.create ()
+   val mutable task = None
++  val task_m = Mutex.create ()
++
++  method private create_task = 
++    Tutils.mutexify task_m 
++    (fun () -> 
++      begin
++        match task with
++          | Some reload -> reload := false 
++          | None -> ()
++      end ;
++      let reload = ref true in
++      Duppy.Task.add Tutils.scheduler
++        { Duppy.Task.
++            priority = priority ;
++            events   = [`Delay 0.] ;
++            handler  = self#feed_queue reload } ;
++      task <- Some reload) ()
++
++  method private stop_task =
++    Tutils.mutexify task_m
++    (fun () -> 
++      begin
++        match task with
++          | Some reload -> reload := false
++          | None -> ()
++      end;
++      task <- None) ()
+ 
+   method private wake_up activation =
+     assert (task = None) ;
+-    Tutils.mutexify state_lock
+-      (fun () ->
+-         assert (state = `Sleeping) ;
+-         state <- `Running) () ;
+-    let t = 
+-      Duppy.Async.add Tutils.scheduler ~priority
+-        (fun () ->  Duppy.Task.add Tutils.scheduler
+-                      { Duppy.Task.
+-                        priority = priority ;
+-                        events   = [`Delay 0.] ;
+-                        handler  = (fun _ -> self#feed_queue () ; []) })
+-    in
+-      Duppy.Async.wake_up t ;
+-      task <- Some t
++    self#create_task
+ 
+   method private sleep =
+-    (* Ask the feeding task to die. *)
+-    Tutils.mutexify state_lock
+-      (fun () ->
+-         assert (state = `Running) ;
+-         state <- `Tired) () ;
+-    (* Make sure the task is awake so it can die and let us know about it. *)
+-    Duppy.Async.wake_up (Utils.get_some task) ;
+-    Tutils.wait state_cond state_lock (fun () -> state = `Sleeping) ;
+-    Duppy.Async.stop (Utils.get_some task) ;
+-    task <- None ;
++    self#stop_task ;
+     (* No more feeding task, we can go to sleep. *)
+     super#sleep ;
+     begin try
+@@ -213,16 +212,6 @@
+       done
+     with e -> Mutex.unlock qlock ; if e <> Queue.Empty then raise e end
+ 
+-  (** This method should be called whenever the feeding task has a new
+-    * opportunity to feed the queue, in case it is sleeping. *)
+-  method private notify_new_request =
+-    (* Don't wake up the task while we're trying to shut down,
+-     * it could avoid its death and run forever in the wild. *)
+-    if Tutils.mutexify state_lock (fun () -> state) () = `Running then
+-      match task with
+-        | Some task -> Duppy.Async.wake_up task
+-        | None -> ()
+-
+   (** A function that returns delays for tasks, making sure that these tasks
+     * don't repeat too fast.
+     * The current scheme is to return 0. as long as there are no more than
+@@ -242,33 +231,23 @@
+       next
+ 
+   (** The body of the feeding task *)
+-  method private feed_queue () : unit =
+-    (* If the test fails, the task sleeps. *)
+-    if
+-      Tutils.mutexify state_lock
+-        (fun () ->
+-           if state <> `Tired then true else begin
+-             state <- `Sleeping ;
+-             Condition.signal state_cond ;
+-             false
+-           end) ()
+-    then
+-      if queue_length < min_queue_length then
++  method private feed_queue reload =
++    (fun _ -> 
++      if !reload && queue_length < min_queue_length then
+         match self#prefetch with
+           | Finished ->
+-              Duppy.Task.add Tutils.scheduler
+-                { Duppy.Task.
+-                    priority = priority ;
+-                    events   = [`Delay 0.] ;
+-                    handler  =  (fun _ -> self#feed_queue (); []) }
++               [{ Duppy.Task.
++                   priority = priority ;
++                   events   = [`Delay 0.] ;
++                   handler  = self#feed_queue reload }]
+           | Retry ->
+               (* Reschedule the task later *)
+-              Duppy.Task.add Tutils.scheduler
+-                { Duppy.Task.
+-                    priority  = priority ;
+-                    events   = [`Delay (adaptative_delay ())] ;
+-                    handler  = (fun _ -> self#feed_queue (); []) }
+-          | Empty -> ()
++              [{ Duppy.Task.
++                   priority  = priority ;
++                   events   = [`Delay (adaptative_delay ())] ;
++                   handler  = self#feed_queue reload }]
++          | Empty -> []
++      else [])
+ 
+   (** Try to feed the queue with a new request.
+     * Return false if there was no new request to try,
+@@ -319,7 +298,7 @@
+             None
+     in
+       Mutex.unlock qlock ;
+-      self#notify_new_request ;
++      self#create_task ;
+       ans
+ 
+   method copy_queue =
+Index: liquidsoap/src/sources/request_source.mli
+===================================================================
+--- liquidsoap.orig/src/sources/request_source.mli     2009-04-02 
11:47:59.000000000 +0200
++++ liquidsoap/src/sources/request_source.mli  2009-06-11 02:15:52.000000000 
+0200
+@@ -44,9 +44,9 @@
+   (** You should only define this. *)
+   method virtual get_next_request : Request.audio Request.t option
+ 
+-  (** This method should be called whenever the feeding task gets
++  (** This method should be called whenever the source gets
+     * a new opportunity to add more data into the queue. *)
+-  method private notify_new_request : unit
++  method private create_task : unit
+ 
+   inherit unqueued
+ 
+Index: liquidsoap/src/sources/req_queue.ml
+===================================================================
+--- liquidsoap.orig/src/sources/req_queue.ml   2009-04-02 11:47:59.000000000 
+0200
++++ liquidsoap/src/sources/req_queue.ml        2009-06-11 02:15:52.000000000 
+0200
+@@ -79,7 +79,7 @@
+         (string_of_int (Queue.length requests)) ;
+       Request.set_root_metadata req "queue" "secondary" ;
+       Mutex.unlock reqlock ;
+-      self#notify_new_request
++      self#create_task
+ 
+   method copy_queue_init q =
+     Mutex.lock reqlock ;
+Index: liquidsoap/src/sources/req_equeue.ml
+===================================================================
+--- liquidsoap.orig/src/sources/req_equeue.ml  2009-04-02 11:47:59.000000000 
+0200
++++ liquidsoap/src/sources/req_equeue.ml       2009-06-11 02:15:52.000000000 
+0200
+@@ -64,7 +64,7 @@
+           f req ;
+           Request.add_log req "Entering the secondary queue." ;
+           Request.set_root_metadata req "queue" "secondary" ;
+-          self#notify_new_request ;
++          self#create_task ;
+           (string_of_int (Request.get_id req))
+       | None -> "Unable to create a request!"
+     in
+Index: liquidsoap/src/sources/playlist.ml
+===================================================================
+--- liquidsoap.orig/src/sources/playlist.ml    2009-04-02 11:47:59.000000000 
+0200
++++ liquidsoap/src/sources/playlist.ml 2009-06-11 02:15:52.000000000 +0200
+@@ -379,7 +379,7 @@
+ 
+   method reload_playlist_internal a b c =
+     pl#reload_playlist_internal a b c ;
+-    super#notify_new_request
++    super#create_task
+ 
+   method wake_up activation =
+     (* The queued request source should be prepared first,
diff --git a/debian/patches/series b/debian/patches/series
index d93d7ac..e8e62e9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 fix_math_h_usage.patch
+fix_append.patch
+fix_req_task.patch

-- 
liquidsoap packaging

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to