| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 // Configure the decoder. | 326 // Configure the decoder. |
| 327 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 327 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
| 328 if (profile_ != -1) | 328 if (profile_ != -1) |
| 329 profile = static_cast<media::VideoCodecProfile>(profile_); | 329 profile = static_cast<media::VideoCodecProfile>(profile_); |
| 330 CHECK(decoder_->Initialize(profile)); | 330 CHECK(decoder_->Initialize(profile)); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void EglRenderingVDAClient::ProvidePictureBuffers( | 333 void EglRenderingVDAClient::ProvidePictureBuffers( |
| 334 uint32 requested_num_of_buffers, | 334 uint32 requested_num_of_buffers, |
| 335 const gfx::Size& dimensions) { | 335 const gfx::Size& dimensions, |
| 336 uint32 texture_target) { |
| 336 if (decoder_deleted()) | 337 if (decoder_deleted()) |
| 337 return; | 338 return; |
| 338 std::vector<media::PictureBuffer> buffers; | 339 std::vector<media::PictureBuffer> buffers; |
| 339 | 340 |
| 340 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { | 341 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { |
| 341 uint32 id = picture_buffers_by_id_.size(); | 342 uint32 id = picture_buffers_by_id_.size(); |
| 342 uint32 texture_id; | 343 uint32 texture_id; |
| 343 base::WaitableEvent done(false, false); | 344 base::WaitableEvent done(false, false); |
| 344 rendering_helper_->CreateTexture(rendering_window_id_, &texture_id, &done); | 345 rendering_helper_->CreateTexture( |
| 346 rendering_window_id_, texture_target, &texture_id, &done); |
| 345 done.Wait(); | 347 done.Wait(); |
| 346 CHECK(outstanding_texture_ids_.insert(texture_id).second); | 348 CHECK(outstanding_texture_ids_.insert(texture_id).second); |
| 347 media::PictureBuffer* buffer = | 349 media::PictureBuffer* buffer = |
| 348 new media::PictureBuffer(id, dimensions, texture_id); | 350 new media::PictureBuffer(id, dimensions, texture_id); |
| 349 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); | 351 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
| 350 buffers.push_back(*buffer); | 352 buffers.push_back(*buffer); |
| 351 } | 353 } |
| 352 decoder_->AssignPictureBuffers(buffers); | 354 decoder_->AssignPictureBuffers(buffers); |
| 353 } | 355 } |
| 354 | 356 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 819 |
| 818 base::ShadowingAtExitManager at_exit_manager; | 820 base::ShadowingAtExitManager at_exit_manager; |
| 819 RenderingHelper::InitializePlatform(); | 821 RenderingHelper::InitializePlatform(); |
| 820 | 822 |
| 821 #if defined(OS_WIN) | 823 #if defined(OS_WIN) |
| 822 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 824 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| 823 #endif | 825 #endif |
| 824 | 826 |
| 825 return RUN_ALL_TESTS(); | 827 return RUN_ALL_TESTS(); |
| 826 } | 828 } |
| OLD | NEW |