Commit aadbc529 authored by Wojciech Dzierżanowski's avatar Wojciech Dzierżanowski Committed by Commit Bot

Avoid calling GetAllStreams() on uninitialized Demuxer

The first time we know the Demuxer initialization is complete is when
Pipeline::Start() completes (asynchronously).

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I7451187be2d141780d5aa514fb3a1ec4abe8fbbe
Reviewed-on: https://chromium-review.googlesource.com/1000858
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551156}
parent 968fd020
...@@ -1420,6 +1420,9 @@ TEST_P(ChunkDemuxerTest, Init) { ...@@ -1420,6 +1420,9 @@ TEST_P(ChunkDemuxerTest, Init) {
EXPECT_FALSE(video_stream); EXPECT_FALSE(video_stream);
} }
for (auto* stream : demuxer_->GetAllStreams())
EXPECT_TRUE(stream->SupportsConfigChanges());
ShutdownDemuxer(); ShutdownDemuxer();
demuxer_.reset(); demuxer_.reset();
} }
......
...@@ -517,6 +517,15 @@ TEST_F(FFmpegDemuxerTest, Initialize_Encrypted) { ...@@ -517,6 +517,15 @@ TEST_F(FFmpegDemuxerTest, Initialize_Encrypted) {
InitializeDemuxer(); InitializeDemuxer();
} }
TEST_F(FFmpegDemuxerTest, Initialize_NoConfigChangeSupport) {
// Will create one audio, one video, and one text stream.
CreateDemuxer("bear-vp8-webvtt.webm");
InitializeDemuxer();
for (auto* stream : demuxer_->GetAllStreams())
EXPECT_FALSE(stream->SupportsConfigChanges());
}
TEST_F(FFmpegDemuxerTest, AbortPendingReads) { TEST_F(FFmpegDemuxerTest, AbortPendingReads) {
// We test that on a successful audio packet read. // We test that on a successful audio packet read.
CreateDemuxer("bear-320x240.webm"); CreateDemuxer("bear-320x240.webm");
......
...@@ -274,12 +274,11 @@ PipelineStatus PipelineIntegrationTestBase::StartInternal( ...@@ -274,12 +274,11 @@ PipelineStatus PipelineIntegrationTestBase::StartInternal(
// media files are provided in advance. // media files are provided in advance.
EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
// SRC= demuxer does not support config changes. // DemuxerStreams may signal config changes.
for (auto* stream : demuxer_->GetAllStreams()) { // In practice, this doesn't happen for FFmpegDemuxer, but it's allowed for
EXPECT_FALSE(stream->SupportsConfigChanges()); // SRC= demuxers in general.
} EXPECT_CALL(*this, OnAudioConfigChange(_)).Times(AnyNumber());
EXPECT_CALL(*this, OnAudioConfigChange(_)).Times(0); EXPECT_CALL(*this, OnVideoConfigChange(_)).Times(AnyNumber());
EXPECT_CALL(*this, OnVideoConfigChange(_)).Times(0);
base::RunLoop run_loop; base::RunLoop run_loop;
pipeline_->Start( pipeline_->Start(
...@@ -606,10 +605,7 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource( ...@@ -606,10 +605,7 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource(
base::Unretained(this), run_loop.QuitWhenIdleClosure())); base::Unretained(this), run_loop.QuitWhenIdleClosure()));
demuxer_ = source->GetDemuxer(); demuxer_ = source->GetDemuxer();
// MediaSource demuxer may signal config changes. // DemuxerStreams may signal config changes.
for (auto* stream : demuxer_->GetAllStreams()) {
EXPECT_TRUE(stream->SupportsConfigChanges());
}
// Config change tests should set more specific expectations about the number // Config change tests should set more specific expectations about the number
// of calls. // of calls.
EXPECT_CALL(*this, OnAudioConfigChange(_)).Times(AnyNumber()); EXPECT_CALL(*this, OnAudioConfigChange(_)).Times(AnyNumber());
...@@ -646,6 +642,10 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource( ...@@ -646,6 +642,10 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource(
RunUntilIdleOrEndedOrError(&run_loop); RunUntilIdleOrEndedOrError(&run_loop);
for (auto* stream : demuxer_->GetAllStreams()) {
EXPECT_TRUE(stream->SupportsConfigChanges());
}
return pipeline_status_; return pipeline_status_;
} }
......
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