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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. | 7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. |
8 // - ClientState is an enum for the state of the decode client used by the test. | 8 // - ClientState is an enum for the state of the decode client used by the test. |
9 // - ClientStateNotification is a barrier abstraction that allows the test code | 9 // - ClientStateNotification is a barrier abstraction that allows the test code |
10 // to be written sequentially and wait for the decode client to see certain | 10 // to be written sequentially and wait for the decode client to see certain |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 int reset_after_frame_num, | 197 int reset_after_frame_num, |
198 int delete_decoder_state, | 198 int delete_decoder_state, |
199 int frame_width, | 199 int frame_width, |
200 int frame_height, | 200 int frame_height, |
201 int profile); | 201 int profile); |
202 virtual ~EglRenderingVDAClient(); | 202 virtual ~EglRenderingVDAClient(); |
203 void CreateDecoder(); | 203 void CreateDecoder(); |
204 | 204 |
205 // VideoDecodeAccelerator::Client implementation. | 205 // VideoDecodeAccelerator::Client implementation. |
206 // The heart of the Client. | 206 // The heart of the Client. |
207 virtual void ProvidePictureBuffers( | 207 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
208 uint32 requested_num_of_buffers, | 208 const gfx::Size& dimensions, |
209 const gfx::Size& dimensions); | 209 uint32 texture_target); |
210 virtual void DismissPictureBuffer(int32 picture_buffer_id); | 210 virtual void DismissPictureBuffer(int32 picture_buffer_id); |
211 virtual void PictureReady(const media::Picture& picture); | 211 virtual void PictureReady(const media::Picture& picture); |
212 // Simple state changes. | 212 // Simple state changes. |
213 virtual void NotifyInitializeDone(); | 213 virtual void NotifyInitializeDone(); |
214 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); | 214 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); |
215 virtual void NotifyFlushDone(); | 215 virtual void NotifyFlushDone(); |
216 virtual void NotifyResetDone(); | 216 virtual void NotifyResetDone(); |
217 virtual void NotifyError(VideoDecodeAccelerator::Error error); | 217 virtual void NotifyError(VideoDecodeAccelerator::Error error); |
218 | 218 |
219 // Simple getters for inspecting the state of the Client. | 219 // Simple getters for inspecting the state of the Client. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 326 |
327 // Configure the decoder. | 327 // Configure the decoder. |
328 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 328 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
329 if (profile_ != -1) | 329 if (profile_ != -1) |
330 profile = static_cast<media::VideoCodecProfile>(profile_); | 330 profile = static_cast<media::VideoCodecProfile>(profile_); |
331 CHECK(decoder_->Initialize(profile)); | 331 CHECK(decoder_->Initialize(profile)); |
332 } | 332 } |
333 | 333 |
334 void EglRenderingVDAClient::ProvidePictureBuffers( | 334 void EglRenderingVDAClient::ProvidePictureBuffers( |
335 uint32 requested_num_of_buffers, | 335 uint32 requested_num_of_buffers, |
336 const gfx::Size& dimensions) { | 336 const gfx::Size& dimensions, |
| 337 uint32 texture_target) { |
337 if (decoder_deleted()) | 338 if (decoder_deleted()) |
338 return; | 339 return; |
339 std::vector<media::PictureBuffer> buffers; | 340 std::vector<media::PictureBuffer> buffers; |
340 | 341 |
341 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { | 342 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { |
342 uint32 id = picture_buffers_by_id_.size(); | 343 uint32 id = picture_buffers_by_id_.size(); |
343 uint32 texture_id; | 344 uint32 texture_id; |
344 base::WaitableEvent done(false, false); | 345 base::WaitableEvent done(false, false); |
345 rendering_helper_->CreateTexture(rendering_window_id_, &texture_id, &done); | 346 rendering_helper_->CreateTexture( |
| 347 rendering_window_id_, texture_target, &texture_id, &done); |
346 done.Wait(); | 348 done.Wait(); |
347 CHECK(outstanding_texture_ids_.insert(texture_id).second); | 349 CHECK(outstanding_texture_ids_.insert(texture_id).second); |
348 media::PictureBuffer* buffer = | 350 media::PictureBuffer* buffer = |
349 new media::PictureBuffer(id, dimensions, texture_id); | 351 new media::PictureBuffer(id, dimensions, texture_id); |
350 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); | 352 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
351 buffers.push_back(*buffer); | 353 buffers.push_back(*buffer); |
352 } | 354 } |
353 decoder_->AssignPictureBuffers(buffers); | 355 decoder_->AssignPictureBuffers(buffers); |
354 } | 356 } |
355 | 357 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 816 |
815 base::ShadowingAtExitManager at_exit_manager; | 817 base::ShadowingAtExitManager at_exit_manager; |
816 RenderingHelper::InitializePlatform(); | 818 RenderingHelper::InitializePlatform(); |
817 | 819 |
818 #if defined(OS_WIN) | 820 #if defined(OS_WIN) |
819 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 821 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
820 #endif | 822 #endif |
821 | 823 |
822 return RUN_ALL_TESTS(); | 824 return RUN_ALL_TESTS(); |
823 } | 825 } |
OLD | NEW |