| 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 "content/common/gpu/media/fake_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/fake_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "media/base/bitstream_buffer.h" | 10 #include "media/base/bitstream_buffer.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 gl_(gl), | 35 gl_(gl), |
| 36 frame_buffer_size_(size), | 36 frame_buffer_size_(size), |
| 37 flushing_(false), | 37 flushing_(false), |
| 38 weak_this_factory_(this) { | 38 weak_this_factory_(this) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() { | 41 FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool FakeVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 44 bool FakeVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| 45 uint32 min_picture_count, |
| 45 Client* client) { | 46 Client* client) { |
| 46 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 47 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 47 if (profile == media::VIDEO_CODEC_PROFILE_UNKNOWN) { | 48 if (profile == media::VIDEO_CODEC_PROFILE_UNKNOWN) { |
| 48 LOG(ERROR) << "unknown codec profile"; | 49 LOG(ERROR) << "unknown codec profile"; |
| 49 return false; | 50 return false; |
| 50 } | 51 } |
| 51 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers | 52 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers |
| 52 // This class asks for it on initialization instead. | 53 // This class asks for it on initialization instead. |
| 53 client_ = client; | 54 client_ = client; |
| 54 client_->ProvidePictureBuffers(kNumBuffers, | 55 client_->ProvidePictureBuffers(std::max(min_picture_count, |
| 56 static_cast<uint32>(kNumBuffers)), |
| 55 frame_buffer_size_, | 57 frame_buffer_size_, |
| 56 kDefaultTextureTarget); | 58 kDefaultTextureTarget); |
| 57 return true; | 59 return true; |
| 58 } | 60 } |
| 59 | 61 |
| 60 void FakeVideoDecodeAccelerator::Decode( | 62 void FakeVideoDecodeAccelerator::Decode( |
| 61 const media::BitstreamBuffer& bitstream_buffer) { | 63 const media::BitstreamBuffer& bitstream_buffer) { |
| 62 int bitstream_buffer_id = bitstream_buffer.id(); | 64 int bitstream_buffer_id = bitstream_buffer.id(); |
| 63 queued_bitstream_ids_.push(bitstream_buffer_id); | 65 queued_bitstream_ids_.push(bitstream_buffer_id); |
| 64 child_task_runner_->PostTask( | 66 child_task_runner_->PostTask( |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Bitstream no longer needed. | 168 // Bitstream no longer needed. |
| 167 client_->NotifyEndOfBitstreamBuffer(bitstream_id); | 169 client_->NotifyEndOfBitstreamBuffer(bitstream_id); |
| 168 if (flushing_ && queued_bitstream_ids_.empty()) { | 170 if (flushing_ && queued_bitstream_ids_.empty()) { |
| 169 flushing_ = false; | 171 flushing_ = false; |
| 170 client_->NotifyFlushDone(); | 172 client_->NotifyFlushDone(); |
| 171 } | 173 } |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace content | 177 } // namespace content |
| OLD | NEW |