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

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

Issue 10392141: Plumb texture target to VideoDecodeAccelerator::Client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 int frame_width, 209 int frame_width,
210 int frame_height, 210 int frame_height,
211 int profile); 211 int profile);
212 virtual ~EglRenderingVDAClient(); 212 virtual ~EglRenderingVDAClient();
213 void CreateDecoder(); 213 void CreateDecoder();
214 214
215 // VideoDecodeAccelerator::Client implementation. 215 // VideoDecodeAccelerator::Client implementation.
216 // The heart of the Client. 216 // The heart of the Client.
217 virtual void ProvidePictureBuffers( 217 virtual void ProvidePictureBuffers(
218 uint32 requested_num_of_buffers, 218 uint32 requested_num_of_buffers,
219 const gfx::Size& dimensions); 219 const gfx::Size& dimensions,
220 media::VideoDecodeAccelerator::TextureTarget texture_target);
220 virtual void DismissPictureBuffer(int32 picture_buffer_id); 221 virtual void DismissPictureBuffer(int32 picture_buffer_id);
221 virtual void PictureReady(const media::Picture& picture); 222 virtual void PictureReady(const media::Picture& picture);
222 // Simple state changes. 223 // Simple state changes.
223 virtual void NotifyInitializeDone(); 224 virtual void NotifyInitializeDone();
224 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); 225 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id);
225 virtual void NotifyFlushDone(); 226 virtual void NotifyFlushDone();
226 virtual void NotifyResetDone(); 227 virtual void NotifyResetDone();
227 virtual void NotifyError(VideoDecodeAccelerator::Error error); 228 virtual void NotifyError(VideoDecodeAccelerator::Error error);
228 229
229 // Simple getters for inspecting the state of the Client. 230 // Simple getters for inspecting the state of the Client.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Configure the decoder. 337 // Configure the decoder.
337 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; 338 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE;
338 if (profile_ != -1) 339 if (profile_ != -1)
339 profile = static_cast<media::VideoCodecProfile>(profile_); 340 profile = static_cast<media::VideoCodecProfile>(profile_);
340 std::vector<uint8_t> avc_data(MP4_EXTRA_DATA, 341 std::vector<uint8_t> avc_data(MP4_EXTRA_DATA,
341 MP4_EXTRA_DATA + arraysize(MP4_EXTRA_DATA)); 342 MP4_EXTRA_DATA + arraysize(MP4_EXTRA_DATA));
342 CHECK(decoder_->Initialize( 343 CHECK(decoder_->Initialize(
343 profile, gfx::Size(frame_width_, frame_height_), avc_data)); 344 profile, gfx::Size(frame_width_, frame_height_), avc_data));
344 } 345 }
345 346
347 static int ToGLTextureTarget(
Ami GONE FROM CHROMIUM 2012/05/23 23:42:33 Hopefully can drop.
sail 2012/05/29 18:58:09 Done.
348 media::VideoDecodeAccelerator::TextureTarget texture_target) {
349 switch (texture_target) {
350 case media::VideoDecodeAccelerator::TEXTURE_TARGET_2D:
351 return GL_TEXTURE_2D;
352 case media::VideoDecodeAccelerator::TEXTURE_TARGET_ARB:
353 return GL_TEXTURE_RECTANGLE_ARB;
354 }
355 NOTREACHED();
356 return GL_TEXTURE_2D;
357 }
358
346 void EglRenderingVDAClient::ProvidePictureBuffers( 359 void EglRenderingVDAClient::ProvidePictureBuffers(
347 uint32 requested_num_of_buffers, 360 uint32 requested_num_of_buffers,
348 const gfx::Size& dimensions) { 361 const gfx::Size& dimensions,
362 media::VideoDecodeAccelerator::TextureTarget texture_target) {
349 if (decoder_deleted()) 363 if (decoder_deleted())
350 return; 364 return;
351 std::vector<media::PictureBuffer> buffers; 365 std::vector<media::PictureBuffer> buffers;
352 366
353 for (uint32 i = 0; i < requested_num_of_buffers; ++i) { 367 for (uint32 i = 0; i < requested_num_of_buffers; ++i) {
354 uint32 id = picture_buffers_by_id_.size(); 368 uint32 id = picture_buffers_by_id_.size();
355 uint32 texture_id; 369 uint32 texture_id;
356 base::WaitableEvent done(false, false); 370 base::WaitableEvent done(false, false);
357 rendering_helper_->CreateTexture(rendering_window_id_, &texture_id, &done); 371 rendering_helper_->CreateTexture(
372 rendering_window_id_, ToGLTextureTarget(texture_target), &texture_id,
373 &done);
358 done.Wait(); 374 done.Wait();
359 CHECK(outstanding_texture_ids_.insert(texture_id).second); 375 CHECK(outstanding_texture_ids_.insert(texture_id).second);
360 media::PictureBuffer* buffer = 376 media::PictureBuffer* buffer =
361 new media::PictureBuffer(id, dimensions, texture_id); 377 new media::PictureBuffer(id, dimensions, texture_id);
362 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second); 378 CHECK(picture_buffers_by_id_.insert(std::make_pair(id, buffer)).second);
363 buffers.push_back(*buffer); 379 buffers.push_back(*buffer);
364 } 380 }
365 decoder_->AssignPictureBuffers(buffers); 381 decoder_->AssignPictureBuffers(buffers);
366 } 382 }
367 383
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 846
831 base::ShadowingAtExitManager at_exit_manager; 847 base::ShadowingAtExitManager at_exit_manager;
832 RenderingHelper::InitializePlatform(); 848 RenderingHelper::InitializePlatform();
833 849
834 #if defined(OS_WIN) 850 #if defined(OS_WIN)
835 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); 851 DXVAVideoDecodeAccelerator::PreSandboxInitialization();
836 #endif 852 #endif
837 853
838 return RUN_ALL_TESTS(); 854 return RUN_ALL_TESTS();
839 } 855 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698