Commit bad19576 authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Fix context loss when falling back to the software compositor.

We correctly handled context loss when using GPU compositing, but
if we transition to software compositing from GPU compositing, we
were not correctly starting the frame sink.

It's possible we also hit this case outside of context loss if the
OnReceivedContextProvider() is delayed until after EnableSubmission();
I was able to reproduce this by adding a delay to when the context
came back. So likely this fixes some broken video playback for some
users on the software compositor!

R=liberato

Bug: 1027518
Test: Updated unittest.
Change-Id: I738a1a36f4d850248730cd61b9ae4adcb5c1cd06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2006193
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732692}
parent 2324279d
......@@ -278,6 +278,8 @@ void VideoFrameSubmitter::OnReceivedContextProvider(
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!use_gpu_compositing) {
resource_provider_->Initialize(nullptr, this);
if (frame_sink_id_.is_valid())
StartSubmitting();
return;
}
......
......@@ -642,6 +642,27 @@ TEST_F(VideoFrameSubmitterTest, RecreateCompositorFrameSinkAfterContextLost) {
task_environment_.RunUntilIdle();
}
// Test that after context is lost, the CompositorFrameSink is recreated but the
// SurfaceEmbedder isn't even with software compositing.
TEST_F(VideoFrameSubmitterTest,
RecreateCompositorFrameSinkAfterContextLostSoftwareCompositing) {
MockEmbeddedFrameSinkProvider mock_embedded_frame_sink_provider;
mojo::Receiver<mojom::blink::EmbeddedFrameSinkProvider>
embedded_frame_sink_provider_binding(&mock_embedded_frame_sink_provider);
auto override =
mock_embedded_frame_sink_provider.CreateScopedOverrideMojoInterface(
&embedded_frame_sink_provider_binding);
EXPECT_CALL(*resource_provider_, Initialize(_, _));
EXPECT_CALL(mock_embedded_frame_sink_provider, ConnectToEmbedder(_, _))
.Times(0);
EXPECT_CALL(mock_embedded_frame_sink_provider, CreateCompositorFrameSink_(_))
.Times(1);
submitter_->OnContextLost();
OnReceivedContextProvider(false, nullptr);
task_environment_.RunUntilIdle();
}
// This test simulates a race condition in which the |video_frame_provider_| is
// destroyed before OnReceivedContextProvider returns.
TEST_F(VideoFrameSubmitterTest, StopUsingProviderDuringContextLost) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment