Browse Source

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

j8
Philipp Hancke 12 years ago
parent
commit
cc6653dc2f
1 changed files with 38 additions and 1 deletions
  1. 38
    1
      app.js

+ 38
- 1
app.js View File

@@ -130,13 +130,14 @@ $(document).bind('mediafailure.jingle', function () {
130 130
 $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
131 131
     function waitForRemoteVideo(selector, sid) {
132 132
         var sess = connection.jingle.sessions[sid];
133
+        if (data.stream.id == 'mixedmslabel') return;
133 134
         videoTracks = data.stream.getVideoTracks();
134 135
         if (videoTracks.length === 0 || selector[0].currentTime > 0) {
135 136
             RTC.attachMediaStream(selector, data.stream); // FIXME: why do i have to do this for FF?
136 137
             $(document).trigger('callactive.jingle', [selector, sid]);
137 138
             console.log('waitForremotevideo', sess.peerconnection.iceConnectionState, sess.peerconnection.signalingState);
138 139
         } else {
139
-            setTimeout(function () { waitForRemoteVideo(selector, sid); }, 100);
140
+            setTimeout(function () { waitForRemoteVideo(selector, sid); }, 250);
140 141
         }
141 142
     }
142 143
     var sess = connection.jingle.sessions[sid];
@@ -220,8 +221,44 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
220 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 262
 $(document).bind('callincoming.jingle', function (event, sid) {
226 263
     var sess = connection.jingle.sessions[sid];
227 264
     // TODO: check affiliation and/or role

Loading…
Cancel
Save