#include "base/bind.h"
#include "base/memory/scoped_vector.h"
#include "media/base/media_log.h"
-#include "media/base/time_delta_interpolator.h"
#include "media/filters/audio_renderer_impl.h"
#include "media/filters/chunk_demuxer.h"
#include "media/filters/ffmpeg_audio_decoder.h"
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/file_data_source.h"
#include "media/filters/opus_audio_decoder.h"
+#include "media/filters/renderer_impl.h"
#include "media/filters/vpx_video_decoder.h"
using ::testing::_;
last_video_frame_format_(VideoFrame::UNKNOWN),
hardware_config_(AudioParameters(), AudioParameters()) {
base::MD5Init(&md5_context_);
-
- // Prevent non-deterministic buffering state callbacks from firing (e.g., slow
- // machine, valgrind).
- pipeline_->set_underflow_disabled_for_testing(true);
}
PipelineIntegrationTestBase::~PipelineIntegrationTestBase() {
.WillRepeatedly(SaveArg<0>(&metadata_));
EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
.Times(AtMost(1));
+ CreateDemuxer(file_path);
pipeline_->Start(
- CreateFilterCollection(file_path, NULL),
+ demuxer_.get(),
+ CreateRenderer(NULL),
base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)),
base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)),
QuitOnStatusCB(expected_status),
base::Unretained(this)),
base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged,
base::Unretained(this)),
- base::Closure());
+ base::Closure(),
+ base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack,
+ base::Unretained(this)));
message_loop_.Run();
return (pipeline_status_ == PIPELINE_OK);
}
kTestType test_type) {
hashing_enabled_ = test_type == kHashed;
clockless_playback_ = test_type == kClockless;
- if (clockless_playback_) {
- pipeline_->SetTimeDeltaInterpolatorForTesting(
- new TimeDeltaInterpolator(&dummy_clock_));
- }
return Start(file_path, expected_status);
}
.WillRepeatedly(SaveArg<0>(&metadata_));
EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
.Times(AtMost(1));
+
+ CreateDemuxer(file_path);
pipeline_->Start(
- CreateFilterCollection(file_path, decryptor),
+ demuxer_.get(),
+ CreateRenderer(decryptor),
base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)),
base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)),
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this)),
base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged,
base::Unretained(this)),
- base::Closure());
+ base::Closure(),
+ base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack,
+ base::Unretained(this)));
message_loop_.Run();
return (pipeline_status_ == PIPELINE_OK);
}
return (pipeline_status_ == PIPELINE_OK);
}
-scoped_ptr<FilterCollection>
-PipelineIntegrationTestBase::CreateFilterCollection(
- const base::FilePath& file_path,
- Decryptor* decryptor) {
+void PipelineIntegrationTestBase::CreateDemuxer(
+ const base::FilePath& file_path) {
FileDataSource* file_data_source = new FileDataSource();
CHECK(file_data_source->Initialize(file_path)) << "Is " << file_path.value()
<< " missing?";
Demuxer::NeedKeyCB need_key_cb = base::Bind(
&PipelineIntegrationTestBase::DemuxerNeedKeyCB, base::Unretained(this));
- scoped_ptr<Demuxer> demuxer(
- new FFmpegDemuxer(message_loop_.message_loop_proxy(),
- data_source_.get(),
- need_key_cb,
- new MediaLog()));
- return CreateFilterCollection(demuxer.Pass(), decryptor);
+ demuxer_ =
+ scoped_ptr<Demuxer>(new FFmpegDemuxer(message_loop_.message_loop_proxy(),
+ data_source_.get(),
+ need_key_cb,
+ new MediaLog()));
}
-scoped_ptr<FilterCollection>
-PipelineIntegrationTestBase::CreateFilterCollection(
- scoped_ptr<Demuxer> demuxer,
+scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer(
Decryptor* decryptor) {
- demuxer_ = demuxer.Pass();
-
- scoped_ptr<FilterCollection> collection(new FilterCollection());
- collection->SetDemuxer(demuxer_.get());
-
ScopedVector<VideoDecoder> video_decoders;
#if !defined(MEDIA_DISABLE_LIBVPX)
video_decoders.push_back(
new FFmpegVideoDecoder(message_loop_.message_loop_proxy()));
// Disable frame dropping if hashing is enabled.
- scoped_ptr<VideoRenderer> renderer(new VideoRendererImpl(
+ scoped_ptr<VideoRenderer> video_renderer(new VideoRendererImpl(
message_loop_.message_loop_proxy(),
video_decoders.Pass(),
base::Bind(&PipelineIntegrationTestBase::SetDecryptor,
decryptor),
base::Bind(&PipelineIntegrationTestBase::OnVideoRendererPaint,
base::Unretained(this)),
- false));
- collection->SetVideoRenderer(renderer.Pass());
+ false,
+ new MediaLog()));
if (!clockless_playback_) {
audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy());
512);
hardware_config_.UpdateOutputConfig(out_params);
- AudioRendererImpl* audio_renderer_impl = new AudioRendererImpl(
+ scoped_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl(
message_loop_.message_loop_proxy(),
(clockless_playback_)
? static_cast<AudioRendererSink*>(clockless_audio_sink_.get())
base::Bind(&PipelineIntegrationTestBase::SetDecryptor,
base::Unretained(this),
decryptor),
- &hardware_config_);
+ hardware_config_,
+ new MediaLog()));
if (hashing_enabled_)
audio_sink_->StartAudioHashForTesting();
- scoped_ptr<AudioRenderer> audio_renderer(audio_renderer_impl);
- collection->SetAudioRenderer(audio_renderer.Pass());
- return collection.Pass();
+ scoped_ptr<RendererImpl> renderer_impl(
+ new RendererImpl(message_loop_.message_loop_proxy(),
+ demuxer_.get(),
+ audio_renderer.Pass(),
+ video_renderer.Pass()));
+
+ // Prevent non-deterministic buffering state callbacks from firing (e.g., slow
+ // machine, valgrind).
+ renderer_impl->DisableUnderflowForTesting();
+
+ if (clockless_playback_)
+ renderer_impl->EnableClocklessVideoPlaybackForTesting();
+
+ return renderer_impl.PassAs<Renderer>();
}
void PipelineIntegrationTestBase::SetDecryptor(