Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: media/renderers/renderer_impl_unittest.cc

Issue 2558213002: Fix crash in renderer initialization when media pipeline is stopped (Closed)
Patch Set: Added a comment for DemuxerStreamProvider::GetStream Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/renderer_impl_unittest.cc
diff --git a/media/renderers/renderer_impl_unittest.cc b/media/renderers/renderer_impl_unittest.cc
index 1e3e70696a280bd0f42e259df4280908736aafbc..9f9fbad2b4d95d72479dc17c074da7689804114f 100644
--- a/media/renderers/renderer_impl_unittest.cc
+++ b/media/renderers/renderer_impl_unittest.cc
@@ -150,12 +150,34 @@ class RendererImplTest : public ::testing::Test {
void InitializeWithAudio() {
CreateAudioStream();
SetAudioRendererInitializeExpectations(PIPELINE_OK);
+ // There is a potential race between HTMLMediaElement/WMPI shutdown and
+ // renderers being initialized which might result in DemuxerStreamProvider
+ // GetStream suddenly returning NULL (see crbug.com/668604). So we are going
+ // to check here that GetStream will be invoked exactly 3 times during
+ // RendererImpl initialization to help catch potential issues. Currently the
+ // GetStream is invoked once directly from RendererImpl::Initialize, once
+ // indirectly from RendererImpl::Initialize via HasEncryptedStream and once
+ // from RendererImpl::InitializeAudioRenderer.
+ EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::AUDIO))
+ .Times(2)
+ .WillRepeatedly(Return(audio_stream_.get()));
InitializeAndExpect(PIPELINE_OK);
}
void InitializeWithVideo() {
CreateVideoStream();
SetVideoRendererInitializeExpectations(PIPELINE_OK);
+ // There is a potential race between HTMLMediaElement/WMPI shutdown and
+ // renderers being initialized which might result in DemuxerStreamProvider
+ // GetStream suddenly returning NULL (see crbug.com/668604). So we are going
+ // to check here that GetStream will be invoked exactly 3 times during
+ // RendererImpl initialization to help catch potential issues. Currently the
+ // GetStream is invoked once directly from RendererImpl::Initialize, once
+ // indirectly from RendererImpl::Initialize via HasEncryptedStream and once
+ // from RendererImpl::InitializeVideoRenderer.
+ EXPECT_CALL(*demuxer_, GetStream(DemuxerStream::VIDEO))
+ .Times(2)
+ .WillRepeatedly(Return(video_stream_.get()));
InitializeAndExpect(PIPELINE_OK);
}
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698