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/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
8 // Win/EGL. | 8 // Win/EGL. |
9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 STLDeleteValues(&picture_buffers_by_id_); | 310 STLDeleteValues(&picture_buffers_by_id_); |
311 SetState(CS_DESTROYED); | 311 SetState(CS_DESTROYED); |
312 } | 312 } |
313 | 313 |
314 #if !defined(OS_WIN) && !defined(OS_MACOSX) && defined(ARCH_CPU_X86_FAMILY) | 314 #if !defined(OS_WIN) && !defined(OS_MACOSX) && defined(ARCH_CPU_X86_FAMILY) |
315 static bool DoNothingReturnTrue() { return true; } | 315 static bool DoNothingReturnTrue() { return true; } |
316 #endif | 316 #endif |
317 | 317 |
318 void GLRenderingVDAClient::CreateDecoder() { | 318 void GLRenderingVDAClient::CreateDecoder() { |
319 CHECK(decoder_deleted()); | 319 CHECK(decoder_deleted()); |
| 320 CHECK(!decoder_.get()); |
320 #if defined(OS_WIN) | 321 #if defined(OS_WIN) |
321 scoped_ptr<DXVAVideoDecodeAccelerator> decoder( | 322 decoder_.reset(new DXVAVideoDecodeAccelerator(this)); |
322 new DXVAVideoDecodeAccelerator(this)); | |
323 #elif defined(OS_MACOSX) | 323 #elif defined(OS_MACOSX) |
324 scoped_ptr<MacVideoDecodeAccelerator> decoder( | 324 decoder_.reset(new MacVideoDecodeAccelerator( |
325 new MacVideoDecodeAccelerator(this)); | 325 static_cast<CGLContextObj>(rendering_helper_->GetGLContext()), this)); |
326 decoder->SetCGLContext( | |
327 static_cast<CGLContextObj>(rendering_helper_->GetGLContext())); | |
328 #elif defined(ARCH_CPU_ARMEL) | 326 #elif defined(ARCH_CPU_ARMEL) |
329 scoped_ptr<OmxVideoDecodeAccelerator> decoder( | 327 decoder_.reset( |
330 new OmxVideoDecodeAccelerator(this)); | 328 new OmxVideoDecodeAccelerator( |
331 decoder->SetEglState( | 329 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
332 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 330 static_cast<EGLContext>(rendering_helper_->GetGLContext()), |
333 static_cast<EGLContext>(rendering_helper_->GetGLContext())); | 331 this)); |
334 #elif defined(ARCH_CPU_X86_FAMILY) | 332 #elif defined(ARCH_CPU_X86_FAMILY) |
335 scoped_ptr<VaapiVideoDecodeAccelerator> decoder( | 333 decoder_.reset(new VaapiVideoDecodeAccelerator( |
336 new VaapiVideoDecodeAccelerator(this, base::Bind(&DoNothingReturnTrue))); | |
337 decoder->SetGlxState( | |
338 static_cast<Display*>(rendering_helper_->GetGLDisplay()), | 334 static_cast<Display*>(rendering_helper_->GetGLDisplay()), |
339 static_cast<GLXContext>(rendering_helper_->GetGLContext())); | 335 static_cast<GLXContext>(rendering_helper_->GetGLContext()), |
| 336 this, base::Bind(&DoNothingReturnTrue))); |
340 #endif // OS_WIN | 337 #endif // OS_WIN |
341 decoder_ = decoder.Pass(); | 338 CHECK(decoder_.get()); |
342 SetState(CS_DECODER_SET); | 339 SetState(CS_DECODER_SET); |
343 if (decoder_deleted()) | 340 if (decoder_deleted()) |
344 return; | 341 return; |
345 | 342 |
346 // Configure the decoder. | 343 // Configure the decoder. |
347 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 344 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
348 if (profile_ != -1) | 345 if (profile_ != -1) |
349 profile = static_cast<media::VideoCodecProfile>(profile_); | 346 profile = static_cast<media::VideoCodecProfile>(profile_); |
350 CHECK(decoder_->Initialize(profile)); | 347 CHECK(decoder_->Initialize(profile)); |
351 } | 348 } |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 886 |
890 base::ShadowingAtExitManager at_exit_manager; | 887 base::ShadowingAtExitManager at_exit_manager; |
891 RenderingHelper::InitializePlatform(); | 888 RenderingHelper::InitializePlatform(); |
892 | 889 |
893 #if defined(OS_WIN) | 890 #if defined(OS_WIN) |
894 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 891 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
895 #endif | 892 #endif |
896 | 893 |
897 return RUN_ALL_TESTS(); | 894 return RUN_ALL_TESTS(); |
898 } | 895 } |
OLD | NEW |