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 VideoConfig *video_configs = new VideoConfig[configs.size()]; |
gunsch
2015/06/04 17:03:43
scoped_ptr has an array templatization that handle
erickung1
2015/06/04 20:29:20
I removed the code here using loop and assume at m
| |
117 DecoderConfigAdapter::ToCastVideoConfig(kPrimary, video_config)) || | 116 for (size_t i = 0; i < configs.size(); i++) { |
118 !av_pipeline_impl_->Initialize()) { | 117 LOG(INFO) << configs[i].AsHumanReadableString(); |
118 video_configs[i] = DecoderConfigAdapter::ToCastVideoConfig( | |
119 static_cast<StreamId>(i), configs[i]); | |
120 if (i > 0) { | |
121 video_configs[i-1].additional_config = &video_configs[i]; | |
gunsch
2015/06/04 17:03:43
I don't understand this. So you allow for N video
erickung1
2015/06/04 20:29:20
The original thought is to use programming solutio
| |
122 } | |
123 } | |
124 bool result = video_device_->SetConfig(video_configs[0]); | |
gunsch
2015/06/04 17:03:43
Yeah, see, you do a complicated loop above, but th
erickung1
2015/06/04 20:29:20
Done.
| |
125 delete[] video_configs; | |
126 | |
127 if (!result || !av_pipeline_impl_->Initialize()) { | |
119 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); | 128 status_cb.Run(::media::PIPELINE_ERROR_INITIALIZATION_FAILED); |
120 return; | 129 return; |
121 } | 130 } |
122 av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushed); | 131 av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushed); |
123 status_cb.Run(::media::PIPELINE_OK); | 132 status_cb.Run(::media::PIPELINE_OK); |
124 } | 133 } |
125 | 134 |
126 void VideoPipelineImpl::OnUpdateConfig( | 135 void VideoPipelineImpl::OnUpdateConfig( |
127 StreamId id, | 136 StreamId id, |
128 const ::media::AudioDecoderConfig& audio_config, | 137 const ::media::AudioDecoderConfig& audio_config, |
129 const ::media::VideoDecoderConfig& video_config) { | 138 const ::media::VideoDecoderConfig& video_config) { |
139 DCHECK(!audio_config.IsValidConfig()); | |
130 if (video_config.IsValidConfig()) { | 140 if (video_config.IsValidConfig()) { |
131 CMALOG(kLogControl) << "VideoPipelineImpl::OnUpdateConfig id:" << id << " " | 141 CMALOG(kLogControl) << "VideoPipelineImpl::OnUpdateConfig id:" << id << " " |
132 << video_config.AsHumanReadableString(); | 142 << video_config.AsHumanReadableString(); |
133 | 143 |
134 bool success = video_device_->SetConfig( | 144 bool success = video_device_->SetConfig( |
135 DecoderConfigAdapter::ToCastVideoConfig(id, video_config)); | 145 DecoderConfigAdapter::ToCastVideoConfig(id, video_config)); |
136 if (!success && | 146 if (!success && |
137 !video_client_.av_pipeline_client.playback_error_cb.is_null()) { | 147 !video_client_.av_pipeline_client.playback_error_cb.is_null()) { |
138 video_client_.av_pipeline_client.playback_error_cb.Run( | 148 video_client_.av_pipeline_client.playback_error_cb.Run( |
139 ::media::PIPELINE_ERROR_DECODE); | 149 ::media::PIPELINE_ERROR_DECODE); |
(...skipping 30 matching lines...) Expand all Loading... | |
170 delta_stats.video_frames_dropped = | 180 delta_stats.video_frames_dropped = |
171 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped; | 181 current_stats.video_frames_dropped - previous_stats_.video_frames_dropped; |
172 | 182 |
173 previous_stats_ = current_stats; | 183 previous_stats_ = current_stats; |
174 | 184 |
175 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats); | 185 video_client_.av_pipeline_client.statistics_cb.Run(delta_stats); |
176 } | 186 } |
177 | 187 |
178 } // namespace media | 188 } // namespace media |
179 } // namespace chromecast | 189 } // namespace chromecast |
OLD | NEW |