mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 12:55:53 +00:00
sendrecv/js: Fix some null/undefined checks
This commit is contained in:
parent
669d234ebd
commit
9cc57d2dd1
1 changed files with 4 additions and 3 deletions
|
@ -59,7 +59,8 @@ function setError(text) {
|
||||||
|
|
||||||
function resetVideo() {
|
function resetVideo() {
|
||||||
// Release the webcam and mic
|
// Release the webcam and mic
|
||||||
local_stream_promise.then(stream => { stream.stop(); });
|
if (local_stream_promise)
|
||||||
|
local_stream_promise.then(stream => { stream.stop(); });
|
||||||
|
|
||||||
// Reset the video element and stop showing the last received frame
|
// Reset the video element and stop showing the last received frame
|
||||||
var videoElement = getVideoElement();
|
var videoElement = getVideoElement();
|
||||||
|
@ -125,7 +126,7 @@ function onServerMessage(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoming JSON signals the beginning of a call
|
// Incoming JSON signals the beginning of a call
|
||||||
if (peer_connection == null)
|
if (!peer_connection)
|
||||||
createCall(msg);
|
createCall(msg);
|
||||||
|
|
||||||
if (msg.sdp != null) {
|
if (msg.sdp != null) {
|
||||||
|
@ -141,7 +142,7 @@ function onServerMessage(event) {
|
||||||
function onServerClose(event) {
|
function onServerClose(event) {
|
||||||
resetVideo();
|
resetVideo();
|
||||||
|
|
||||||
if (peer_connection != null) {
|
if (peer_connection) {
|
||||||
peer_connection.close();
|
peer_connection.close();
|
||||||
peer_connection = null;
|
peer_connection = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue