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

Unified Diff: media/base/pipeline_impl.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: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index ef8ac158a57c0837399ef7f2626e816135cd8e07..3270fb26c60980a0e325807c425d4ebdd624be4f 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -859,16 +859,15 @@ void PipelineImpl::RendererWrapper::InitializeRenderer(
DCHECK(media_task_runner_->BelongsToCurrentThread());
switch (demuxer_->GetType()) {
- case DemuxerStreamProvider::Type::STREAM:
- if (!demuxer_->GetStream(DemuxerStream::AUDIO) &&
- !demuxer_->GetStream(DemuxerStream::VIDEO)) {
+ case MediaResource::Type::STREAM:
+ if (demuxer_->GetStreams().empty()) {
DVLOG(1) << "Error: demuxer does not have an audio or a video stream.";
done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
return;
}
break;
- case DemuxerStreamProvider::Type::URL:
+ case MediaResource::Type::URL:
// NOTE: Empty GURL are not valid.
if (!demuxer_->GetMediaUrlParams().media_url.is_valid()) {
DVLOG(1) << "Error: demuxer does not have a valid URL.";
@@ -901,28 +900,30 @@ void PipelineImpl::RendererWrapper::ReportMetadata() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
PipelineMetadata metadata;
- DemuxerStream* stream;
+ std::vector<DemuxerStream*> streams;
switch (demuxer_->GetType()) {
- case DemuxerStreamProvider::Type::STREAM:
+ case MediaResource::Type::STREAM:
metadata.timeline_offset = demuxer_->GetTimelineOffset();
- stream = demuxer_->GetStream(DemuxerStream::VIDEO);
- if (stream) {
- metadata.has_video = true;
- metadata.natural_size =
- GetRotatedVideoSize(stream->video_rotation(),
- stream->video_decoder_config().natural_size());
- metadata.video_rotation = stream->video_rotation();
- metadata.video_decoder_config = stream->video_decoder_config();
- }
- stream = demuxer_->GetStream(DemuxerStream::AUDIO);
- if (stream) {
- metadata.has_audio = true;
- metadata.audio_decoder_config = stream->audio_decoder_config();
+ // TODO(servolk): What should we do about metadata for multiple streams?
+ streams = demuxer_->GetStreams();
+ for (const auto& stream : streams) {
+ if (stream->type() == DemuxerStream::VIDEO && !metadata.has_video) {
+ metadata.has_video = true;
+ metadata.natural_size = GetRotatedVideoSize(
+ stream->video_rotation(),
+ stream->video_decoder_config().natural_size());
+ metadata.video_rotation = stream->video_rotation();
+ metadata.video_decoder_config = stream->video_decoder_config();
+ }
+ if (stream->type() == DemuxerStream::AUDIO && !metadata.has_audio) {
+ metadata.has_audio = true;
+ metadata.audio_decoder_config = stream->audio_decoder_config();
+ }
xhwang 2017/02/01 18:26:03 This will set the meta data according to the last
servolk 2017/02/01 22:29:17 No, this will set metadata according to the first
}
break;
- case DemuxerStreamProvider::Type::URL:
+ case MediaResource::Type::URL:
// We don't know if the MediaPlayerRender has Audio/Video until we start
// playing. Conservatively assume that they do.
metadata.has_video = true;

Powered by Google App Engine
This is Rietveld 408576698