Compare commits

...

1 Commits

Author SHA1 Message Date
banshan
f89c279388 fix: onvif pull stream 2025-01-15 15:44:51 +08:00
2 changed files with 3 additions and 11 deletions

View File

@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"m7s.live/v5/pkg/util"
"net/http"
"strconv"
@@ -165,7 +164,7 @@ func (o *OnvifPlugin) closeStream(resp *Response, w http.ResponseWriter, r *http
}
devParam, _ := parseDeviceParam(r)
streamPath := GenStreamPath(d.Device, util.ConvertRuneToEn(devParam.IFace))
streamPath := GenStreamPath(d.Device, devParam.IFace)
stream, _ := o.Server.Streams.Get(streamPath)
if stream == nil {

View File

@@ -86,7 +86,7 @@ var authCfg = &AuthConfig{
func GenStreamPath(device *donvif.Device, ifname string) string {
streamPath := strings.ReplaceAll(device.GetDeviceParams().Xaddr, ".", "_")
streamPath = "onvif/" + ifname + "/" + strings.ReplaceAll(streamPath, ":", "_")
streamPath = "onvif/" + util.ConvertRuneToEn(ifname) + "/" + strings.ReplaceAll(streamPath, ":", "_")
return streamPath
}
func NewDeviceStatus(ip, user, passwd, port, path string, channel int) (*DeviceStatus, int, error) {
@@ -359,15 +359,8 @@ func (d *DeviceStatus) GotoPtzPreset(presetToken string, speed *onvifTypes.PTZSp
}
func (d *DeviceStatus) PullStream(ifname string, channel int) error {
// // 从 engine 获取 RTSP 插件实例
rtspPlugin, ok := deviceList.plugin.Server.Plugins.Get("rtsp")
if !ok || rtspPlugin == nil {
d.Status = StatusPullRtspError
return fmt.Errorf("RTSP plugin not found")
}
// 生成流路径
streamPath := GenStreamPath(d.Device, util.ConvertRuneToEn(ifname))
streamPath := GenStreamPath(d.Device, ifname)
var rtspUrl string
var err error
if d.MediaUrl != "" {