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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 2825863002: Fix status notifications for FFmpegDemuxerStream with a pending read (Closed)
Patch Set: Add a comment explaining FlushBuffers Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 4659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 stream->SetEnabled(true, base::TimeDelta()); 4670 stream->SetEnabled(true, base::TimeDelta());
4671 base::RunLoop().RunUntilIdle(); 4671 base::RunLoop().RunUntilIdle();
4672 ASSERT_TRUE(event.IsSignaled()); 4672 ASSERT_TRUE(event.IsSignaled());
4673 } 4673 }
4674 4674
4675 TEST_F(ChunkDemuxerTest, StreamStatusNotifications) { 4675 TEST_F(ChunkDemuxerTest, StreamStatusNotifications) {
4676 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); 4676 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO));
4677 ChunkDemuxerStream* audio_stream = 4677 ChunkDemuxerStream* audio_stream =
4678 static_cast<ChunkDemuxerStream*>(GetStream(DemuxerStream::AUDIO)); 4678 static_cast<ChunkDemuxerStream*>(GetStream(DemuxerStream::AUDIO));
4679 EXPECT_NE(nullptr, audio_stream); 4679 EXPECT_NE(nullptr, audio_stream);
4680 CheckStreamStatusNotifications(demuxer_.get(), audio_stream);
4681 ChunkDemuxerStream* video_stream = 4680 ChunkDemuxerStream* video_stream =
4682 static_cast<ChunkDemuxerStream*>(GetStream(DemuxerStream::VIDEO)); 4681 static_cast<ChunkDemuxerStream*>(GetStream(DemuxerStream::VIDEO));
4683 EXPECT_NE(nullptr, video_stream); 4682 EXPECT_NE(nullptr, video_stream);
4683
4684 // Verify stream status changes without pending read.
4685 CheckStreamStatusNotifications(demuxer_.get(), audio_stream);
4684 CheckStreamStatusNotifications(demuxer_.get(), video_stream); 4686 CheckStreamStatusNotifications(demuxer_.get(), video_stream);
4687
4688 // Verify stream status changes with pending read.
4689 bool read_done = false;
4690 audio_stream->Read(base::Bind(&OnReadDone_EOSExpected, &read_done));
4691 CheckStreamStatusNotifications(demuxer_.get(), audio_stream);
4692 EXPECT_TRUE(read_done);
4693 read_done = false;
4694 video_stream->Read(base::Bind(&OnReadDone_EOSExpected, &read_done));
4695 CheckStreamStatusNotifications(demuxer_.get(), video_stream);
4696 EXPECT_TRUE(read_done);
4685 } 4697 }
4686 4698
4687 TEST_F(ChunkDemuxerTest, MultipleIds) { 4699 TEST_F(ChunkDemuxerTest, MultipleIds) {
4688 CreateNewDemuxer(); 4700 CreateNewDemuxer();
4689 EXPECT_CALL(*this, DemuxerOpened()); 4701 EXPECT_CALL(*this, DemuxerOpened());
4690 EXPECT_CALL(host_, SetDuration(_)).Times(2); 4702 EXPECT_CALL(host_, SetDuration(_)).Times(2);
4691 demuxer_->Initialize(&host_, CreateInitDoneCB(kNoTimestamp, PIPELINE_OK), 4703 demuxer_->Initialize(&host_, CreateInitDoneCB(kNoTimestamp, PIPELINE_OK),
4692 true); 4704 true);
4693 4705
4694 const char* kId1 = "id1"; 4706 const char* kId1 = "id1";
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 4804
4793 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "vp09.00.10.08"), 4805 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "vp09.00.10.08"),
4794 expected); 4806 expected);
4795 } 4807 }
4796 4808
4797 INSTANTIATE_TEST_CASE_P(EnableDisableMp4Vp9Demuxing, 4809 INSTANTIATE_TEST_CASE_P(EnableDisableMp4Vp9Demuxing,
4798 ChunkDemuxerMp4Vp9Test, 4810 ChunkDemuxerMp4Vp9Test,
4799 ::testing::Bool()); 4811 ::testing::Bool());
4800 4812
4801 } // namespace media 4813 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698