Closed Bug 975177 Opened 7 years ago Closed 7 years ago

The WebRTC toolbar icon sometimes stays visible when no device is shared


(Core :: WebRTC: Audio/Video, defect)

Not set





(Reporter: florian, Assigned: florian)



(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
Steps to reproduce:
1. Open 3 tabs.
2. In the first tab, load and grant permissions to use the devices.
3. In the second tab, load but don't touch the permission prompt (keep the request pending).
4. Close the first tab.
5. Close the second tab.

Expected result:
After step 2, the webrtc toolbar icon appears, and it disappears after step 4.

Actual result:
After step 2, the webrtc toolbar icon appears, but it's still around even after step 5.

The underlying cause of the bug is that the code in webrtcUI.jsm assumes that nsIMediaManagerService.activeMediaCaptureWindows contains only the windows where a device is actually shared, but MediaManager returns both the windows where a device is shared, and the windows where a device has been requested.

This can either be fixed in MediaManager (the approach I took for the attached patch) or in webrtcUI.jsm by making the webrtcUI.activeStreams getter call MediaManagerService.mediaCaptureWindowState for each window.

Note: the WindowsHashToArrayFunc function seems to be the only one around this code with 4 space indent; I'm happy to fully reindent it if we keep this approach, but I wanted this attachment to show what I'm actually changing.
Attachment #8379332 - Flags: review?(rjesup)
Comment on attachment 8379332 [details] [diff] [review]

Review of attachment 8379332 [details] [diff] [review]:

::: dom/media/MediaManager.cpp
@@ +1777,4 @@
>      MOZ_ASSERT(window);
>      if (window) {
> +      bool capturing = false;

Add a comment about why we need to do this (and ref bug #)
Attachment #8379332 - Flags: review?(rjesup) → review+
Addressed comment 1, and fixed the indent as discussed on IRC.
Assignee: nobody → florian
Attachment #8379332 - Attachment is obsolete: true
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.