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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 std::unique_ptr<uint8_t[]> black_data( | 96 std::unique_ptr<uint8_t[]> black_data( |
97 new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() * | 97 new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() * |
98 4]); | 98 4]); |
99 memset(black_data.get(), 0, | 99 memset(black_data.get(), 0, |
100 frame_buffer_size_.width() * frame_buffer_size_.height() * 4); | 100 frame_buffer_size_.width() * frame_buffer_size_.height() * 4); |
101 if (!make_context_current_cb_.Run()) { | 101 if (!make_context_current_cb_.Run()) { |
102 LOG(ERROR) << "ReusePictureBuffer(): could not make context current"; | 102 LOG(ERROR) << "ReusePictureBuffer(): could not make context current"; |
103 return; | 103 return; |
104 } | 104 } |
105 for (size_t index = 0; index < buffers.size(); ++index) { | 105 for (size_t index = 0; index < buffers.size(); ++index) { |
106 DCHECK_LE(1u, buffers[index].texture_ids().size()); | 106 DCHECK_LE(1u, buffers[index].service_texture_ids().size()); |
107 glBindTexture(GL_TEXTURE_2D, buffers[index].texture_ids()[0]); | 107 glBindTexture(GL_TEXTURE_2D, buffers[index].service_texture_ids()[0]); |
108 // Every other frame white and the rest black. | 108 // Every other frame white and the rest black. |
109 uint8_t* data = index % 2 ? white_data.get() : black_data.get(); | 109 uint8_t* data = index % 2 ? white_data.get() : black_data.get(); |
110 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, frame_buffer_size_.width(), | 110 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, frame_buffer_size_.width(), |
111 frame_buffer_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, | 111 frame_buffer_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, |
112 data); | 112 data); |
113 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 113 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
114 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 114 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
115 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 115 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
116 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 116 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
117 glBindTexture(GL_TEXTURE_2D, 0); | 117 glBindTexture(GL_TEXTURE_2D, 0); |
(...skipping 57 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 |