| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 needs_bitstream_conversion_ = (config.codec() == kCodecH264); | 173 needs_bitstream_conversion_ = (config.codec() == kCodecH264); |
| 174 | 174 |
| 175 if (previously_initialized) { | 175 if (previously_initialized) { |
| 176 // Reinitialization with a different config (but same codec and profile). | 176 // Reinitialization with a different config (but same codec and profile). |
| 177 // VDA should handle it by detecting this in-stream by itself, | 177 // VDA should handle it by detecting this in-stream by itself, |
| 178 // no need to notify it. | 178 // no need to notify it. |
| 179 status_cb.Run(PIPELINE_OK); | 179 status_cb.Run(PIPELINE_OK); |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 | 182 |
| 183 vda_ = factories_->CreateVideoDecodeAccelerator(config.profile()).Pass(); | 183 vda_ = factories_->CreateVideoDecodeAccelerator().Pass(); |
| 184 if (!vda_ || !vda_->Initialize(config.profile(), this)) { | 184 if (!vda_ || !vda_->Initialize(config.profile(), this)) { |
| 185 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); | 185 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 | 188 |
| 189 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded."; | 189 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded."; |
| 190 media_log_->SetStringProperty("video_decoder", "gpu"); | 190 media_log_->SetStringProperty("video_decoder", "gpu"); |
| 191 status_cb.Run(PIPELINE_OK); | 191 status_cb.Run(PIPELINE_OK); |
| 192 } | 192 } |
| 193 | 193 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return needs_bitstream_conversion_; | 338 return needs_bitstream_conversion_; |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool GpuVideoDecoder::CanReadWithoutStalling() const { | 341 bool GpuVideoDecoder::CanReadWithoutStalling() const { |
| 342 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 342 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 343 return | 343 return |
| 344 next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers(). | 344 next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers(). |
| 345 available_pictures_ > 0 || !ready_video_frames_.empty(); | 345 available_pictures_ > 0 || !ready_video_frames_.empty(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void GpuVideoDecoder::NotifyInitializeDone() { | |
| 349 NOTREACHED() << "GpuVideoDecodeAcceleratorHost::Initialize is synchronous!"; | |
| 350 } | |
| 351 | |
| 352 void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, | 348 void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, |
| 353 const gfx::Size& size, | 349 const gfx::Size& size, |
| 354 uint32 texture_target) { | 350 uint32 texture_target) { |
| 355 DVLOG(3) << "ProvidePictureBuffers(" << count << ", " | 351 DVLOG(3) << "ProvidePictureBuffers(" << count << ", " |
| 356 << size.width() << "x" << size.height() << ")"; | 352 << size.width() << "x" << size.height() << ")"; |
| 357 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 353 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 358 | 354 |
| 359 std::vector<uint32> texture_ids; | 355 std::vector<uint32> texture_ids; |
| 360 std::vector<gpu::Mailbox> texture_mailboxes; | 356 std::vector<gpu::Mailbox> texture_mailboxes; |
| 361 decoder_texture_target_ = texture_target; | 357 decoder_texture_target_ = texture_target; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 return; | 642 return; |
| 647 } | 643 } |
| 648 } | 644 } |
| 649 | 645 |
| 650 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 646 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 651 const { | 647 const { |
| 652 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 648 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 653 } | 649 } |
| 654 | 650 |
| 655 } // namespace media | 651 } // namespace media |
| OLD | NEW |