diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c63def0..04539f1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,7 +26,7 @@ jobs: - name: setup go uses: actions/setup-go@v5 with: - go-version: '1.23' + go-version: '1.24' check-latest: true - name: add ffmpeg7 repo run: sudo add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg7 diff --git a/docker/termux/Dockerfile b/docker/termux/Dockerfile index dff5f5e..476a836 100644 --- a/docker/termux/Dockerfile +++ b/docker/termux/Dockerfile @@ -4,7 +4,7 @@ RUN sudo apt update && sudo apt dist-upgrade -fy && sudo apt clean USER builder WORKDIR /home/builder -RUN git clone -b feat/static_libav https://github.com/xaionaro/termux-packages +RUN git clone https://github.com/xaionaro/termux-packages WORKDIR /home/builder/termux-packages RUN ./scripts/setup-android-sdk.sh diff --git a/go.mod b/go.mod index beecc1b..270ae28 100644 --- a/go.mod +++ b/go.mod @@ -19,12 +19,12 @@ replace github.com/rs/zerolog v1.33.0 => github.com/xaionaro-go/zerolog2belt v0. replace github.com/bluenviron/gortsplib/v4 v4.11.0 => github.com/xaionaro-go/gortsplib/v4 v4.0.0-20241123213409-7279dabb7de6 -replace github.com/asticode/go-astiav v0.33.1 => github.com/xaionaro-go/astiav v0.0.0-20250106205037-a1605f324663 - replace github.com/wlynxg/anet => github.com/BieHDC/anet v0.0.6-0.20241226223613-d47f8b766b3c replace github.com/nicklaw5/helix/v2 v2.30.1-0.20240715193454-0151ccccf980 => github.com/xaionaro-go/helix/v2 v2.0.0-20250309182928-f54c9d4c8a29 +replace github.com/asticode/go-astiav v0.35.0 => github.com/xaionaro-go/astiav v0.0.0-20250317012930-39df462db826 + require ( github.com/facebookincubator/go-belt v0.0.0-20250308011339-62fb7027b11f github.com/go-git/go-billy/v5 v5.5.0 @@ -232,7 +232,7 @@ require ( github.com/andreykaipov/goobs v1.4.1 github.com/anthonynsimon/bild v0.14.0 github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef - github.com/asticode/go-astiav v0.33.1 + github.com/asticode/go-astiav v0.35.0 github.com/bamiaux/rez v0.0.0-20170731184118-29f4463c688b github.com/bluenviron/gortsplib/v4 v4.11.0 github.com/chai2010/webp v1.1.1 diff --git a/go.sum b/go.sum index 8cda627..211916a 100644 --- a/go.sum +++ b/go.sum @@ -1026,8 +1026,8 @@ github.com/volatiletech/sqlboiler/v4 v4.16.2/go.mod h1:B14BPBGTrJ2X6l7lwnvV/iXgY github.com/volatiletech/strmangle v0.0.1/go.mod h1:F6RA6IkB5vq0yTG4GQ0UsbbRcl3ni9P76i+JrTBKFFg= github.com/volatiletech/strmangle v0.0.6 h1:AdOYE3B2ygRDq4rXDij/MMwq6KVK/pWAYxpC7CLrkKQ= github.com/volatiletech/strmangle v0.0.6/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV56vTKXzR3GeR+0= -github.com/xaionaro-go/astiav v0.0.0-20250106205037-a1605f324663 h1:b0lOm2erjkc/D1/BBa1m9F/jV5AEhU6sRzkcqwTUZH8= -github.com/xaionaro-go/astiav v0.0.0-20250106205037-a1605f324663/go.mod h1:K7D8UC6GeQt85FUxk2KVwYxHnotrxuEnp5evkkudc2s= +github.com/xaionaro-go/astiav v0.0.0-20250317012930-39df462db826 h1:oVwbZ1xRjLNXkq5VvRULgca280hRAPuaJOvmVo/rFNU= +github.com/xaionaro-go/astiav v0.0.0-20250317012930-39df462db826/go.mod h1:K7D8UC6GeQt85FUxk2KVwYxHnotrxuEnp5evkkudc2s= github.com/xaionaro-go/audio v0.0.0-20250210102901-abfced9d5ef3 h1:LRIpqqC7Gsz5+/EsIWRtdPZZPMpx9yykUVFyUnRaKbE= github.com/xaionaro-go/audio v0.0.0-20250210102901-abfced9d5ef3/go.mod h1:i4CntPlryh9HLmA3p3M0CNr1usRkEkuh3N2Ui3HeXQA= github.com/xaionaro-go/avpipeline v0.0.0-20250217031756-936d572a90d3 h1:LTRvnANTG31qkDdlQUe5tjqMDgC6hxlPoOgv5dCJTlU= diff --git a/pkg/autoupdater/progress_bar.go b/pkg/autoupdater/progress_bar.go index 1efc460..2107208 100644 --- a/pkg/autoupdater/progress_bar.go +++ b/pkg/autoupdater/progress_bar.go @@ -3,3 +3,9 @@ package autoupdater type ProgressBar interface { SetProgress(progress float64) } + +type DummyProgressBar struct{} + +var _ ProgressBar = (*DummyProgressBar)(nil) + +func (DummyProgressBar) SetProgress(float64) {} diff --git a/pkg/autoupdater/update.go b/pkg/autoupdater/update.go index 5c081ac..3deac2b 100644 --- a/pkg/autoupdater/update.go +++ b/pkg/autoupdater/update.go @@ -19,6 +19,9 @@ func (u *Update) Apply( ctx context.Context, progressBar ProgressBar, ) error { + if progressBar == nil { + progressBar = DummyProgressBar{} + } progressBar.SetProgress(0) logger.Debugf(ctx, "applying the update %#+v", u.Release) diff --git a/pkg/streamcontrol/twitch/chat_handler.go b/pkg/streamcontrol/twitch/chat_handler.go index 81a084b..3e11dd4 100644 --- a/pkg/streamcontrol/twitch/chat_handler.go +++ b/pkg/streamcontrol/twitch/chat_handler.go @@ -3,6 +3,7 @@ package twitch import ( "context" "fmt" + "sync" "github.com/adeithe/go-twitch/irc" "github.com/xaionaro-go/observability" @@ -18,6 +19,7 @@ type ChatClient interface { type ChatHandler struct { client ChatClient cancelFunc context.CancelFunc + waitGroup sync.WaitGroup messagesInChan chan irc.ChatMessage messagesOutChan chan streamcontrol.ChatMessage } @@ -47,7 +49,9 @@ func newChatHandler( messagesOutChan: make(chan streamcontrol.ChatMessage, 100), } + h.waitGroup.Add(1) observability.Go(ctx, func() { + defer h.waitGroup.Done() defer func() { h.client.Close() // h.Client.Close above waits inside for everything to finish, @@ -84,6 +88,7 @@ func (h *ChatHandler) onShardMessage(shard int, msg irc.ChatMessage) { func (h *ChatHandler) Close() error { h.cancelFunc() + h.waitGroup.Wait() return nil } diff --git a/pkg/streamcontrol/twitch/chat_handler_test.go b/pkg/streamcontrol/twitch/chat_handler_test.go index 65759af..a624d57 100644 --- a/pkg/streamcontrol/twitch/chat_handler_test.go +++ b/pkg/streamcontrol/twitch/chat_handler_test.go @@ -54,6 +54,7 @@ func TestChatHandler(t *testing.T) { expectedEvent := streamcontrol.ChatMessage{ UserID: "user-id", + Username: "user-id", MessageID: "message-id", Message: "some\nmulti line\n message", } @@ -64,6 +65,7 @@ func TestChatHandler(t *testing.T) { go func() { defer wg.Done() for ev := range h.messagesOutChan { + ev.CreatedAt = time.Time{} require.Equal(t, expectedEvent, ev) messagesCount++ }