From 667446e06b6d567bb00986e41bb5d03d93dcf8a6 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Wed, 4 Dec 2024 09:14:28 -0600 Subject: [PATCH] Minor bump for now. --- liquidsoap-core.opam | 2 +- liquidsoap-js.opam | 2 +- liquidsoap-lang.opam | 2 +- liquidsoap-libs-extra.opam | 2 +- liquidsoap-libs.opam | 2 +- liquidsoap-mode.opam | 2 +- liquidsoap.opam | 6 ++--- src/core/io/alsa_io.ml | 45 +++++++++++++++++++------------------- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/liquidsoap-core.opam b/liquidsoap-core.opam index af712410b4..cc9e17915f 100644 --- a/liquidsoap-core.opam +++ b/liquidsoap-core.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidsoap core library and binary" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap-js.opam b/liquidsoap-js.opam index 9ad8fe87eb..8df98361a4 100644 --- a/liquidsoap-js.opam +++ b/liquidsoap-js.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidsoap language - javascript wrapper" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap-lang.opam b/liquidsoap-lang.opam index a4042b6824..91b7b8979b 100644 --- a/liquidsoap-lang.opam +++ b/liquidsoap-lang.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidsoap language library" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap-libs-extra.opam b/liquidsoap-libs-extra.opam index dbf8c221bb..4abde234f6 100644 --- a/liquidsoap-libs-extra.opam +++ b/liquidsoap-libs-extra.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidosap standard library -- extra functionalities" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap-libs.opam b/liquidsoap-libs.opam index 2b9470c627..0ab9b54126 100644 --- a/liquidsoap-libs.opam +++ b/liquidsoap-libs.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidosap standard library" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap-mode.opam b/liquidsoap-mode.opam index 9a0d42ad3e..573bf26ca9 100644 --- a/liquidsoap-mode.opam +++ b/liquidsoap-mode.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Liquidosap emacs mode" maintainer: ["The Savonet Team "] authors: ["The Savonet Team "] diff --git a/liquidsoap.opam b/liquidsoap.opam index 050770c6e9..f29c300ca2 100644 --- a/liquidsoap.opam +++ b/liquidsoap.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "2.4.0" +version: "2.3.1" synopsis: "Swiss-army knife for multimedia streaming" description: """ Liquidsoap is a powerful and flexible language for describing your @@ -18,8 +18,8 @@ bug-reports: "https://github.com/savonet/liquidsoap/issues" depends: [ "dune" {>= "3.6"} "liquidsoap-core" {= version} - "liquidsoap-libs" {>= "2.3.0" & < "2.3.1"} - "liquidsoap-libs-extra" {>= "2.3.0" & < "2.3.1"} + "liquidsoap-libs" {>= "2.3.1" & < "2.3.2"} + "liquidsoap-libs-extra" {>= "2.3.1" & < "2.3.2"} "pandoc" {with-doc} "pandoc-include" {with-doc} "odoc" {with-doc} diff --git a/src/core/io/alsa_io.ml b/src/core/io/alsa_io.ml index 2a65b9e057..ffbcc50565 100644 --- a/src/core/io/alsa_io.ml +++ b/src/core/io/alsa_io.ml @@ -193,16 +193,12 @@ class output ~self_sync ~start ~infallible ~register_telnet ~on_stop ~on_start (float alsa_rate /. float samples_per_second) buf 0 len in - try - let r = ref ofs in - while !r < len do - if !r <> 0 then - self#log#info - "Partial write (%d instead of %d)! Selecting another buffer size \ - or device can help." - !r len; - r := !r + write pcm buf !r (len - !r) - done + let rec pcm_write ofs len = + if 0 < len then ( + let written = write pcm buf ofs len in + pcm_write (ofs + written) (len - written)) + in + try write ofs len with e -> begin match e with @@ -220,7 +216,6 @@ class output ~self_sync ~start ~infallible ~register_telnet ~on_stop ~on_start end class input ~self_sync ~start ~on_stop ~on_start ~fallible dev = - let samples_per_frame = AFrame.size () in object (self) inherit base ~self_sync dev [Pcm.Capture] @@ -235,24 +230,30 @@ class input ~self_sync ~start ~on_stop ~on_start ~fallible dev = method abort_track = () method seek_source = (self :> Source.source) method private can_generate_frame = active_source#started + val mutable gen = None + + method generator = + match gen with + | Some g -> g + | None -> + let g = Generator.create self#content_type in + gen <- Some g; + g (* TODO: convert samplerate *) method private generate_frame = let pcm = Option.get pcm in let length = Lazy.force Frame.size in - let frame = Frame.create ~length self#content_type in - let buf = Content.Audio.get_data (Frame.get frame Frame.Fields.audio) in + let gen = self#genetator in try - let r = ref 0 in - while !r < samples_per_frame do - if !r <> 0 then - self#log#info - "Partial read (%d instead of %d)! Selecting another buffer size \ - or device can help." - !r (Audio.length buf); - r := !r + read pcm buf !r (samples_per_frame - !r) + while Generator.length gen < length do + let c = Content.make ~length self#content_type in + let read = + read pcm (Content.Audio.get_data c) 0 (Frame.audio_of_main length) + in + Genetator.put gen Frame.Fields.audio (Content.sub c 0 read) done; - Frame.set_data frame Frame.Fields.audio Content.Audio.lift_data buf + Generator.slice gen length with e -> begin match e with