| 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 "media/gpu/fake_video_decode_accelerator.h" | 5 #include "media/gpu/fake_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 if (config.is_encrypted) { | 52 if (config.is_encrypted) { |
| 53 NOTREACHED() << "encrypted streams are not supported"; | 53 NOTREACHED() << "encrypted streams are not supported"; |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers | 57 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers |
| 58 // This class asks for it on initialization instead. | 58 // This class asks for it on initialization instead. |
| 59 client_ = client; | 59 client_ = client; |
| 60 client_->ProvidePictureBuffers(kNumBuffers, PIXEL_FORMAT_UNKNOWN, 1, | 60 client_->ProvidePictureBuffers(kNumBuffers, 1, frame_buffer_size_, |
| 61 frame_buffer_size_, kDefaultTextureTarget); | 61 kDefaultTextureTarget); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void FakeVideoDecodeAccelerator::Decode( | 65 void FakeVideoDecodeAccelerator::Decode( |
| 66 const media::BitstreamBuffer& bitstream_buffer) { | 66 const media::BitstreamBuffer& bitstream_buffer) { |
| 67 // We won't really read from the bitstream_buffer, close the handle. | 67 // We won't really read from the bitstream_buffer, close the handle. |
| 68 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) | 68 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) |
| 69 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); | 69 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); |
| 70 | 70 |
| 71 if (bitstream_buffer.id() < 0) { | 71 if (bitstream_buffer.id() < 0) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Bitstream no longer needed. | 175 // Bitstream no longer needed. |
| 176 client_->NotifyEndOfBitstreamBuffer(bitstream_id); | 176 client_->NotifyEndOfBitstreamBuffer(bitstream_id); |
| 177 if (flushing_ && queued_bitstream_ids_.empty()) { | 177 if (flushing_ && queued_bitstream_ids_.empty()) { |
| 178 flushing_ = false; | 178 flushing_ = false; |
| 179 client_->NotifyFlushDone(); | 179 client_->NotifyFlushDone(); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace media | 184 } // namespace media |
| OLD | NEW |