| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 std::string* encoded_data, | 404 std::string* encoded_data, |
| 405 int num_NALUs_per_decode, | 405 int num_NALUs_per_decode, |
| 406 int delete_decoder_state); | 406 int delete_decoder_state); |
| 407 virtual ~EglRenderingVDAClient(); | 407 virtual ~EglRenderingVDAClient(); |
| 408 void CreateDecoder(); | 408 void CreateDecoder(); |
| 409 | 409 |
| 410 // VideoDecodeAccelerator::Client implementation. | 410 // VideoDecodeAccelerator::Client implementation. |
| 411 // The heart of the Client. | 411 // The heart of the Client. |
| 412 virtual void ProvidePictureBuffers( | 412 virtual void ProvidePictureBuffers( |
| 413 uint32 requested_num_of_buffers, | 413 uint32 requested_num_of_buffers, |
| 414 const gfx::Size& dimensions, | 414 const gfx::Size& dimensions); |
| 415 VideoDecodeAccelerator::MemoryType type); | |
| 416 virtual void DismissPictureBuffer(int32 picture_buffer_id); | 415 virtual void DismissPictureBuffer(int32 picture_buffer_id); |
| 417 virtual void PictureReady(const media::Picture& picture); | 416 virtual void PictureReady(const media::Picture& picture); |
| 418 // Simple state changes. | 417 // Simple state changes. |
| 419 virtual void NotifyInitializeDone(); | 418 virtual void NotifyInitializeDone(); |
| 420 virtual void NotifyEndOfStream(); | 419 virtual void NotifyEndOfStream(); |
| 421 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); | 420 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); |
| 422 virtual void NotifyFlushDone(); | 421 virtual void NotifyFlushDone(); |
| 423 virtual void NotifyResetDone(); | 422 virtual void NotifyResetDone(); |
| 424 virtual void NotifyError(VideoDecodeAccelerator::Error error); | 423 virtual void NotifyError(VideoDecodeAccelerator::Error error); |
| 425 | 424 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 media::VIDEOATTRIBUTEKEY_VIDEOCOLORFORMAT, media::VIDEOCOLORFORMAT_RGBA, | 504 media::VIDEOATTRIBUTEKEY_VIDEOCOLORFORMAT, media::VIDEOCOLORFORMAT_RGBA, |
| 506 }; | 505 }; |
| 507 std::vector<uint32> config( | 506 std::vector<uint32> config( |
| 508 config_array, config_array + arraysize(config_array)); | 507 config_array, config_array + arraysize(config_array)); |
| 509 CHECK(decoder_->Initialize(config)); | 508 CHECK(decoder_->Initialize(config)); |
| 510 } | 509 } |
| 511 | 510 |
| 512 | 511 |
| 513 void EglRenderingVDAClient::ProvidePictureBuffers( | 512 void EglRenderingVDAClient::ProvidePictureBuffers( |
| 514 uint32 requested_num_of_buffers, | 513 uint32 requested_num_of_buffers, |
| 515 const gfx::Size& dimensions, | 514 const gfx::Size& dimensions) { |
| 516 VideoDecodeAccelerator::MemoryType type) { | |
| 517 if (decoder_deleted()) | 515 if (decoder_deleted()) |
| 518 return; | 516 return; |
| 519 CHECK_EQ(type, VideoDecodeAccelerator::PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE); | |
| 520 std::vector<media::GLESBuffer> buffers; | 517 std::vector<media::GLESBuffer> buffers; |
| 521 CHECK_EQ(dimensions.width(), kFrameWidth); | 518 CHECK_EQ(dimensions.width(), kFrameWidth); |
| 522 CHECK_EQ(dimensions.height(), kFrameHeight); | 519 CHECK_EQ(dimensions.height(), kFrameHeight); |
| 523 | 520 |
| 524 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { | 521 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { |
| 525 uint32 id = picture_buffers_by_id_.size(); | 522 uint32 id = picture_buffers_by_id_.size(); |
| 526 GLuint texture_id; | 523 GLuint texture_id; |
| 527 base::WaitableEvent done(false, false); | 524 base::WaitableEvent done(false, false); |
| 528 rendering_helper_->CreateTexture(rendering_window_id_, &texture_id, &done); | 525 rendering_helper_->CreateTexture(rendering_window_id_, &texture_id, &done); |
| 529 done.Wait(); | 526 done.Wait(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 MakeTuple(1, kMaxSupportedNumConcurrentDecoders + 0, CS_RESET), | 859 MakeTuple(1, kMaxSupportedNumConcurrentDecoders + 0, CS_RESET), |
| 863 MakeTuple(1, kMaxSupportedNumConcurrentDecoders + 1, CS_RESET))); | 860 MakeTuple(1, kMaxSupportedNumConcurrentDecoders + 1, CS_RESET))); |
| 864 | 861 |
| 865 // TODO(fischman, vrk): add more tests! In particular: | 862 // TODO(fischman, vrk): add more tests! In particular: |
| 866 // - Test life-cycle: Seek/Stop/Pause/Play/RePlay for a single decoder. | 863 // - Test life-cycle: Seek/Stop/Pause/Play/RePlay for a single decoder. |
| 867 // - Test alternate configurations | 864 // - Test alternate configurations |
| 868 // - Test failure conditions. | 865 // - Test failure conditions. |
| 869 // - Test frame size changes mid-stream | 866 // - Test frame size changes mid-stream |
| 870 | 867 |
| 871 } // namespace | 868 } // namespace |
| OLD | NEW |