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