use PeerConnection interface to make it easier to mock

This commit is contained in:
David Zhao
2020-12-20 22:57:06 -08:00
parent 684099d653
commit c4cb29a3bb
10 changed files with 478 additions and 52 deletions
+6 -1
View File
@@ -67,7 +67,12 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
})
signalConn := rtc.NewWSSignalConnection(conn)
participant, err := rtc.NewParticipant(s.manager.Config(), signalConn, pName)
pc, err := rtc.NewPeerConnection(s.manager.Config())
if err != nil {
writeJSONError(w, http.StatusInternalServerError, "could not create peerConnection", err.Error())
return
}
participant, err := rtc.NewParticipant(pc, signalConn, pName)
if err != nil {
writeJSONError(w, http.StatusInternalServerError, "could not create participant", err.Error())
return