diff --git a/packager/media/base/media_handler_test_base.cc b/packager/media/base/media_handler_test_base.cc index f6997ec196..8ff42c4c90 100644 --- a/packager/media/base/media_handler_test_base.cc +++ b/packager/media/base/media_handler_test_base.cc @@ -59,6 +59,33 @@ const uint8_t kData[]{ namespace shaka { namespace media { +bool FakeInputMediaHandler::ValidateOutputStreamIndex(size_t index) const { + return true; +} + +Status FakeInputMediaHandler::InitializeInternal() { + return Status::OK; +} + +Status FakeInputMediaHandler::Process(std::unique_ptr stream_data) { + return Status::OK; +} + +Status MockOutputMediaHandler::InitializeInternal() { + return Status::OK; +} + +Status MockOutputMediaHandler::Process( + std::unique_ptr stream_data) { + OnProcess(stream_data.get()); + return Status::OK; +} + +Status MockOutputMediaHandler::OnFlushRequest(size_t index) { + OnFlush(index); + return Status::OK; +} + Status FakeMediaHandler::InitializeInternal() { return Status::OK; } diff --git a/packager/media/base/media_handler_test_base.h b/packager/media/base/media_handler_test_base.h index daedcc5b15..c7d432cd9e 100644 --- a/packager/media/base/media_handler_test_base.h +++ b/packager/media/base/media_handler_test_base.h @@ -74,6 +74,29 @@ MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") { arg->media_sample->is_encrypted() == encrypted; } +class FakeInputMediaHandler : public MediaHandler { + public: + using MediaHandler::Dispatch; + using MediaHandler::FlushAllDownstreams; + using MediaHandler::FlushDownstream; + + private: + bool ValidateOutputStreamIndex(size_t index) const override; + Status InitializeInternal() override; + Status Process(std::unique_ptr stream_data) override; +}; + +class MockOutputMediaHandler : public MediaHandler { + public: + MOCK_METHOD1(OnProcess, void(const StreamData*)); + MOCK_METHOD1(OnFlush, void(size_t index)); + + private: + Status InitializeInternal() override; + Status Process(std::unique_ptr stream_data) override; + Status OnFlushRequest(size_t index) override; +}; + // A fake media handler definition used for testing. class FakeMediaHandler : public MediaHandler { public: