Skip to content

Fixed bugs for sprint 1 #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions samples/webrtc/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,25 @@
console.group('onCallStatsReport');
console.log('userId: ', userId);
console.log('session: ', session);
console.log('stats: ', stats);
console.groupEnd();

/**
* Hack for Firefox
* (https://bugzilla.mozilla.org/show_bug.cgi?id=852665)
*/
if(is_firefox) {
var inboundrtp = _.findWhere(stats, {type: 'inboundrtp'});
var inboundrtp = _.findWhere(stats, {'type': 'inboundrtp'});

if(!inboundrtp || !app.helpers.isBytesReceivedChanges(userId, inboundrtp)) {
if(!app.helpers.isBytesReceivedChanges(userId, inboundrtp)) {
console.warn('This is Firefox and user ' + userId + ' has lost his connection.');

if(!_.isEmpty(app.currentSession)) {
/**
* 2 - This is how many stats
* we can get without inboundrtp
* before close connection
*/
if(app.network[userId].count >= 2 && !_.isEmpty(app.currentSession)) {
app.currentSession.closeConnection(userId);
app.helpers.notifyIfUserLeaveCall(session, userId, 'disconnected', 'Disconnected');
}
Expand Down Expand Up @@ -713,7 +719,6 @@
var state = app.currentSession.connectionStateForUser(userId),
peerConnList = QB.webrtc.PeerConnectionState;


if(state === peerConnList.DISCONNECTED || state === peerConnList.FAILED || state === peerConnList.CLOSED) {
return false;
}
Expand Down
10 changes: 6 additions & 4 deletions samples/webrtc/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@

app.helpers.isBytesReceivedChanges = function(userId, inboundrtp) {
var res = true,
inbBytesRec = inboundrtp.bytesReceived;
inbBytesRec = inboundrtp ? inboundrtp.bytesReceived : 0;

if(app.network[userId] === undefined) {
if(app.network[userId] || !inboundrtp) {
app.network[userId] = {
'bytesReceived': inbBytesRec
'bytesReceived': inbBytesRec,
'count': 0
};
} else {
if(app.network[userId].bytesReceived === inbBytesRec) {
res = false;
} else {
app.network[userId] = {
'bytesReceived': inbBytesRec
'bytesReceived': inbBytesRec,
'count': ++app.network[userId].count
};
}
}
Expand Down