Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/cma/pipeline/video_pipeline_impl.h" | 5 #include "chromecast/media/cma/pipeline/video_pipeline_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chromecast/media/cma/backend/video_pipeline_device.h" | 8 #include "chromecast/media/cma/backend/video_pipeline_device.h" |
| 9 #include "chromecast/media/cma/base/buffering_defs.h" | 9 #include "chromecast/media/cma/base/buffering_defs.h" |
| 10 #include "chromecast/media/cma/base/cma_logging.h" | 10 #include "chromecast/media/cma/base/cma_logging.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 void VideoPipelineImpl::SetCdm(BrowserCdmCast* media_keys) { | 94 void VideoPipelineImpl::SetCdm(BrowserCdmCast* media_keys) { |
| 95 av_pipeline_impl_->SetCdm(media_keys); | 95 av_pipeline_impl_->SetCdm(media_keys); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void VideoPipelineImpl::SetClient(const VideoPipelineClient& client) { | 98 void VideoPipelineImpl::SetClient(const VideoPipelineClient& client) { |
| 99 video_client_ = client; | 99 video_client_ = client; |
| 100 av_pipeline_impl_->SetClient(client.av_pipeline_client); | 100 av_pipeline_impl_->SetClient(client.av_pipeline_client); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void VideoPipelineImpl::Initialize( | 103 void VideoPipelineImpl::Initialize( |
| 104 const ::media::VideoDecoderConfig& video_config, | 104 const std::vector<::media::VideoDecoderConfig>& configs, |
| 105 scoped_ptr<CodedFrameProvider> frame_provider, | 105 scoped_ptr<CodedFrameProvider> frame_provider, |
| 106 const ::media::PipelineStatusCB& status_cb) { | 106 const ::media::PipelineStatusCB& status_cb) { |
| 107 CMALOG(kLogControl) << "VideoPipelineImpl::Initialize " | 107 CMALOG(kLogControl) << __FUNCTION__ << " config (" << configs.size() << ")"; |
| 108 << video_config.AsHumanReadableString(); | |
| 109 VideoPipelineDevice::VideoClient client; | 108 VideoPipelineDevice::VideoClient client; |
| 110 client.natural_size_changed_cb = | 109 client.natural_size_changed_cb = |
| 111 base::Bind(&VideoPipelineImpl::OnNaturalSizeChanged, weak_this_); | 110 base::Bind(&VideoPipelineImpl::OnNaturalSizeChanged, weak_this_); |
| 112 video_device_->SetVideoClient(client); | 111 video_device_->SetVideoClient(client); |
| 113 if (frame_provider) | 112 if (frame_provider) |
| 114 SetCodedFrameProvider(frame_provider.Pass()); | 113 SetCodedFrameProvider(frame_provider.Pass()); |
| 115 | 114 |
| 116 if (!video_device_->SetConfig( | 115 // TODO(erickung): Consider better interface to pass multiple video configs |
|
gunsch
2015/06/05 00:17:13
Is there _ever_ a case when we will have more than
erickung1
2015/06/05 01:04:18
This TODO is for later. I'll remove it from this C
| |
| 117 DecoderConfigAdapter::ToCastVideoConfig(kPrimary, video_config)) || | 116 // to CMA without chaining all of them. |
| 117 DCHECK(configs.size() <= 2); | |
| 118 VideoConfig video_config = | |
| 119 DecoderConfigAdapter::ToCastVideoConfig(kPrimary, configs[0]); | |
| 120 VideoConfig secondary_config; | |
| 121 if (configs.size() == 2) { | |
| 122 secondary_config = DecoderConfigAdapter::ToCastVideoConfig(kSecondary, | |
|
gunsch
2015/06/05 00:17:13
(Thanks for removing the "for" loop, this is a lot
erickung1
2015/06/05 01:04:18
From the original code, VideoPipelineImpl::Initial
gunsch
2015/06/05 18:08:16
If that's the assumption, then how about DCHECK(co
erickung1
2015/06/05 20:44:20
Done. I add the DCHECK on audio_pipeline_impl as w
| |
| 123 configs[1]); | |
| 124 video_config.additional_config = &secondary_config; | |
| 125 } | |
| 126 | |
| 127 if (!video_device_->SetConfig(video_config) || | |
| 118 !av_pipeline_impl_->Initialize()) { | 128 !av_pipeline_impl_->Initialize()) { |
| 119 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); | 129 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); |
| 120 return; | 130 return; |
| 121 } | 131 } |
| 122 av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushed); | 132 av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushed); |
| 123 status_cb.Run(::media::PIPELINE_OK); | 133 status_cb.Run(::media::PIPELINE_OK); |
| 124 } | 134 } |
| 125 | 135 |
| 126 void VideoPipelineImpl::OnUpdateConfig( | 136 void VideoPipelineImpl::OnUpdateConfig( |
| 127 StreamId id, | 137 StreamId id, |
| 128 const ::media::AudioDecoderConfig& audio_config, | 138 const ::media::AudioDecoderConfig& audio_config, |
| 129 const ::media::VideoDecoderConfig& video_config) { | 139 const ::media::VideoDecoderConfig& video_config) { |
| 140 DCHECK(!audio_config.IsValidConfig()); | |
| 130 if (video_config.IsValidConfig()) { | 141 if (video_config.IsValidConfig()) { |
| 131 CMALOG(kLogControl) << "VideoPipelineImpl::OnUpdateConfig id:" << id << " " | 142 CMALOG(kLogControl) << "VideoPipelineImpl::OnUpdateConfig id:" << id << " " |
| 132 << video_config.AsHumanReadableString(); | 143 << video_config.AsHumanReadableString(); |
| 133 | 144 |
| 134 bool success = video_device_->SetConfig( | 145 bool success = video_device_->SetConfig( |
| 135 DecoderConfigAdapter::ToCastVideoConfig(id, video_config)); | 146 DecoderConfigAdapter::ToCastVideoConfig(id, video_config)); |
| 136 if (!success && | 147 if (!success && |
| 137 !video_client_.av_pipeline_client.playback_error_cb.is_null()) { | 148 !video_client_.av_pipeline_client.playback_error_cb.is_null()) { |
| 138 video_client_.av_pipeline_client.playback_error_cb.Run( | 149 video_client_.av_pipeline_client.playback_error_cb.Run( |
| 139 ::media::PIPELINE_ERROR_DECODE); | 150 ::media::PIPELINE_ERROR_DECODE); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 170 delta_stats.video_frames_dropped = | 181 delta_stats.video_frames_dropped = |
| 171 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped; | 182 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped; |
| 172 | 183 |
| 173 previous_stats_ = current_stats; | 184 previous_stats_ = current_stats; |
| 174 | 185 |
| 175 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats); | 186 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats); |
| 176 } | 187 } |
| 177 | 188 |
| 178 } // namespace media | 189 } // namespace media |
| 179 } // namespace chromecast | 190 } // namespace chromecast |
| OLD | NEW |