fix: restart transcode

This commit is contained in:
langhuihui
2024-11-05 09:48:43 +08:00
parent 4c7cb6fed7
commit 1e61c9ccd7
4 changed files with 26 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/base64"
"fmt"
"google.golang.org/protobuf/types/known/emptypb"
m7s "m7s.live/pro"
"net/url"
"os"
"path"
@@ -135,7 +136,16 @@ func parseCrop(cropString string) (string, error) {
}
func (t *TranscodePlugin) Launch(ctx context.Context, transReq *pb.TransRequest) (response *globalPB.SuccessResponse, err error) {
var publisher *m7s.Publisher
var ok bool
t.Server.Server.Call(func() error {
publisher, ok = t.Server.Streams.Get(transReq.SrcStream)
return nil
})
if !ok {
err = fmt.Errorf("src stream not found")
return
}
response = &globalPB.SuccessResponse{}
defer func() {
if err != nil {
@@ -289,7 +299,7 @@ func (t *TranscodePlugin) Launch(ctx context.Context, transReq *pb.TransRequest)
Codec: transReq.Decodec,
}
t.Transform(transReq.SrcStream, cfg)
t.Transform(publisher, cfg)
return
}