OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/pipeline_impl.h" | 5 #include "media/base/pipeline_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 852 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
853 | 853 |
854 demuxer_->Initialize(this, done_cb, !!text_renderer_); | 854 demuxer_->Initialize(this, done_cb, !!text_renderer_); |
855 } | 855 } |
856 | 856 |
857 void PipelineImpl::RendererWrapper::InitializeRenderer( | 857 void PipelineImpl::RendererWrapper::InitializeRenderer( |
858 const PipelineStatusCB& done_cb) { | 858 const PipelineStatusCB& done_cb) { |
859 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 859 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
860 | 860 |
861 switch (demuxer_->GetType()) { | 861 switch (demuxer_->GetType()) { |
862 case DemuxerStreamProvider::Type::STREAM: | 862 case MediaResource::Type::STREAM: |
863 if (!demuxer_->GetStream(DemuxerStream::AUDIO) && | 863 if (!demuxer_->GetStream(DemuxerStream::AUDIO) && |
864 !demuxer_->GetStream(DemuxerStream::VIDEO)) { | 864 !demuxer_->GetStream(DemuxerStream::VIDEO)) { |
865 DVLOG(1) << "Error: demuxer does not have an audio or a video stream."; | 865 DVLOG(1) << "Error: demuxer does not have an audio or a video stream."; |
866 done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER); | 866 done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER); |
867 return; | 867 return; |
868 } | 868 } |
869 break; | 869 break; |
870 | 870 |
871 case DemuxerStreamProvider::Type::URL: | 871 case MediaResource::Type::URL: |
872 // NOTE: Empty GURL are not valid. | 872 // NOTE: Empty GURL are not valid. |
873 if (!demuxer_->GetMediaUrlParams().media_url.is_valid()) { | 873 if (!demuxer_->GetMediaUrlParams().media_url.is_valid()) { |
874 DVLOG(1) << "Error: demuxer does not have a valid URL."; | 874 DVLOG(1) << "Error: demuxer does not have a valid URL."; |
875 done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER); | 875 done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER); |
876 return; | 876 return; |
877 } | 877 } |
878 break; | 878 break; |
879 } | 879 } |
880 | 880 |
881 if (cdm_context_) | 881 if (cdm_context_) |
(...skipping 15 matching lines...) Expand all Loading... |
897 } | 897 } |
898 } | 898 } |
899 | 899 |
900 void PipelineImpl::RendererWrapper::ReportMetadata() { | 900 void PipelineImpl::RendererWrapper::ReportMetadata() { |
901 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 901 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
902 | 902 |
903 PipelineMetadata metadata; | 903 PipelineMetadata metadata; |
904 DemuxerStream* stream; | 904 DemuxerStream* stream; |
905 | 905 |
906 switch (demuxer_->GetType()) { | 906 switch (demuxer_->GetType()) { |
907 case DemuxerStreamProvider::Type::STREAM: | 907 case MediaResource::Type::STREAM: |
908 metadata.timeline_offset = demuxer_->GetTimelineOffset(); | 908 metadata.timeline_offset = demuxer_->GetTimelineOffset(); |
909 stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 909 stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
910 if (stream) { | 910 if (stream) { |
911 metadata.has_video = true; | 911 metadata.has_video = true; |
912 metadata.natural_size = | 912 metadata.natural_size = |
913 GetRotatedVideoSize(stream->video_rotation(), | 913 GetRotatedVideoSize(stream->video_rotation(), |
914 stream->video_decoder_config().natural_size()); | 914 stream->video_decoder_config().natural_size()); |
915 metadata.video_rotation = stream->video_rotation(); | 915 metadata.video_rotation = stream->video_rotation(); |
916 metadata.video_decoder_config = stream->video_decoder_config(); | 916 metadata.video_decoder_config = stream->video_decoder_config(); |
917 } | 917 } |
918 stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 918 stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
919 if (stream) { | 919 if (stream) { |
920 metadata.has_audio = true; | 920 metadata.has_audio = true; |
921 metadata.audio_decoder_config = stream->audio_decoder_config(); | 921 metadata.audio_decoder_config = stream->audio_decoder_config(); |
922 } | 922 } |
923 break; | 923 break; |
924 | 924 |
925 case DemuxerStreamProvider::Type::URL: | 925 case MediaResource::Type::URL: |
926 // We don't know if the MediaPlayerRender has Audio/Video until we start | 926 // We don't know if the MediaPlayerRender has Audio/Video until we start |
927 // playing. Conservatively assume that they do. | 927 // playing. Conservatively assume that they do. |
928 metadata.has_video = true; | 928 metadata.has_video = true; |
929 metadata.has_audio = true; | 929 metadata.has_audio = true; |
930 break; | 930 break; |
931 } | 931 } |
932 | 932 |
933 main_task_runner_->PostTask(FROM_HERE, base::Bind(&PipelineImpl::OnMetadata, | 933 main_task_runner_->PostTask(FROM_HERE, base::Bind(&PipelineImpl::OnMetadata, |
934 weak_pipeline_, metadata)); | 934 weak_pipeline_, metadata)); |
935 } | 935 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 void PipelineImpl::OnSuspendDone() { | 1338 void PipelineImpl::OnSuspendDone() { |
1339 DVLOG(3) << __func__; | 1339 DVLOG(3) << __func__; |
1340 DCHECK(thread_checker_.CalledOnValidThread()); | 1340 DCHECK(thread_checker_.CalledOnValidThread()); |
1341 DCHECK(IsRunning()); | 1341 DCHECK(IsRunning()); |
1342 | 1342 |
1343 DCHECK(!suspend_cb_.is_null()); | 1343 DCHECK(!suspend_cb_.is_null()); |
1344 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); | 1344 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); |
1345 } | 1345 } |
1346 | 1346 |
1347 } // namespace media | 1347 } // namespace media |
OLD | NEW |