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

Unified Diff: media/test/pipeline_integration_test_base.cc

Issue 1757593002: media: Update PipelineIntegrationTestBase to support MemoryDataSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test_base.cc
diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc
index 11da971031b7d1cc701d2bd7496c0f0601eacd33..ac35ee2c498d2692ddc77f4a3b4f2b0f07510d09 100644
--- a/media/test/pipeline_integration_test_base.cc
+++ b/media/test/pipeline_integration_test_base.cc
@@ -18,6 +18,7 @@
#include "media/filters/ffmpeg_video_decoder.h"
#endif
#include "media/filters/file_data_source.h"
+#include "media/filters/memory_data_source.h"
#include "media/filters/opus_audio_decoder.h"
#include "media/renderers/audio_renderer_impl.h"
#include "media/renderers/renderer_impl.h"
@@ -57,6 +58,8 @@ PipelineIntegrationTestBase::~PipelineIntegrationTestBase() {
Stop();
}
+// TODO(xhwang): Method definitions in this file needs to be reordered.
+
void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time,
PipelineStatus status) {
EXPECT_EQ(seek_time, pipeline_->GetMediaTime());
@@ -104,12 +107,13 @@ void PipelineIntegrationTestBase::OnError(PipelineStatus status) {
message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
}
-PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename) {
- return Start(filename, nullptr);
-}
+PipelineStatus PipelineIntegrationTestBase::StartInternal(
+ scoped_ptr<DataSource> data_source,
+ CdmContext* cdm_context,
+ uint8_t test_type) {
+ hashing_enabled_ = test_type & kHashed;
+ clockless_playback_ = test_type & kClockless;
-PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
- CdmContext* cdm_context) {
EXPECT_CALL(*this, OnMetadata(_))
.Times(AtMost(1))
.WillRepeatedly(SaveArg<0>(&metadata_));
@@ -117,7 +121,7 @@ PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
.Times(AnyNumber());
EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING))
.Times(AnyNumber());
- CreateDemuxer(filename);
+ CreateDemuxer(std::move(data_source));
if (cdm_context) {
EXPECT_CALL(*this, DecryptorAttached(true));
@@ -148,11 +152,36 @@ PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
return pipeline_status_;
}
+PipelineStatus PipelineIntegrationTestBase::StartWithFile(
+ const std::string& filename,
+ CdmContext* cdm_context,
+ uint8_t test_type) {
+ scoped_ptr<FileDataSource> file_data_source(new FileDataSource());
+ base::FilePath file_path(GetTestDataFilePath(filename));
+ CHECK(file_data_source->Initialize(file_path)) << "Is " << file_path.value()
+ << " missing?";
+ return StartInternal(std::move(file_data_source), cdm_context, test_type);
+}
+
+PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename) {
+ return StartWithFile(filename, nullptr, kNormal);
+}
+
+PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
+ CdmContext* cdm_context) {
+ return StartWithFile(filename, cdm_context, kNormal);
+}
+
PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
uint8_t test_type) {
- hashing_enabled_ = test_type & kHashed;
- clockless_playback_ = test_type & kClockless;
- return Start(filename);
+ return StartWithFile(filename, nullptr, test_type);
+}
+
+PipelineStatus PipelineIntegrationTestBase::Start(const uint8_t* data,
+ size_t size,
+ uint8_t test_type) {
+ return StartInternal(make_scoped_ptr(new MemoryDataSource(data, size)),
+ nullptr, test_type);
}
void PipelineIntegrationTestBase::Play() {
@@ -229,21 +258,16 @@ bool PipelineIntegrationTestBase::WaitUntilCurrentTimeIsAfter(
return (pipeline_status_ == PIPELINE_OK);
}
-void PipelineIntegrationTestBase::CreateDemuxer(const std::string& filename) {
- FileDataSource* file_data_source = new FileDataSource();
- base::FilePath file_path(GetTestDataFilePath(filename));
- CHECK(file_data_source->Initialize(file_path)) << "Is " << file_path.value()
- << " missing?";
- data_source_.reset(file_data_source);
-
- Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb =
- base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB,
- base::Unretained(this));
+void PipelineIntegrationTestBase::CreateDemuxer(
+ scoped_ptr<DataSource> data_source) {
+ data_source_ = std::move(data_source);
#if !defined(MEDIA_DISABLE_FFMPEG)
- demuxer_ = scoped_ptr<Demuxer>(
- new FFmpegDemuxer(message_loop_.task_runner(), data_source_.get(),
- encrypted_media_init_data_cb, new MediaLog()));
+ demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer(
+ message_loop_.task_runner(), data_source_.get(),
+ base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB,
+ base::Unretained(this)),
+ new MediaLog()));
#endif
}
« no previous file with comments | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698