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

Unified Diff: chromecast/media/service/cast_renderer.cc

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase Created 3 years, 11 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: chromecast/media/service/cast_renderer.cc
diff --git a/chromecast/media/service/cast_renderer.cc b/chromecast/media/service/cast_renderer.cc
index aa3ae067644ddc8c5fcbbe77667e5a653c156fe4..109517b2bc3f12a4ae30fd527de23dd9ffa65d2d 100644
--- a/chromecast/media/service/cast_renderer.cc
+++ b/chromecast/media/service/cast_renderer.cc
@@ -18,8 +18,8 @@
#include "chromecast/public/media/media_pipeline_device_params.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/demuxer_stream.h"
-#include "media/base/demuxer_stream_provider.h"
#include "media/base/media_log.h"
+#include "media/base/media_resource.h"
#include "media/base/renderer_client.h"
namespace chromecast {
@@ -61,10 +61,9 @@ CastRenderer::~CastRenderer() {
video_resolution_policy_->RemoveObserver(this);
}
-void CastRenderer::Initialize(
- ::media::DemuxerStreamProvider* demuxer_stream_provider,
- ::media::RendererClient* client,
- const ::media::PipelineStatusCB& init_cb) {
+void CastRenderer::Initialize(::media::MediaResource* media_resource,
+ ::media::RendererClient* client,
+ const ::media::PipelineStatusCB& init_cb) {
CMALOG(kLogControl) << __FUNCTION__ << ": " << this;
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -92,9 +91,22 @@ void CastRenderer::Initialize(
pipeline_->SetClient(pipeline_client);
pipeline_->Initialize(load_type, std::move(backend));
+ // Obtain the first enabled audio and video streams.
xhwang 2017/02/01 18:26:03 Here and everywhere else, add a TODO to enable mul
servolk 2017/02/01 22:29:11 Done.
+ std::vector<::media::DemuxerStream*> streams = media_resource->GetStreams();
+ ::media::DemuxerStream* audio_stream = nullptr;
+ ::media::DemuxerStream* video_stream = nullptr;
+ for (const auto& s : streams) {
xhwang 2017/02/01 18:26:03 tiny nit: This is a local variable in the loop so
servolk 2017/02/01 22:29:11 Done.
+ if (!audio_stream && s->enabled() &&
+ s->type() == ::media::DemuxerStream::AUDIO) {
+ audio_stream = s;
+ }
+ if (!video_stream && s->enabled() &&
+ s->type() == ::media::DemuxerStream::VIDEO) {
+ video_stream = s;
+ }
+ }
+
// Initialize audio.
- ::media::DemuxerStream* audio_stream =
- demuxer_stream_provider->GetStream(::media::DemuxerStream::AUDIO);
if (audio_stream) {
AvPipelineClient audio_client;
audio_client.wait_for_key_cb = base::Bind(
@@ -119,8 +131,6 @@ void CastRenderer::Initialize(
}
// Initialize video.
- ::media::DemuxerStream* video_stream =
- demuxer_stream_provider->GetStream(::media::DemuxerStream::VIDEO);
if (video_stream) {
VideoPipelineClient video_client;
video_client.av_pipeline_client.wait_for_key_cb = base::Bind(

Powered by Google App Engine
This is Rietveld 408576698