Closed Bug 1423515 Opened 7 years ago Closed 7 years ago

Failed to send a devicechange event for permanent permission case (no live stream)

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: mchiang, Assigned: mchiang)

References

Details

Attachments

(1 file, 1 obsolete file)

STRs:

1. Open the 1st tab and go to https://jsfiddle.net/Lqo4paed/ press gUM! and grant permanent permission
2. Open the 2nd tab and go to the same page.
3. Close the 1st tab.
4. Plug in or out an external webcam.

Expected behavior: there should be a devicechange event 
Actual behavior: there is no devicechange event
Assignee: nobody → mchiang
We think the reason we haven't seen this on try is because we've re-used an old MediaManager instance where the devicechange callback setup was already properly done.

An orthogonal but related question is why the MediaManager and/or MediaDevices objects were not GCed after previous tests and whether we can fix that.
Comment on attachment 8934931 [details]
Bug 1423515 - register callback while creating the real backend.

https://reviewboard.mozilla.org/r/205858/#review211424

r+ if my assumption is true and you add that comment. Thanks!

::: dom/media/MediaManager.cpp:2026
(Diff revision 1)
>  {
>    bool fakeDeviceChangeEventOn = mPrefs.mFakeDeviceChangeEventOn;
>    MediaManager::PostTask(NewTaskFrom([fakeDeviceChangeEventOn]() {
>      MediaManager* manager = MediaManager::GetIfExists();
>      MOZ_RELEASE_ASSERT(manager); // Must exist while media thread is alive
> +    manager->GetBackend(0);

I assume this is needed in case persistent permission is given but no gUM() or enumeration() has created the real backend yet.

The r+ only stands if this assumption is true.

Please put in a comment explaining this because without an explanation this call looks erratic.
Attachment #8934931 - Flags: review?(apehrson) → review+
Comment on attachment 8934932 [details]
Bug 1423515 - move test_ondevicechange.html to the beginning place.

https://reviewboard.mozilla.org/r/205860/#review211426

::: dom/media/tests/mochitest/mochitest.ini:27
(Diff revision 1)
> +# MediaManager and/or MediaDevices objects were not GCed after
> +# previous tests, which make this test unable to detect bug 1423515

I'd like the below info to be part of the comment in some form:

> A MediaManager instance is re-used from previous tests, and so it can inherit the setup of "devicechange" callbacks, masking issues such as bug 1423515 that are then only found by running the test on its own.

::: dom/media/tests/mochitest/mochitest.ini:28
(Diff revision 1)
>    !/dom/media/test/bug461281.ogg
>    !/dom/media/test/seek.webm
>    !/dom/media/test/gizmo.mp4
>  
> +# MediaManager and/or MediaDevices objects were not GCed after
> +# previous tests, which make this test unable to detect bug 1423515

s/this test/test_ondevicechange.html/

::: dom/media/tests/mochitest/mochitest.ini:29
(Diff revision 1)
>    !/dom/media/test/seek.webm
>    !/dom/media/test/gizmo.mp4
>  
> +# MediaManager and/or MediaDevices objects were not GCed after
> +# previous tests, which make this test unable to detect bug 1423515
> +# Before we find out a way to clean up backends when they're no longer used,

s/out //

::: dom/media/tests/mochitest/mochitest.ini:31
(Diff revision 1)
> +[test_ondevicechange.html]
> +skip-if = os == 'android'

I think a newline after this would be appropriate to separate it from the others.
Attachment #8934932 - Flags: review?(apehrson) → review+
Comment on attachment 8934931 [details]
Bug 1423515 - register callback while creating the real backend.

https://reviewboard.mozilla.org/r/205858/#review211450

::: dom/media/MediaManager.cpp:2026
(Diff revision 1)
>  {
>    bool fakeDeviceChangeEventOn = mPrefs.mFakeDeviceChangeEventOn;
>    MediaManager::PostTask(NewTaskFrom([fakeDeviceChangeEventOn]() {
>      MediaManager* manager = MediaManager::GetIfExists();
>      MOZ_RELEASE_ASSERT(manager); // Must exist while media thread is alive
> +    manager->GetBackend(0);

Yes, the assumption is correct. Will put a comment here.
It seems we cannot change the test execution order now.
So I filed a new bug 1423790 to clean up the backend which is no longer used and cancel the patch.
Attachment #8934932 - Attachment is obsolete: true
Pushed by mchiang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a8afdf2b8201
register callback while creating the real backend. r=pehrsons
https://hg.mozilla.org/mozilla-central/rev/a8afdf2b8201
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: