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

Unified Diff: media/base/pipeline_impl.cc

Issue 2075303002: [DO NOT COMMIT] Initial MediaPlayerRenderer plumbing and basic features (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index c5cb4841dc039970d0f8bb3cb8d1c587bcf99b69..bcebd0cb784ed05782fd4fce1a58213660e91adb 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -28,6 +28,7 @@
#include "media/base/text_track_config.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_decoder_config.h"
+#include "media/media_features.h"
static const double kDefaultPlaybackRate = 0.0;
static const float kDefaultVolume = 1.0f;
@@ -71,6 +72,7 @@ class PipelineImpl::RendererWrapper : public DemuxerHost,
void OnWaitingForDecryptionKey() final;
void OnVideoNaturalSizeChange(const gfx::Size& size) final;
void OnVideoOpacityChange(bool opaque) final;
+ void OnDurationChange(base::TimeDelta duration) final;
void DoSeek(base::TimeDelta seek_timestamp, const PipelineStatusCB& done_cb);
void DoStop(const base::Closure& done_cb);
@@ -543,6 +545,16 @@ void PipelineImpl::RendererWrapper::OnVideoOpacityChange(bool opaque) {
base::Bind(&PipelineImpl::OnVideoOpacityChange, weak_pipeline_, opaque));
}
+void PipelineImpl::RendererWrapper::OnDurationChange(base::TimeDelta duration) {
+#if BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER)
+ SetDuration(duration);
+#else
+ // Duration changes should be surfaced by the DemuxerStream, via the
+ // DemuxerHost interface.
+ NOTREACHED();
+#endif
+}
+
void PipelineImpl::RendererWrapper::SetDuration(base::TimeDelta duration) {
// TODO(alokp): Add thread DCHECK after ensuring that all Demuxer
// implementations call DemuxerHost on the media thread.
@@ -984,11 +996,18 @@ void PipelineImpl::RendererWrapper::InitializeRenderer(
const PipelineStatusCB& done_cb) {
DCHECK(media_task_runner_->BelongsToCurrentThread());
+#if BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER)
+ if (!demuxer_->GetStream(DemuxerStream::URL)) {
+ done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
+ return;
+ }
+#else
if (!demuxer_->GetStream(DemuxerStream::AUDIO) &&
!demuxer_->GetStream(DemuxerStream::VIDEO)) {
done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
return;
}
+#endif // BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER)
if (cdm_context_)
renderer_->SetCdm(cdm_context_, base::Bind(&IgnoreCdmAttached));
@@ -1000,6 +1019,14 @@ void PipelineImpl::RendererWrapper::ReportMetadata() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
PipelineMetadata metadata;
+#if BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER)
+ if (demuxer_->GetStream(DemuxerStream::URL)) {
+ // We don't know if the MediaPlayerRender has Audio/Video until we start
+ // playing. Conservatively assume that they do.
+ metadata.has_video = true;
+ metadata.has_audio = true;
+ }
+#else
metadata.timeline_offset = demuxer_->GetTimelineOffset();
DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
if (stream) {
@@ -1010,6 +1037,7 @@ void PipelineImpl::RendererWrapper::ReportMetadata() {
if (demuxer_->GetStream(DemuxerStream::AUDIO)) {
metadata.has_audio = true;
}
+#endif // BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER)
main_task_runner_->PostTask(FROM_HERE, base::Bind(&PipelineImpl::OnMetadata,
weak_pipeline_, metadata));

Powered by Google App Engine
This is Rietveld 408576698