There are many RenderFrameImpl show and hidden.
(RenderFrameImpl count is not definitely and show/hidden sequence is not definitely)
different RenderFrameImpl use the same WebVideoCaptureImplManager.
when RenderFrameImpl::WasHidden/WasShown was called, it trigger WebVideoCaptureImplManager::SuspendDevices.
the init value of is_suspending_all_ = false.
before device connect, some RenderFrameImpl WasHidden was called.
when device connect and video element created,is_suspending_all_ = true and don't trigger startpreview.
So we should keep the initial state if video element not created and device not connected yet.
Change-Id: I96e85a96ef27d9c4985372bad737f10c26169208
Signed-off-by: xliang.wu <xliang.wu@samsung.com>
DCHECK(render_main_task_runner_->BelongsToCurrentThread());
if (is_suspending_all_ == suspend)
return;
+
+ if (video_devices.empty()) {
+ LOG(ERROR) << "no device yet";
+ return;
+ }
+
is_suspending_all_ = suspend;
for (const MediaStreamDevice& device : video_devices) {
const media::VideoCaptureSessionId id = device.session_id();