|
@ -3,9 +3,6 @@ package webrtc |
|
|
import ( |
|
|
import ( |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/pion/interceptor" |
|
|
|
|
|
"github.com/pion/rtp" |
|
|
|
|
|
"github.com/pion/rtp/codecs" |
|
|
|
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"regexp" |
|
|
"regexp" |
|
@ -14,6 +11,10 @@ import ( |
|
|
"time" |
|
|
"time" |
|
|
"unsafe" |
|
|
"unsafe" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/pion/interceptor" |
|
|
|
|
|
"github.com/pion/rtp" |
|
|
|
|
|
"github.com/pion/rtp/codecs" |
|
|
|
|
|
|
|
|
"github.com/Monibuca/engine/v3" |
|
|
"github.com/Monibuca/engine/v3" |
|
|
"github.com/Monibuca/plugin-webrtc/v3/webrtc" |
|
|
"github.com/Monibuca/plugin-webrtc/v3/webrtc" |
|
|
|
|
|
|
|
@ -329,6 +330,13 @@ func run() { |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
} |
|
|
} |
|
|
|
|
|
if at == nil { |
|
|
|
|
|
engine.TriggerHook(engine.HOOK_REQUEST_TRANSAUDIO, &engine.TransCodeReq{ |
|
|
|
|
|
Subscriber: &sub, |
|
|
|
|
|
RequestCodec: "pcma", |
|
|
|
|
|
}) |
|
|
|
|
|
at = sub.WaitAudioTrack("pcma") |
|
|
|
|
|
} |
|
|
if at != nil { |
|
|
if at != nil { |
|
|
var audioTrack *TrackLocalStaticSample |
|
|
var audioTrack *TrackLocalStaticSample |
|
|
audioMimeType := MimeTypePCMA |
|
|
audioMimeType := MimeTypePCMA |
|
@ -353,7 +361,6 @@ func run() { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if bytes, err := rtc.GetAnswer(); err == nil { |
|
|
if bytes, err := rtc.GetAnswer(); err == nil { |
|
|
w.Write(bytes) |
|
|
w.Write(bytes) |
|
|
rtc.OnConnectionStateChange(func(pcs PeerConnectionState) { |
|
|
rtc.OnConnectionStateChange(func(pcs PeerConnectionState) { |
|
|