mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 04:45:47 +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() {
|
||||
// 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
|
||||
var videoElement = getVideoElement();
|
||||
|
@ -125,7 +126,7 @@ function onServerMessage(event) {
|
|||
}
|
||||
|
||||
// Incoming JSON signals the beginning of a call
|
||||
if (peer_connection == null)
|
||||
if (!peer_connection)
|
||||
createCall(msg);
|
||||
|
||||
if (msg.sdp != null) {
|
||||
|
@ -141,7 +142,7 @@ function onServerMessage(event) {
|
|||
function onServerClose(event) {
|
||||
resetVideo();
|
||||
|
||||
if (peer_connection != null) {
|
||||
if (peer_connection) {
|
||||
peer_connection.close();
|
||||
peer_connection = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue