-
Notifications
You must be signed in to change notification settings - Fork 38
Description
I start an cuttlefish flow the doc, below
./scripts/docker/run.sh
CVDR_USER_CONFIG_PATH=scripts/docker/cvdr.toml ./cvdr create --local_cvd_host_pkg_src=/data/lsl/android14-qpr1-release/out/dist/cvd-host_package.tar.gz --local_images_zip_src=/data/lsl/android14-qpr1-release/out/dist/aosp_cf_x86_64_phone-img-eng.sun.zip --auto_connect=false
I want to open the http://xxx.xxx.xxx.xxx:8080/v1/zones/local/hosts/0b765db27cfcaebdb3d939a5adf6b00005e7158ca493bb92477a762bf3ea9432/ in an other computer. But, the webrtc can not connect correct. Because the android cuttlefish run in the docker with bridge network. So, the webrtc sould connect though a turn server.
I modify the golang source code and config file like behand, it will work ok
https://github.com/google/cloud-android-orchestration/blob/main/scripts/docker/conf.toml
[WebRTC]
STUNServers = ["stun:10.10.13.101:3478"]
UseTurnServers = true
[WebRTC.TURNServers]
URLs = ["turn:10.10.13.101:3478"]
Username = "vtv"
Credential = "123456"
https://github.com/google/cloud-android-orchestration/blob/main/pkg/app/config/config.go
type WebRTCConfig struct {
STUNServers []string
UseTurnServers bool
TURNServers *WebRTCTurnServersConfig
}
type WebRTCTurnServersConfig struct {
URLs []string
Username string
Credential interface{}
}
https://github.com/google/cloud-android-orchestration/blob/main/pkg/app/app.go
func NewApp(
im instances.Manager,
am accounts.Manager,
oc *appOAuth2.Helper,
es encryption.Service,
dbs database.Service,
webStaticFilesPath string,
corsAllowedOrigins []string,
webRTCConfig config.WebRTCConfig,
config *config.Config) *App {
return &App{im, am, oc, es, dbs, webStaticFilesPath, corsAllowedOrigins, buildInfraCfg(webRTCConfig), config}
}
func buildInfraCfg(buildInfraCfg config.WebRTCConfig) apiv1.InfraConfig {
stunServers := buildInfraCfg.STUNServers
iceServers := []apiv1.IceServer{}
for _, server := range stunServers {
iceServers = append(iceServers, apiv1.IceServer{URLs: []string{server}})
}
if buildInfraCfg.UseTurnServers {
iceServers = append(iceServers,
apiv1.IceServer{URLs: buildInfraCfg.TURNServers.URLs,
Username: buildInfraCfg.TURNServers.Username,
Credential: buildInfraCfg.TURNServers.Credential})
}
return apiv1.InfraConfig{
IceServers: iceServers,
}
}
https://github.com/google/cloud-android-orchestration/blob/main/api/v1/signalingserver.go
type IceServer struct {
URLs []string `json:"urls"`
Username string `json:"username,omitempty"`
Credential interface{} `json:"credential,omitempty"`
}
and android-cuttlefish is also need modify the iceserver is same as in the config
https://github.com/google/android-cuttlefish/blob/main/frontend/src/liboperator/api/v1/messages.go
type IceServer struct {
URLs []string `json:"urls"`
Username string `json:"username,omitempty"`
Credential interface{} `json:"credential,omitempty"`
}
https://github.com/google/android-cuttlefish/blob/main/frontend/src/operator/main.go
config := apiv1.InfraConfig{
Type: "config",
IceServers: []apiv1.IceServer{
{URLs: []string{"stun:xxx:3478"}},
{URLs: []string{"turn:xxx:3478"}, Username: "xxx", Credential: "xxx"},
},
}