add: debian file, perform various fixes

This commit is contained in:
Charles
2024-01-15 22:44:05 -08:00
parent ccafa34f33
commit 195cd67c90
17 changed files with 432 additions and 204 deletions
+24 -13
View File
@@ -38,15 +38,16 @@ class CallState extends State<Call> {
logger.i("Init remote renderer");
await _remoteRenderer.initialize();
logger.i("Creating session");
await _createSesson();
await _createSession();
}
_createSesson() async {
_createSession() async {
var callOptions = CallOptions(metadata: {
'Authorization': await widget.sessionService.getAuthToken(widget.home)
});
var cancelCreate = Completer();
var sendIceCandidates = Completer();
var clientSession = await widget.client.createSession(
pb.CreateSessionRequest(
@@ -73,6 +74,8 @@ class CallState extends State<Call> {
};
peerConnection.onIceCandidate = (candidate) async {
await sendIceCandidates.future;
logger.i("Sending ICE candidate");
if (candidate.candidate == null) {
await widget.client.createIceMessage(
CreateIceMessageRequest(
@@ -99,16 +102,15 @@ class CallState extends State<Call> {
};
peerConnection.onIceConnectionState = (state) {
statusLine = "Ice state now $state";
statusLine = "$state";
setState(() {});
logger.i("Ice state now $state");
switch (state) {
case RTCIceConnectionState.RTCIceConnectionStateClosed:
case RTCIceConnectionState.RTCIceConnectionStateDisconnected:
//case RTCIceConnectionState.RTCIceConnectionStateClosed:
//case RTCIceConnectionState.RTCIceConnectionStateDisconnected:
case RTCIceConnectionState.RTCIceConnectionStateFailed:
cancelCreate.complete(CallCancelled());
_connect();
//_connect();
default:
// do nothing
}
@@ -136,7 +138,6 @@ class CallState extends State<Call> {
var offer = await peerConnection.createOffer();
await peerConnection.setLocalDescription(offer);
// Send offer through signaling server
logger.i("Offer is $offer");
await widget.client.createIceMessage(
pb.CreateIceMessageRequest(
sessionIdentifier: clientSession.id,
@@ -149,6 +150,20 @@ class CallState extends State<Call> {
),
options: callOptions);
// Expect back a response
var someResponse = await Future.any([
widget.client.popIceMessage(
pb.PopIceMessageRequest(sessionIdentifier: clientSession.id),
options: callOptions),
cancelCreate.future,
]);
var resp = someResponse as pb.IceMessage;
var session = resp.session;
await peerConnection
.setRemoteDescription(RTCSessionDescription(session.sdp, "answer"));
sendIceCandidates.complete();
// Get candidates from remote
while (true) {
var someResponse = await Future.any([
@@ -168,10 +183,6 @@ class CallState extends State<Call> {
resp.candidate.sdpLineIndex));
} else if (resp.hasNoMoreCandidates()) {
logger.i("No more candidates from remote");
} else if (resp.hasSession()) {
var session = resp.session;
await peerConnection
.setRemoteDescription(RTCSessionDescription(session.sdp, "answer"));
break;
}
}
@@ -183,7 +194,7 @@ class CallState extends State<Call> {
Text(widget.cameraID.id),
Text(statusLine),
SizedBox(
height: 480,
height: 320,
child: _ready
? RTCVideoView(_remoteRenderer)
: const Text("Loading...")),