diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 15:48:26 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 15:48:26 +0000 |
commit | 0d0750d893dfeb6deb56cf2b4c128b5fdfc6ff7c (patch) | |
tree | bcda9b46dad6c5bdb5da7ccef656e87ec0afbb6e /content | |
parent | 9702820616f52aff8d22dc15e6f25cb86dcc90b2 (diff) | |
download | chromium_src-0d0750d893dfeb6deb56cf2b4c128b5fdfc6ff7c.zip chromium_src-0d0750d893dfeb6deb56cf2b4c128b5fdfc6ff7c.tar.gz chromium_src-0d0750d893dfeb6deb56cf2b4c128b5fdfc6ff7c.tar.bz2 |
Do not set the cache to valid when the device list is empty.
In some cases, for example when the machine just wakes up from sleeping, the camera might not be ready for enumeration. This will fool Chrome that there is no device attaching to the machine, and fail all the getUserMedia call.
This patch fixes the problem by not setting the cache to be valid when the list is empty.
BUG=317673
TEST=using pixel, open the camera using, apprtc.appspot.com, put down the lip, wait until the machine gets to sleep, then wake up and use apprtc.appspot.com. The camera should work, at least after refreshing.
R=perkj@chromium.org
Review URL: https://codereview.chromium.org/59813003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/media/media_stream_manager.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index c3d1da9..5d75ac4 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc @@ -927,9 +927,17 @@ void MediaStreamManager::DevicesEnumerated( !std::equal(devices.begin(), devices.end(), cache->devices.begin(), StreamDeviceInfo::IsEqual)) { StopRemovedDevices(cache->devices, devices); - cache->valid = true; cache->devices = devices; need_update_clients = true; + + // The device might not be able to be enumerated when it is not warmed up, + // for example, when the machine just wakes up from sleep. We set the cache + // to be invalid so that the next media request will trigger the + // enumeration again. See issue/317673. + if (devices.size()) + cache->valid = true; + else + cache->valid = false; } if (need_update_clients && monitoring_started_) |