Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: content/common/gpu/media/fake_video_decode_accelerator.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return false; 52 return false;
53 } 53 }
54 if (config.is_encrypted) { 54 if (config.is_encrypted) {
55 NOTREACHED() << "encrypted streams are not supported"; 55 NOTREACHED() << "encrypted streams are not supported";
56 return false; 56 return false;
57 } 57 }
58 58
59 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers 59 // V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers
60 // This class asks for it on initialization instead. 60 // This class asks for it on initialization instead.
61 client_ = client; 61 client_ = client;
62 client_->ProvidePictureBuffers(kNumBuffers, 62 client_->ProvidePictureBuffers(kNumBuffers, 1, frame_buffer_size_,
63 frame_buffer_size_,
64 kDefaultTextureTarget); 63 kDefaultTextureTarget);
65 return true; 64 return true;
66 } 65 }
67 66
68 void FakeVideoDecodeAccelerator::Decode( 67 void FakeVideoDecodeAccelerator::Decode(
69 const media::BitstreamBuffer& bitstream_buffer) { 68 const media::BitstreamBuffer& bitstream_buffer) {
70 // We won't really read from the bitstream_buffer, close the handle. 69 // We won't really read from the bitstream_buffer, close the handle.
71 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) 70 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle()))
72 base::SharedMemory::CloseHandle(bitstream_buffer.handle()); 71 base::SharedMemory::CloseHandle(bitstream_buffer.handle());
73 72
(...skipping 27 matching lines...) Expand all
101 new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() * 100 new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() *
102 4]); 101 4]);
103 memset(black_data.get(), 102 memset(black_data.get(),
104 0, 103 0,
105 frame_buffer_size_.width() * frame_buffer_size_.height() * 4); 104 frame_buffer_size_.width() * frame_buffer_size_.height() * 4);
106 if (!make_context_current_.Run()) { 105 if (!make_context_current_.Run()) {
107 LOG(ERROR) << "ReusePictureBuffer(): could not make context current"; 106 LOG(ERROR) << "ReusePictureBuffer(): could not make context current";
108 return; 107 return;
109 } 108 }
110 for (size_t index = 0; index < buffers.size(); ++index) { 109 for (size_t index = 0; index < buffers.size(); ++index) {
111 glBindTexture(GL_TEXTURE_2D, buffers[index].texture_id()); 110 DCHECK_LE(1u, buffers[index].texture_ids().size());
111 glBindTexture(GL_TEXTURE_2D, buffers[index].texture_ids()[0]);
112 // Every other frame white and the rest black. 112 // Every other frame white and the rest black.
113 uint8_t* data = index % 2 ? white_data.get() : black_data.get(); 113 uint8_t* data = index % 2 ? white_data.get() : black_data.get();
114 glTexImage2D(GL_TEXTURE_2D, 114 glTexImage2D(GL_TEXTURE_2D,
115 0, 115 0,
116 GL_RGBA, 116 GL_RGBA,
117 frame_buffer_size_.width(), 117 frame_buffer_size_.width(),
118 frame_buffer_size_.height(), 118 frame_buffer_size_.height(),
119 0, 119 0,
120 GL_RGBA, 120 GL_RGBA,
121 GL_UNSIGNED_BYTE, 121 GL_UNSIGNED_BYTE,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Bitstream no longer needed. 186 // Bitstream no longer needed.
187 client_->NotifyEndOfBitstreamBuffer(bitstream_id); 187 client_->NotifyEndOfBitstreamBuffer(bitstream_id);
188 if (flushing_ && queued_bitstream_ids_.empty()) { 188 if (flushing_ && queued_bitstream_ids_.empty()) {
189 flushing_ = false; 189 flushing_ = false;
190 client_->NotifyFlushDone(); 190 client_->NotifyFlushDone();
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 } // namespace content 195 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator_win.cc ('k') | content/common/gpu/media/gpu_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698