Skip to content

Commit

Permalink
Bump to new pionv4 based client
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Dec 19, 2024
1 parent 81a9db5 commit 6300618
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 211 deletions.
15 changes: 10 additions & 5 deletions cmd/transcriber/call/tracks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package call
import (
"errors"
"fmt"
"github.com/mattermost/mattermost-plugin-calls/server/public"
"io"
"log/slog"
"math"
"os"
"path/filepath"
"time"

"github.com/mattermost/mattermost-plugin-calls/server/public"

"github.com/mattermost/calls-transcriber/cmd/transcriber/apis/azure"
"github.com/mattermost/calls-transcriber/cmd/transcriber/apis/whisper.cpp"
"github.com/mattermost/calls-transcriber/cmd/transcriber/config"
Expand All @@ -23,7 +24,7 @@ import (

"github.com/streamer45/silero-vad-go/speech"

"github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v4"
)

const (
Expand Down Expand Up @@ -53,8 +54,13 @@ type trackContext struct {
// handleTrack gets called whenever a new WebRTC track is received (e.g. someone unmuted
// for the first time). As soon as this happens we start processing the track.
func (t *Transcriber) handleTrack(ctx any) error {
track, ok := ctx.(*webrtc.TrackRemote)
if !ok {
m, ok := ctx.(map[string]any)
if !ok || m == nil {
return fmt.Errorf("failed to convert map")
}

track, ok := m["track"].(*webrtc.TrackRemote)
if !ok || track == nil {
return fmt.Errorf("failed to convert track")
}

Expand Down Expand Up @@ -244,7 +250,6 @@ func (t *Transcriber) processLiveTrack(track trackRemote, sessionID string) {
}
}
}

}

// handleClose will kick off post-processing of saved voice tracks.
Expand Down
2 changes: 1 addition & 1 deletion cmd/transcriber/call/transcriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (t *Transcriber) Start(ctx context.Context) error {

var startOnce sync.Once
startedCh := make(chan struct{})
t.client.On(client.WSCallRecordingState, func(ctx any) error {
t.client.On(client.WSCallJobStateEvent, func(ctx any) error {
if recState, ok := ctx.(client.CallJobState); ok && recState.StartAt > 0 {
slog.Debug("received call recording state", slog.Any("jobState", recState))

Expand Down
2 changes: 1 addition & 1 deletion cmd/transcriber/opus/opus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/pion/webrtc/v3/pkg/media/oggreader"
"github.com/pion/webrtc/v4/pkg/media/oggreader"
"github.com/stretchr/testify/require"
)

Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ require (
github.com/Microsoft/cognitive-services-speech-sdk-go v1.33.0
github.com/mattermost/mattermost-plugin-calls/server/public v0.0.0-20240308191258-3efb429339df
github.com/mattermost/mattermost/server/public v0.0.12
github.com/mattermost/rtcd v0.14.0
github.com/pion/interceptor v0.1.25
github.com/mattermost/rtcd v0.18.1-0.20241219235235-f558e9c621d4
github.com/pion/interceptor v0.1.37
github.com/pion/randutil v0.1.0
github.com/pion/rtp v1.8.3
github.com/pion/webrtc/v3 v3.2.21
github.com/pion/rtp v1.8.9
github.com/pion/webrtc/v4 v4.0.6
github.com/streamer45/silero-vad-go v0.2.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.10.0
)

require (
Expand All @@ -21,39 +21,39 @@ require (
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect
github.com/mattermost/ldap v0.0.0-20231116144001-0f480c025956 // indirect
github.com/mattermost/logr/v2 v2.0.21 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pion/datachannel v1.5.5 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/ice/v2 v2.3.11 // indirect
github.com/pion/datachannel v1.5.10 // indirect
github.com/pion/dtls/v3 v3.0.4 // indirect
github.com/pion/ice/v4 v4.0.3 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/mdns v0.0.9 // indirect
github.com/pion/rtcp v1.2.12 // indirect
github.com/pion/sctp v1.8.9 // indirect
github.com/pion/sdp/v3 v3.0.6 // indirect
github.com/pion/srtp/v2 v2.0.18 // indirect
github.com/pion/stun v0.6.1 // indirect
github.com/pion/transport/v2 v2.2.4 // indirect
github.com/pion/turn/v2 v2.1.4 // indirect
github.com/pion/mdns/v2 v2.0.7 // indirect
github.com/pion/rtcp v1.2.15 // indirect
github.com/pion/sctp v1.8.35 // indirect
github.com/pion/sdp/v3 v3.0.9 // indirect
github.com/pion/srtp/v3 v3.0.4 // indirect
github.com/pion/stun/v3 v3.0.0 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pion/turn/v4 v4.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tinylib/msgp v1.1.9 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/wiggin77/merror v1.0.5 // indirect
github.com/wiggin77/srslog v1.0.1 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 6300618

Please sign in to comment.