Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into issue-6724
Browse files Browse the repository at this point in the history
  • Loading branch information
vitormateusalmeida committed Apr 24, 2019
2 parents 6291493 + e253884 commit 196e48b
Show file tree
Hide file tree
Showing 16 changed files with 1,124 additions and 49 deletions.
4 changes: 4 additions & 0 deletions bigbluebutton-html5/imports/startup/client/intl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import de from 'react-intl/locale-data/de';
import el from 'react-intl/locale-data/el';
import en from 'react-intl/locale-data/en';
import es from 'react-intl/locale-data/es';
import eu from 'react-intl/locale-data/eu';
import fa from 'react-intl/locale-data/fa';
import fr from 'react-intl/locale-data/fr';
import he from 'react-intl/locale-data/he';
import hi from 'react-intl/locale-data/hi';
import id from 'react-intl/locale-data/id';
import it from 'react-intl/locale-data/it';
import ja from 'react-intl/locale-data/ja';
Expand All @@ -35,9 +37,11 @@ addLocaleData([
...el,
...en,
...es,
...eu,
...fa,
...fr,
...he,
...hi,
...id,
...it,
...ja,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class VideoProvider extends Component {
}

onWsClose() {
this.logger('debug', '------ Websocket connection closed.', { topic: 'ws' });
this.logger('debug', '------ Websocket connection closed.', 'video_provider_onwsclose', { topic: 'ws' });

clearInterval(this.pingInterval);

Expand All @@ -249,7 +249,7 @@ class VideoProvider extends Component {
}

onWsOpen() {
this.logger('debug', '------ Websocket connection opened.', { topic: 'ws' });
this.logger('debug', '------ Websocket connection opened.', 'video_provider_onwsopen', { topic: 'ws' });

// -- Resend queued messages that happened when socket was not connected
while (this.wsQueue.length > 0) {
Expand Down Expand Up @@ -289,11 +289,12 @@ class VideoProvider extends Component {
}
}

logger(type, message, options = {}) {
logger(type, message, logCode, options = {}) {
const { userId, userName } = this.props;
const topic = options.topic || 'video';

logger[type](`${JSON.stringify(Object.assign(options, { userId, userName, topic }))}, [${topic}] ${message}`);
logger[type](`${JSON.stringify(Object.assign(options, {
userId, userName, topic, logCode,
}))}, [${topic}] ${message}`);
}

_sendPauseStream(id, role, state) {
Expand All @@ -308,7 +309,7 @@ class VideoProvider extends Component {

pauseViewers() {
const { userId } = this.props;
this.logger('debug', 'Calling pause in viewer streams');
this.logger('debug', 'Calling pause in viewer streams', 'video_provider_pause_viewers');

Object.keys(this.webRtcPeers).forEach((id) => {
if (userId !== id && this.webRtcPeers[id].started) {
Expand All @@ -319,7 +320,7 @@ class VideoProvider extends Component {

unpauseViewers() {
const { userId } = this.props;
this.logger('debug', 'Calling un-pause in viewer streams');
this.logger('debug', 'Calling un-pause in viewer streams', 'video_provider_unpause_viewers');

Object.keys(this.webRtcPeers).forEach((id) => {
if (id !== userId && this.webRtcPeers[id].started) {
Expand All @@ -342,7 +343,7 @@ class VideoProvider extends Component {
const jsonMessage = JSON.stringify(message);
ws.send(jsonMessage, (error) => {
if (error) {
this.logger(`client: Websocket error '${error}' on message '${message.id}'`, { topic: 'ws' });
this.logger('error', `client: Websocket error '${error}' on message '${message.id}'`, 'video_provider_ws_error', { topic: 'ws' });
}
});
} else if (message.id !== 'stop') {
Expand All @@ -359,33 +360,34 @@ class VideoProvider extends Component {
const id = message.cameraId;
const peer = this.webRtcPeers[id];

this.logger('debug', 'SDP answer received from server. Processing ...', { cameraId: id, sdpAnswer: message.sdpAnswer });
this.logger('debug', 'SDP answer received from server. Processing ...', 'video_provider_sdp_received',
{ cameraId: id, sdpAnswer: message.sdpAnswer });

if (peer) {
peer.processAnswer(message.sdpAnswer, (error) => {
if (error) {
return this.logger('debug', JSON.stringify(error), { cameraId: id });
return this.logger('debug', JSON.stringify(error), 'video_provider_peer_process_answer', { cameraId: id });
}

peer.didSDPAnswered = true;
this._processIceQueue(peer, id);
return true;
});
} else {
this.logger('warn', '[startResponse] Message arrived after the peer was already thrown out, discarding it...');
this.logger('warn', '[startResponse] Message arrived after the peer was already thrown out, discarding it...', 'video_provider_no_peer');
}
}

handleIceCandidate(message) {
const webRtcPeer = this.webRtcPeers[message.cameraId];

this.logger('debug', 'Received remote ice candidate', { topic: 'ice', candidate: message.candidate });
this.logger('debug', 'Received remote ice candidate', 'video_provider_ice_candidate_received', { topic: 'ice', candidate: message.candidate });

if (webRtcPeer) {
if (webRtcPeer.didSDPAnswered) {
webRtcPeer.addIceCandidate(message.candidate, (err) => {
if (err) {
return this.logger('error', `Error adding candidate: ${err}`, { cameraId: message.cameraId });
return this.logger('error', `Error adding candidate: ${err}`, 'video_provider_ice_candidate_cant_add', { cameraId: message.cameraId });
}
return true;
});
Expand All @@ -396,12 +398,12 @@ class VideoProvider extends Component {
webRtcPeer.iceQueue.push(message.candidate);
}
} else {
this.logger('warn', ' [iceCandidate] Message arrived after the peer was already thrown out, discarding it...', { cameraId: message.cameraId });
this.logger('warn', ' [iceCandidate] Message arrived after the peer was already thrown out, discarding it...', 'video_provider_ice_candidate_arrived_late', { cameraId: message.cameraId });
}
}

stopWebRTCPeer(id, restarting = false) {
this.logger('info', 'Stopping webcam', { cameraId: id });
this.logger('info', 'Stopping webcam', 'video_provider_stopping_webcam', { cameraId: id });
const { userId } = this.props;
const shareWebcam = id === userId;

Expand Down Expand Up @@ -439,13 +441,13 @@ class VideoProvider extends Component {
destroyWebRTCPeer(id) {
const webRtcPeer = this.webRtcPeers[id];
if (webRtcPeer) {
this.logger('info', 'Stopping WebRTC peer', { cameraId: id });
this.logger('info', 'Stopping WebRTC peer', 'video_provider_destroy_webrtc_peers', { cameraId: id });
if (typeof webRtcPeer.dispose === 'function') {
webRtcPeer.dispose();
}
delete this.webRtcPeers[id];
} else {
this.logger('warn', 'No WebRTC peer to stop (not an error)', { cameraId: id });
this.logger('warn', 'No WebRTC peer to stop (not an error)', 'video_provider_no_peer_to_destroy', { cameraId: id });
}
}

Expand All @@ -463,7 +465,7 @@ class VideoProvider extends Component {
try {
iceServers = await fetchWebRTCMappedStunTurnServers(sessionToken);
} catch (error) {
this.logger('error', 'Video provider failed to fetch ice servers, using default');
this.logger('error', 'Video provider failed to fetch ice servers, using default', 'video_provider_missing_ice_servers');
} finally {
if (Session.get('WebcamDeviceId')) {
VIDEO_CONSTRAINTS.deviceId = { exact: Session.get('WebcamDeviceId') };
Expand Down Expand Up @@ -508,7 +510,7 @@ class VideoProvider extends Component {
return this._webRTCOnError(errorGenOffer, id, shareWebcam);
}

this.logger('debug', `Invoking SDP offer callback function ${window.location.host}`, { cameraId: id, offerSdp });
this.logger('debug', `Invoking SDP offer callback function ${window.location.host}`, 'video_provider_sdp_offer_callback', { cameraId: id, offerSdp });

const message = {
type: 'video',
Expand Down Expand Up @@ -536,7 +538,7 @@ class VideoProvider extends Component {
const { intl, userId } = this.props;

return () => {
this.logger('error', `Camera share has not succeeded in ${CAMERA_SHARE_FAILED_WAIT_TIME}`, { cameraId: id });
this.logger('error', `Camera share has not succeeded in ${CAMERA_SHARE_FAILED_WAIT_TIME}`, 'video_provider_cam_timeout', { cameraId: id });

if (userId === id) {
VideoProvider.notifyError(intl.formatMessage(intlClientErrors.mediaFlowTimeout));
Expand All @@ -552,7 +554,7 @@ class VideoProvider extends Component {
this.restartTimer[id] = Math
.min(2 * this.restartTimer[id], MAX_CAMERA_SHARE_FAILED_WAIT_TIME);

this.logger('info', `Reconnecting peer ${id} with timer`, this.restartTimer);
this.logger('info', `Reconnecting peer ${id} with timer`, 'video_provider_reconnecting_peer', this.restartTimer);
}
};
}
Expand All @@ -565,7 +567,7 @@ class VideoProvider extends Component {
peer.addIceCandidate(candidate, (err) => {
if (err) {
VideoProvider.notifyError(intl.formatMessage(intlClientErrors.iceCandidateError));
return this.logger('error', `Error adding candidate: ${err}`, { cameraId });
return this.logger('error', `Error adding candidate: ${err}`, 'video_provider_cant_add_candidate', { cameraId });
}
return true;
});
Expand All @@ -583,13 +585,13 @@ class VideoProvider extends Component {
return;
}

this.logger('error', ' WebRTC peerObj create error', id);
this.logger('error', ' WebRTC peerObj create error', 'video_provider_webrtc_error_before', { id, error });
const errorMessage = intlClientErrors[error.name]
|| intlSFUErrors[error] || intlClientErrors.permissionError;
VideoProvider.notifyError(intl.formatMessage(errorMessage));
this.stopWebRTCPeer(id);

this.logger('error', errorMessage, { cameraId: id });
this.logger('error', errorMessage, 'video_provider_webrtc_error_after', { cameraId: id, errorMessage });
}

_getOnIceCandidateCallback(id, shareWebcam) {
Expand All @@ -600,13 +602,12 @@ class VideoProvider extends Component {
if (!this.restartTimeout[id]) {
this.restartTimer[id] = this.restartTimer[id] || CAMERA_SHARE_FAILED_WAIT_TIME;

this.logger('debug', `Setting a camera connection restart in ${this.restartTimer[id]}`, { cameraId: id });
this.restartTimeout[id] = setTimeout(
this._getWebRTCStartTimeout(id, shareWebcam, peer), this.restartTimer[id],
);
this.logger('debug', `Setting a camera connection restart in ${this.restartTimer[id]}`, 'video_provider_cam_restart', { cameraId: id });
this.restartTimeout[id] = setTimeout(this._getWebRTCStartTimeout(id, shareWebcam, peer),
this.restartTimer[id]);
}

this.logger('debug', 'Generated local ice candidate', { topic: 'ice', candidate });
this.logger('debug', 'Generated local ice candidate', 'video_provider_generated_local_ice', { topic: 'ice', candidate });

const message = {
type: 'video',
Expand All @@ -629,7 +630,8 @@ class VideoProvider extends Component {
// prevent the same error from being detected multiple times
peer.peerConnection.oniceconnectionstatechange = null;

this.logger('error', `ICE connection state id:${id}, connectionState:${connectionState}`);
this.logger('error', `ICE connection state id:${id}, connectionState:${connectionState}`, 'video_provider_ice_connection_failed_state');

this.stopWebRTCPeer(id);
VideoProvider.notifyError(intl.formatMessage(intlClientErrors.iceConnectionStateError));
}
Expand All @@ -640,7 +642,7 @@ class VideoProvider extends Component {
const { userId } = this.props;
const video = this.videoTags[id];
if (video == null) {
this.logger('warn', 'Peer', id, 'has not been started yet');
this.logger('warn', `Peer ${id} ${userId} has not been started yet`, 'video_provider_attach_video_stream');
return;
}

Expand Down Expand Up @@ -809,14 +811,14 @@ class VideoProvider extends Component {

callback(result);
}, (exception) => {
this.logger('error', `customGetStats() Promise rejected: ${exception.message}`);
this.logger('error', `customGetStats() Promise rejected: ${exception.message}`, 'video_provider_get_stats_exception');
callback(null);
});
}

monitorTrackStart(peer, track, local, callback) {
const that = this;
this.logger('info', 'Starting stats monitoring on', { cameraId: track.id });
this.logger('info', 'Starting stats monitoring on', 'video_provider_monitor_track_start', { cameraId: track.id });
const getStatsInterval = 2000;

const callGetStats = () => {
Expand All @@ -841,17 +843,17 @@ class VideoProvider extends Component {
getStatsInterval,
);
} else {
this.logger('info', 'Already monitoring this track');
this.logger('info', 'Already monitoring this track', 'video_provider_already_monitoring_track');
}
}

monitorTrackStop(trackId) {
if (this.monitoredTracks[trackId]) {
clearInterval(this.monitoredTracks[trackId]);
delete this.monitoredTracks[trackId];
this.logger('info', `Track ${trackId} removed`);
this.logger('debug', `Track ${trackId} removed`, 'video_provider_stop_monitoring');
} else {
this.logger('info', `Track ${trackId} is not monitored`);
this.logger('debug', `Track ${trackId} is not monitored`, 'video_provider_already_stopped_monitoring');
}
}

Expand All @@ -873,7 +875,7 @@ class VideoProvider extends Component {
handlePlayStop(message) {
const { cameraId } = message;

this.logger('info', 'Handle play stop for camera', { cameraId });
this.logger('info', 'Handle play stop for camera', 'video_provider_handle_play_stop', { cameraId });
this.stopWebRTCPeer(cameraId);
}

Expand All @@ -883,7 +885,7 @@ class VideoProvider extends Component {

if (peer) {
const { userId } = this.props;
this.logger('info', 'Handle play start for camera', { cameraId: id });
this.logger('info', 'Handle play start for camera', 'video_provider_handle_play_start', { cameraId: id });

// Clear camera shared timeout when camera succesfully starts
clearTimeout(this.restartTimeout[id]);
Expand All @@ -901,15 +903,17 @@ class VideoProvider extends Component {
VideoService.joinedVideo();
}
} else {
this.logger('warn', '[playStart] Message arrived after the peer was already thrown out, discarding it...');
this.logger('warn', '[playStart] Message arrived after the peer was already thrown out, discarding it...', 'video_provider_play_start_discarding');
}
}

handleSFUError(message) {
const { intl } = this.props;
const { userId } = this.props;
const { code, reason } = message;
this.logger('debug', 'Received error from SFU:', code, reason, message.streamId, userId);
this.logger('error', 'Received error from SFU:', 'video_provider_sfu_error', {
code, reason, streamId: message.streamId, userId,
});
if (message.streamId === userId) {
this.unshareWebcam();
VideoProvider.notifyError(intl.formatMessage(intlSFUErrors[code]
Expand All @@ -918,20 +922,20 @@ class VideoProvider extends Component {
this.stopWebRTCPeer(message.cameraId);
}

this.logger('error', `Handle error ---------------------> ${message.message}`);
this.logger('error', `Handle error ---------------------> ${message.message}`, 'video_provider_handle_sfu_error', { message });
}

shareWebcam() {
if (this.connectedToMediaServer()) {
this.logger('info', 'Sharing webcam');
this.logger('info', 'Sharing webcam', 'video_provider_share_webcam');
this.sharedWebcam = true;
VideoService.joiningVideo();
}
}

unshareWebcam() {
const { userId } = this.props;
this.logger('info', 'Unsharing webcam');
this.logger('info', 'Unsharing webcam', 'video_provider_unshare_webcam');

VideoService.sendUserUnshareWebcam(userId);
VideoService.exitedVideo();
Expand Down
1 change: 1 addition & 0 deletions bigbluebutton-html5/private/locales/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"app.userList.menu.demoteUser.label": "Degradovat na posluchače",
"app.userList.menu.unlockUser.label": "Odemknout {0}",
"app.userList.menu.lockUser.label": "Uzamknout {0}",
"app.userList.menu.makePresenter.label": "Učinit přednášejícím",
"app.userList.userOptions.manageUsersLabel": "Spravovat uživatele",
"app.userList.userOptions.muteAllLabel": "Ztlumit všechny uživatele",
"app.userList.userOptions.muteAllDesc": "Ztlumit všechny uživatele na setkání",
Expand Down
Loading

0 comments on commit 196e48b

Please sign in to comment.