| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromecast/browser/media/cast_renderer.h" | 5 #include "chromecast/browser/media/cast_renderer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "chromecast/base/task_runner_impl.h" | 9 #include "chromecast/base/task_runner_impl.h" |
| 10 #include "chromecast/browser/media/cma_media_pipeline_client.h" | 10 #include "chromecast/browser/media/cma_media_pipeline_client.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 audio_client.statistics_cb = statistics_cb; | 91 audio_client.statistics_cb = statistics_cb; |
| 92 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter( | 92 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter( |
| 93 task_runner_, media_task_runner_factory_, audio_stream)); | 93 task_runner_, media_task_runner_factory_, audio_stream)); |
| 94 ::media::PipelineStatus status = | 94 ::media::PipelineStatus status = |
| 95 pipeline_->InitializeAudio(audio_stream->audio_decoder_config(), | 95 pipeline_->InitializeAudio(audio_stream->audio_decoder_config(), |
| 96 audio_client, std::move(frame_provider)); | 96 audio_client, std::move(frame_provider)); |
| 97 if (status != ::media::PIPELINE_OK) { | 97 if (status != ::media::PIPELINE_OK) { |
| 98 init_cb.Run(status); | 98 init_cb.Run(status); |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 audio_stream->EnableBitstreamConverter(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 // Initialize video. | 104 // Initialize video. |
| 104 ::media::DemuxerStream* video_stream = | 105 ::media::DemuxerStream* video_stream = |
| 105 demuxer_stream_provider->GetStream(::media::DemuxerStream::VIDEO); | 106 demuxer_stream_provider->GetStream(::media::DemuxerStream::VIDEO); |
| 106 if (video_stream) { | 107 if (video_stream) { |
| 107 VideoPipelineClient video_client; | 108 VideoPipelineClient video_client; |
| 108 // TODO(alokp): Set VideoPipelineClient::natural_size_changed_cb. | 109 // TODO(alokp): Set VideoPipelineClient::natural_size_changed_cb. |
| 109 video_client.av_pipeline_client.wait_for_key_cb = | 110 video_client.av_pipeline_client.wait_for_key_cb = |
| 110 waiting_for_decryption_key_cb; | 111 waiting_for_decryption_key_cb; |
| 111 video_client.av_pipeline_client.eos_cb = | 112 video_client.av_pipeline_client.eos_cb = |
| 112 base::Bind(&CastRenderer::OnEos, base::Unretained(this), STREAM_VIDEO); | 113 base::Bind(&CastRenderer::OnEos, base::Unretained(this), STREAM_VIDEO); |
| 113 video_client.av_pipeline_client.playback_error_cb = error_cb; | 114 video_client.av_pipeline_client.playback_error_cb = error_cb; |
| 114 video_client.av_pipeline_client.statistics_cb = statistics_cb; | 115 video_client.av_pipeline_client.statistics_cb = statistics_cb; |
| 115 // TODO(alokp): Change MediaPipelineImpl API to accept a single config | 116 // TODO(alokp): Change MediaPipelineImpl API to accept a single config |
| 116 // after CmaRenderer is deprecated. | 117 // after CmaRenderer is deprecated. |
| 117 std::vector<::media::VideoDecoderConfig> video_configs; | 118 std::vector<::media::VideoDecoderConfig> video_configs; |
| 118 video_configs.push_back(video_stream->video_decoder_config()); | 119 video_configs.push_back(video_stream->video_decoder_config()); |
| 119 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter( | 120 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter( |
| 120 task_runner_, media_task_runner_factory_, video_stream)); | 121 task_runner_, media_task_runner_factory_, video_stream)); |
| 121 ::media::PipelineStatus status = pipeline_->InitializeVideo( | 122 ::media::PipelineStatus status = pipeline_->InitializeVideo( |
| 122 video_configs, video_client, std::move(frame_provider)); | 123 video_configs, video_client, std::move(frame_provider)); |
| 123 if (status != ::media::PIPELINE_OK) { | 124 if (status != ::media::PIPELINE_OK) { |
| 124 init_cb.Run(status); | 125 init_cb.Run(status); |
| 125 return; | 126 return; |
| 126 } | 127 } |
| 128 video_stream->EnableBitstreamConverter(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 ended_cb_ = ended_cb; | 131 ended_cb_ = ended_cb; |
| 130 init_cb.Run(::media::PIPELINE_OK); | 132 init_cb.Run(::media::PIPELINE_OK); |
| 131 } | 133 } |
| 132 | 134 |
| 133 void CastRenderer::SetCdm(::media::CdmContext* cdm_context, | 135 void CastRenderer::SetCdm(::media::CdmContext* cdm_context, |
| 134 const ::media::CdmAttachedCB& cdm_attached_cb) { | 136 const ::media::CdmAttachedCB& cdm_attached_cb) { |
| 135 DCHECK(task_runner_->BelongsToCurrentThread()); | 137 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 136 NOTIMPLEMENTED(); | 138 NOTIMPLEMENTED(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 DCHECK(!eos_[stream]); | 180 DCHECK(!eos_[stream]); |
| 179 eos_[stream] = true; | 181 eos_[stream] = true; |
| 180 CMALOG(kLogControl) << __FUNCTION__ << ": eos_audio=" << eos_[STREAM_AUDIO] | 182 CMALOG(kLogControl) << __FUNCTION__ << ": eos_audio=" << eos_[STREAM_AUDIO] |
| 181 << " eos_video=" << eos_[STREAM_VIDEO]; | 183 << " eos_video=" << eos_[STREAM_VIDEO]; |
| 182 if (eos_[STREAM_AUDIO] && eos_[STREAM_VIDEO]) | 184 if (eos_[STREAM_AUDIO] && eos_[STREAM_VIDEO]) |
| 183 ended_cb_.Run(); | 185 ended_cb_.Run(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } // namespace media | 188 } // namespace media |
| 187 } // namespace chromecast | 189 } // namespace chromecast |
| OLD | NEW |