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/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 needs_bitstream_conversion_ = (config.codec() == kCodecH264); | 174 needs_bitstream_conversion_ = (config.codec() == kCodecH264); |
175 | 175 |
176 if (previously_initialized) { | 176 if (previously_initialized) { |
177 // Reinitialization with a different config (but same codec and profile). | 177 // Reinitialization with a different config (but same codec and profile). |
178 // VDA should handle it by detecting this in-stream by itself, | 178 // VDA should handle it by detecting this in-stream by itself, |
179 // no need to notify it. | 179 // no need to notify it. |
180 status_cb.Run(PIPELINE_OK); | 180 status_cb.Run(PIPELINE_OK); |
181 return; | 181 return; |
182 } | 182 } |
183 | 183 |
184 vda_ = factories_->CreateVideoDecodeAccelerator(config.profile()).Pass(); | 184 vda_ = factories_->CreateVideoDecodeAccelerator().Pass(); |
185 if (!vda_ || !vda_->Initialize(config.profile(), this)) { | 185 if (!vda_ || !vda_->Initialize(config.profile(), this)) { |
186 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); | 186 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
187 return; | 187 return; |
188 } | 188 } |
189 | 189 |
190 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded."; | 190 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded."; |
191 media_log_->SetStringProperty("video_decoder", "gpu"); | 191 media_log_->SetStringProperty("video_decoder", "gpu"); |
192 status_cb.Run(PIPELINE_OK); | 192 status_cb.Run(PIPELINE_OK); |
193 } | 193 } |
194 | 194 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return needs_bitstream_conversion_; | 333 return needs_bitstream_conversion_; |
334 } | 334 } |
335 | 335 |
336 bool GpuVideoDecoder::CanReadWithoutStalling() const { | 336 bool GpuVideoDecoder::CanReadWithoutStalling() const { |
337 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 337 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
338 return | 338 return |
339 next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers(). | 339 next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers(). |
340 available_pictures_ > 0 || !ready_video_frames_.empty(); | 340 available_pictures_ > 0 || !ready_video_frames_.empty(); |
341 } | 341 } |
342 | 342 |
343 void GpuVideoDecoder::NotifyInitializeDone() { | |
344 NOTREACHED() << "GpuVideoDecodeAcceleratorHost::Initialize is synchronous!"; | |
345 } | |
346 | |
347 void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, | 343 void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, |
348 const gfx::Size& size, | 344 const gfx::Size& size, |
349 uint32 texture_target) { | 345 uint32 texture_target) { |
350 DVLOG(3) << "ProvidePictureBuffers(" << count << ", " | 346 DVLOG(3) << "ProvidePictureBuffers(" << count << ", " |
351 << size.width() << "x" << size.height() << ")"; | 347 << size.width() << "x" << size.height() << ")"; |
352 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 348 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
353 | 349 |
354 std::vector<uint32> texture_ids; | 350 std::vector<uint32> texture_ids; |
355 std::vector<gpu::Mailbox> texture_mailboxes; | 351 std::vector<gpu::Mailbox> texture_mailboxes; |
356 decoder_texture_target_ = texture_target; | 352 decoder_texture_target_ = texture_target; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 return; | 630 return; |
635 } | 631 } |
636 } | 632 } |
637 | 633 |
638 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 634 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
639 const { | 635 const { |
640 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 636 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
641 } | 637 } |
642 | 638 |
643 } // namespace media | 639 } // namespace media |
OLD | NEW |