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

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 2448763002: FFmpegDemuxer: Clear |extra_data| when enabling bitstream conversion. (Closed)
Patch Set: Restore variant used by fuzzertest. Created 4 years, 1 month 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 | « media/filters/ffmpeg_demuxer.cc ('k') | media/test/pipeline_integration_test_base.h » ('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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 size_t current_position_; 663 size_t current_position_;
664 size_t initial_append_size_; 664 size_t initial_append_size_;
665 std::string mimetype_; 665 std::string mimetype_;
666 ChunkDemuxer* chunk_demuxer_; 666 ChunkDemuxer* chunk_demuxer_;
667 std::unique_ptr<Demuxer> owned_chunk_demuxer_; 667 std::unique_ptr<Demuxer> owned_chunk_demuxer_;
668 PipelineStatusCB demuxer_failure_cb_; 668 PipelineStatusCB demuxer_failure_cb_;
669 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 669 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
670 base::TimeDelta last_timestamp_offset_; 670 base::TimeDelta last_timestamp_offset_;
671 }; 671 };
672 672
673 // A rough simulation of GpuVideoDecoder that fails every Decode() request. This
674 // is used to test post-Initialize() fallback paths.
675 class FailingVideoDecoder : public VideoDecoder {
676 public:
677 std::string GetDisplayName() const override { return "FailingVideoDecoder"; }
678 void Initialize(const VideoDecoderConfig& config,
679 bool low_delay,
680 CdmContext* cdm_context,
681 const InitCB& init_cb,
682 const OutputCB& output_cb) override {
683 init_cb.Run(true);
684 }
685 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
686 const DecodeCB& decode_cb) override {
687 base::ThreadTaskRunnerHandle::Get()->PostTask(
688 FROM_HERE, base::Bind(decode_cb, DecodeStatus::DECODE_ERROR));
689 }
690 void Reset(const base::Closure& closure) override { closure.Run(); }
691 bool NeedsBitstreamConversion() const override { return true; }
692 };
693
673 // TODO(xhwang): These tests have been disabled for some time as apptests and no 694 // TODO(xhwang): These tests have been disabled for some time as apptests and no
674 // longer pass. They need to be reconstituted as shell tests. 695 // longer pass. They need to be reconstituted as shell tests.
675 // Currently there are compile issues which must be resolved, 696 // Currently there are compile issues which must be resolved,
676 // preferably by eliminating multiple inheritance here which is 697 // preferably by eliminating multiple inheritance here which is
677 // banned by Google C++ style. 698 // banned by Google C++ style.
678 #if defined(MOJO_RENDERER) && defined(ENABLE_MOJO_PIPELINE_INTEGRATION_TEST) 699 #if defined(MOJO_RENDERER) && defined(ENABLE_MOJO_PIPELINE_INTEGRATION_TEST)
679 class PipelineIntegrationTestHost : public service_manager::test::ServiceTest, 700 class PipelineIntegrationTestHost : public service_manager::test::ServiceTest,
680 public PipelineIntegrationTestBase { 701 public PipelineIntegrationTestBase {
681 public: 702 public:
682 PipelineIntegrationTestHost() 703 PipelineIntegrationTestHost()
683 : service_manager::test::ServiceTest( 704 : service_manager::test::ServiceTest(
684 "exe:media_pipeline_integration_shelltests") {} 705 "exe:media_pipeline_integration_shelltests") {}
685 706
686 void SetUp() override { 707 void SetUp() override {
687 ServiceTest::SetUp(); 708 ServiceTest::SetUp();
688 InitializeMediaLibrary(); 709 InitializeMediaLibrary();
689 } 710 }
690 711
691 protected: 712 protected:
692 std::unique_ptr<Renderer> CreateRenderer() override { 713 std::unique_ptr<Renderer> CreateRenderer(
714 ScopedVector<VideoDecoder> prepend_video_decoders,
715 ScopedVector<AudioDecoder> prepend_audio_decoders) override {
693 connector()->ConnectToInterface("service:media", &media_interface_factory_); 716 connector()->ConnectToInterface("service:media", &media_interface_factory_);
694 717
695 mojom::RendererPtr mojo_renderer; 718 mojom::RendererPtr mojo_renderer;
696 media_interface_factory_->CreateRenderer(std::string(), 719 media_interface_factory_->CreateRenderer(std::string(),
697 mojo::GetProxy(&mojo_renderer)); 720 mojo::GetProxy(&mojo_renderer));
698 721
699 return base::MakeUnique<MojoRenderer>(message_loop_.task_runner(), 722 return base::MakeUnique<MojoRenderer>(message_loop_.task_runner(),
700 std::move(mojo_renderer)); 723 std::move(mojo_renderer));
701 } 724 }
702 725
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 #if defined(USE_PROPRIETARY_CODECS) 1550 #if defined(USE_PROPRIETARY_CODECS)
1528 1551
1529 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) { 1552 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) {
1530 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless)); 1553 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless));
1531 1554
1532 Play(); 1555 Play();
1533 1556
1534 ASSERT_TRUE(WaitUntilOnEnded()); 1557 ASSERT_TRUE(WaitUntilOnEnded());
1535 } 1558 }
1536 1559
1560 TEST_F(PipelineIntegrationTest, BasicFallback) {
1561 ScopedVector<VideoDecoder> failing_video_decoder;
1562 failing_video_decoder.push_back(new FailingVideoDecoder());
1563
1564 ASSERT_EQ(PIPELINE_OK,
1565 Start("bear.mp4", kClockless, std::move(failing_video_decoder)));
1566
1567 Play();
1568
1569 ASSERT_TRUE(WaitUntilOnEnded());
1570 };
1571
1537 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { 1572 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) {
1538 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1573 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1539 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1574 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1540 source.EndOfStream(); 1575 source.EndOfStream();
1541 1576
1542 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1577 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1543 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1578 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1544 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1579 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1545 1580
1546 Play(); 1581 Play();
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 2514
2480 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2515 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2481 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2516 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2482 Play(); 2517 Play();
2483 ASSERT_TRUE(WaitUntilOnEnded()); 2518 ASSERT_TRUE(WaitUntilOnEnded());
2484 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2519 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2485 demuxer_->GetStartTime()); 2520 demuxer_->GetStartTime());
2486 } 2521 }
2487 2522
2488 } // namespace media 2523 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/test/pipeline_integration_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698