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

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

Issue 848233002: Revert of 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)
63 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) 60 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC))
64 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" 61 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
65 #include "content/common/gpu/media/v4l2_video_device.h" 62 #include "content/common/gpu/media/v4l2_video_device.h"
66 #endif 63 #endif
67 #if defined(ARCH_CPU_X86_FAMILY) 64 #if defined(ARCH_CPU_X86_FAMILY)
68 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" 65 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
69 #include "content/common/gpu/media/vaapi_wrapper.h" 66 #include "content/common/gpu/media/vaapi_wrapper.h"
70 #endif // defined(ARCH_CPU_X86_FAMILY) 67 #endif // defined(ARCH_CPU_X86_FAMILY)
71 #else 68 #else
72 #error The VideoAccelerator tests are not supported on this platform. 69 #error The VideoAccelerator tests are not supported on this platform.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 double frames_per_second(); 281 double frames_per_second();
285 // Return the median of the decode time of all decoded frames. 282 // Return the median of the decode time of all decoded frames.
286 base::TimeDelta decode_time_median(); 283 base::TimeDelta decode_time_median();
287 bool decoder_deleted() { return !decoder_.get(); } 284 bool decoder_deleted() { return !decoder_.get(); }
288 285
289 private: 286 private:
290 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; 287 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap;
291 288
292 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); 289 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA();
293 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); 290 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA();
294 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA();
295 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); 291 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA();
296 292
297 void SetState(ClientState new_state); 293 void SetState(ClientState new_state);
298 void FinishInitialization(); 294 void FinishInitialization();
299 void ReturnPicture(int32 picture_buffer_id); 295 void ReturnPicture(int32 picture_buffer_id);
300 296
301 // Delete the associated decoder helper. 297 // Delete the associated decoder helper.
302 void DeleteDecoder(); 298 void DeleteDecoder();
303 299
304 // Compute & return the first encoded bytes (including a start frame) to send 300 // Compute & return the first encoded bytes (including a start frame) to send
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 weak_client, 447 weak_client,
452 base::Bind(&DoNothingReturnTrue), 448 base::Bind(&DoNothingReturnTrue),
453 device, 449 device,
454 base::MessageLoopProxy::current())); 450 base::MessageLoopProxy::current()));
455 } 451 }
456 #endif 452 #endif
457 return decoder.Pass(); 453 return decoder.Pass();
458 } 454 }
459 455
460 scoped_ptr<media::VideoDecodeAccelerator> 456 scoped_ptr<media::VideoDecodeAccelerator>
461 GLRenderingVDAClient::CreateV4L2SliceVDA() {
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>
479 GLRenderingVDAClient::CreateVaapiVDA() { 457 GLRenderingVDAClient::CreateVaapiVDA() {
480 scoped_ptr<media::VideoDecodeAccelerator> decoder; 458 scoped_ptr<media::VideoDecodeAccelerator> decoder;
481 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 459 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
482 decoder.reset( 460 decoder.reset(
483 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); 461 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue)));
484 #endif 462 #endif
485 return decoder.Pass(); 463 return decoder.Pass();
486 } 464 }
487 465
488 void GLRenderingVDAClient::CreateAndStartDecoder() { 466 void GLRenderingVDAClient::CreateAndStartDecoder() {
489 CHECK(decoder_deleted()); 467 CHECK(decoder_deleted());
490 CHECK(!decoder_.get()); 468 CHECK(!decoder_.get());
491 469
492 VideoDecodeAccelerator::Client* client = this; 470 VideoDecodeAccelerator::Client* client = this;
493 471
494 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { 472 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = {
495 CreateDXVAVDA(), 473 CreateDXVAVDA(),
496 CreateV4L2VDA(), 474 CreateV4L2VDA(),
497 CreateV4L2SliceVDA(), 475 CreateVaapiVDA()
498 CreateVaapiVDA(),
499 }; 476 };
500 477
501 for (size_t i = 0; i < arraysize(decoders); ++i) { 478 for (size_t i = 0; i < arraysize(decoders); ++i) {
502 if (!decoders[i]) 479 if (!decoders[i])
503 continue; 480 continue;
504 decoder_ = decoders[i].Pass(); 481 decoder_ = decoders[i].Pass();
505 weak_decoder_factory_.reset( 482 weak_decoder_factory_.reset(
506 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get())); 483 new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get()));
507 if (decoder_->Initialize(profile_, client)) { 484 if (decoder_->Initialize(profile_, client)) {
508 SetState(CS_DECODER_SET); 485 SetState(CS_DECODER_SET);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") 1517 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless")
1541 continue; 1518 continue;
1542 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1519 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1543 } 1520 }
1544 1521
1545 base::ShadowingAtExitManager at_exit_manager; 1522 base::ShadowingAtExitManager at_exit_manager;
1546 content::RenderingHelper::InitializeOneOff(); 1523 content::RenderingHelper::InitializeOneOff();
1547 1524
1548 return RUN_ALL_TESTS(); 1525 return RUN_ALL_TESTS();
1549 } 1526 }
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