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

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

Issue 808973004: GVDA, vdatest: Enable V4L2SliceVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vp8_slice_based
Patch Set: Created 5 years, 11 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
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "content/common/gpu/media/rendering_helper.h" 50 #include "content/common/gpu/media/rendering_helper.h"
51 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" 51 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h"
52 #include "content/public/common/content_switches.h" 52 #include "content/public/common/content_switches.h"
53 #include "media/filters/h264_parser.h" 53 #include "media/filters/h264_parser.h"
54 #include "ui/gfx/codec/png_codec.h" 54 #include "ui/gfx/codec/png_codec.h"
55 55
56 #if defined(OS_WIN) 56 #if defined(OS_WIN)
57 #include "base/win/windows_version.h" 57 #include "base/win/windows_version.h"
58 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 58 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
59 #elif defined(OS_CHROMEOS) 59 #elif defined(OS_CHROMEOS)
60 #if defined(ARCH_CPU_ARMEL)
61 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h"
62 #endif // defined(ARCH_CPU_ARMEL)
60 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) 63 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
61 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" 64 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
62 #include "content/common/gpu/media/v4l2_video_device.h" 65 #include "content/common/gpu/media/v4l2_video_device.h"
63 #endif 66 #endif
64 #if defined(ARCH_CPU_X86_FAMILY) 67 #if defined(ARCH_CPU_X86_FAMILY)
65 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" 68 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
66 #include "content/common/gpu/media/vaapi_wrapper.h" 69 #include "content/common/gpu/media/vaapi_wrapper.h"
67 #endif // defined(ARCH_CPU_X86_FAMILY) 70 #endif // defined(ARCH_CPU_X86_FAMILY)
68 #else 71 #else
69 #error The VideoAccelerator tests are not supported on this platform. 72 #error The VideoAccelerator tests are not supported on this platform.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 double frames_per_second(); 284 double frames_per_second();
282 // Return the median of the decode time of all decoded frames. 285 // Return the median of the decode time of all decoded frames.
283 base::TimeDelta decode_time_median(); 286 base::TimeDelta decode_time_median();
284 bool decoder_deleted() { return !decoder_.get(); } 287 bool decoder_deleted() { return !decoder_.get(); }
285 288
286 private: 289 private:
287 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; 290 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap;
288 291
289 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); 292 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA();
290 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); 293 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA();
294 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA();
291 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); 295 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA();
292 296
293 void SetState(ClientState new_state); 297 void SetState(ClientState new_state);
294 void FinishInitialization(); 298 void FinishInitialization();
295 void ReturnPicture(int32 picture_buffer_id); 299 void ReturnPicture(int32 picture_buffer_id);
296 300
297 // Delete the associated decoder helper. 301 // Delete the associated decoder helper.
298 void DeleteDecoder(); 302 void DeleteDecoder();
299 303
300 // Compute & return the first encoded bytes (including a start frame) to send 304 // Compute & return the first encoded bytes (including a start frame) to send
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 weak_client, 451 weak_client,
448 base::Bind(&DoNothingReturnTrue), 452 base::Bind(&DoNothingReturnTrue),
449 device, 453 device,
450 base::MessageLoopProxy::current())); 454 base::MessageLoopProxy::current()));
451 } 455 }
452 #endif 456 #endif
453 return decoder.Pass(); 457 return decoder.Pass();
454 } 458 }
455 459
456 scoped_ptr<media::VideoDecodeAccelerator> 460 scoped_ptr<media::VideoDecodeAccelerator>
461 GLRenderingVDAClient::CreateV4L2SliceVDA() {
wuchengli 2015/01/12 06:05:55 We have more duplication like this in GVDA and VDA
462 scoped_ptr<media::VideoDecodeAccelerator> decoder;
463 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
464 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
465 if (device.get()) {
466 base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();
467 decoder.reset(new V4L2SliceVideoDecodeAccelerator(
468 device,
469 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()),
470 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()),
471 weak_client,
472 base::Bind(&DoNothingReturnTrue),
473 base::MessageLoopProxy::current()));
474 }
475 #endif
476 return decoder.Pass();
477 }
478 scoped_ptr<media::VideoDecodeAccelerator>
457 GLRenderingVDAClient::CreateVaapiVDA() { 479 GLRenderingVDAClient::CreateVaapiVDA() {
458 scoped_ptr<media::VideoDecodeAccelerator> decoder; 480 scoped_ptr<media::VideoDecodeAccelerator> decoder;
459 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 481 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
460 decoder.reset( 482 decoder.reset(
461 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); 483 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue)));
462 #endif 484 #endif
463 return decoder.Pass(); 485 return decoder.Pass();
464 } 486 }
465 487
466 void GLRenderingVDAClient::CreateAndStartDecoder() { 488 void GLRenderingVDAClient::CreateAndStartDecoder() {
467 CHECK(decoder_deleted()); 489 CHECK(decoder_deleted());
468 CHECK(!decoder_.get()); 490 CHECK(!decoder_.get());
469 491
470 VideoDecodeAccelerator::Client* client = this; 492 VideoDecodeAccelerator::Client* client = this;
471 493
472 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { 494 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = {
473 CreateDXVAVDA(), 495 CreateDXVAVDA(),
474 CreateV4L2VDA(), 496 CreateV4L2VDA(),
475 CreateVaapiVDA() 497 CreateV4L2SliceVDA(),
498 CreateVaapiVDA(),
476 }; 499 };
477 500
478 for (size_t i = 0; i < arraysize(decoders); ++i) { 501 for (size_t i = 0; i < arraysize(decoders); ++i) {
479 if (!decoders[i]) 502 if (!decoders[i])
480 continue; 503 continue;
481 decoder_ = decoders[i].Pass(); 504 decoder_ = decoders[i].Pass();
482 weak_decoder_factory_.reset( 505 weak_decoder_factory_.reset(
483 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); 506 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get()));
484 if (decoder_->Initialize(profile_, client)) { 507 if (decoder_->Initialize(profile_, client)) {
485 SetState(CS_DECODER_SET); 508 SetState(CS_DECODER_SET);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") 1540 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless")
1518 continue; 1541 continue;
1519 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1542 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1520 } 1543 }
1521 1544
1522 base::ShadowingAtExitManager at_exit_manager; 1545 base::ShadowingAtExitManager at_exit_manager;
1523 content::RenderingHelper::InitializeOneOff(); 1546 content::RenderingHelper::InitializeOneOff();
1524 1547
1525 return RUN_ALL_TESTS(); 1548 return RUN_ALL_TESTS();
1526 } 1549 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698