Explorar el Código

trigger another keyframe send for audio-only focus. fixes #32

j8
Philipp Hancke hace 12 años
padre
commit
cc6653dc2f
Se han modificado 1 ficheros con 38 adiciones y 1 borrados
  1. 38
    1
      app.js

+ 38
- 1
app.js Ver fichero

130
 $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
130
 $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
131
     function waitForRemoteVideo(selector, sid) {
131
     function waitForRemoteVideo(selector, sid) {
132
         var sess = connection.jingle.sessions[sid];
132
         var sess = connection.jingle.sessions[sid];
133
+        if (data.stream.id == 'mixedmslabel') return;
133
         videoTracks = data.stream.getVideoTracks();
134
         videoTracks = data.stream.getVideoTracks();
134
         if (videoTracks.length === 0 || selector[0].currentTime > 0) {
135
         if (videoTracks.length === 0 || selector[0].currentTime > 0) {
135
             RTC.attachMediaStream(selector, data.stream); // FIXME: why do i have to do this for FF?
136
             RTC.attachMediaStream(selector, data.stream); // FIXME: why do i have to do this for FF?
136
             $(document).trigger('callactive.jingle', [selector, sid]);
137
             $(document).trigger('callactive.jingle', [selector, sid]);
137
             console.log('waitForremotevideo', sess.peerconnection.iceConnectionState, sess.peerconnection.signalingState);
138
             console.log('waitForremotevideo', sess.peerconnection.iceConnectionState, sess.peerconnection.signalingState);
138
         } else {
139
         } else {
139
-            setTimeout(function () { waitForRemoteVideo(selector, sid); }, 100);
140
+            setTimeout(function () { waitForRemoteVideo(selector, sid); }, 250);
140
         }
141
         }
141
     }
142
     }
142
     var sess = connection.jingle.sessions[sid];
143
     var sess = connection.jingle.sessions[sid];
220
             updateLargeVideo($(this).attr('src'), false, 1);
221
             updateLargeVideo($(this).attr('src'), false, 1);
221
         }
222
         }
222
     );
223
     );
224
+    // an attempt to work around https://github.com/jitsi/jitmeet/issues/32
225
+    if (data.peerjid && sess.peerjid == data.peerjid && 
226
+            data.stream.getVideoTracks().length == 0 && 
227
+            connection.jingle.localStream.getVideoTracks().length > 0) {
228
+        window.setTimeout(function() {
229
+            sendKeyframe(sess.peerconnection);
230
+        }, 3000);
231
+    }
223
 });
232
 });
224
 
233
 
234
+// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
235
+function sendKeyframe(pc) {
236
+    console.log('sendkeyframe', pc.iceConnectionState);
237
+    if (pc.iceConnectionState != 'connected') return; // safe...
238
+    pc.setRemoteDescription(
239
+        pc.remoteDescription,
240
+        function () {
241
+            pc.createAnswer(
242
+                function (modifiedAnswer) {
243
+                    pc.setLocalDescription(modifiedAnswer,
244
+                        function () {
245
+                        },
246
+                        function (error) {
247
+                            console.log('triggerKeyframe setLocalDescription failed', error);
248
+                        }
249
+                    );
250
+                },
251
+                function (error) {
252
+                    console.log('triggerKeyframe createAnswer failed', error);
253
+                }
254
+            );
255
+        },
256
+        function (error) {
257
+            console.log('triggerKeyframe setRemoteDescription failed', error);
258
+        }
259
+    );
260
+}
261
+
225
 $(document).bind('callincoming.jingle', function (event, sid) {
262
 $(document).bind('callincoming.jingle', function (event, sid) {
226
     var sess = connection.jingle.sessions[sid];
263
     var sess = connection.jingle.sessions[sid];
227
     // TODO: check affiliation and/or role
264
     // TODO: check affiliation and/or role

Loading…
Cancelar
Guardar