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

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

Issue 1097913002: Remove kIgnoreResolutionLimitsForAcceleratedVideoDecode flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <poll.h> 7 #include <poll.h>
8 #include <sys/eventfd.h> 8 #include <sys/eventfd.h>
9 #include <sys/ioctl.h> 9 #include <sys/ioctl.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 DCHECK_EQ(state_, kUninitialized); 569 DCHECK_EQ(state_, kUninitialized);
570 570
571 __u32 input_format_fourcc = 571 __u32 input_format_fourcc =
572 V4L2Device::VideoCodecProfileToV4L2PixFmt(video_profile_, true); 572 V4L2Device::VideoCodecProfileToV4L2PixFmt(video_profile_, true);
573 if (!input_format_fourcc) { 573 if (!input_format_fourcc) {
574 NOTREACHED(); 574 NOTREACHED();
575 return false; 575 return false;
576 } 576 }
577 577
578 size_t input_size; 578 size_t input_size;
579 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 579 gfx::Size max_resolution = device_->GetMaxSupportedResolution(
580 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode)) 580 input_format_fourcc);
581 if (max_resolution.width() >= 4096 && max_resolution.height() >= 2160)
Pawel Osciak 2015/04/22 08:50:55 This should be > 1080p, not > 4k.
henryhsu 2015/04/23 03:56:43 Done.
581 input_size = kInputBufferMaxSizeFor4k; 582 input_size = kInputBufferMaxSizeFor4k;
582 else 583 else
583 input_size = kInputBufferMaxSizeFor1080p; 584 input_size = kInputBufferMaxSizeFor1080p;
584 585
585 struct v4l2_format format; 586 struct v4l2_format format;
586 memset(&format, 0, sizeof(format)); 587 memset(&format, 0, sizeof(format));
587 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; 588 format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
588 format.fmt.pix_mp.pixelformat = input_format_fourcc; 589 format.fmt.pix_mp.pixelformat = input_format_fourcc;
589 format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size; 590 format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size;
590 format.fmt.pix_mp.num_planes = input_planes_count_; 591 format.fmt.pix_mp.num_planes = input_planes_count_;
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 picture_clearing_count_--; 2494 picture_clearing_count_--;
2494 SendPictureReady(); 2495 SendPictureReady();
2495 } 2496 }
2496 2497
2497 bool V4L2SliceVideoDecodeAccelerator::CanDecodeOnIOThread() { 2498 bool V4L2SliceVideoDecodeAccelerator::CanDecodeOnIOThread() {
2498 return true; 2499 return true;
2499 } 2500 }
2500 2501
2501 // static 2502 // static
2502 media::VideoDecodeAccelerator::SupportedProfiles 2503 media::VideoDecodeAccelerator::SupportedProfiles
2503 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { 2504 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() {
Pawel Osciak 2015/04/22 08:50:55 Could this method be unified with V4L2VDA::GetSupp
henryhsu 2015/04/23 03:56:43 Done.
2504 SupportedProfiles profiles; 2505 SupportedProfiles profiles;
2505 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); 2506 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
2506 if (!device) 2507 if (!device)
2507 return profiles; 2508 return profiles;
2508 2509
2509 SupportedProfile profile; 2510 SupportedProfile profile;
2510 profile.min_resolution.SetSize(16, 16); 2511 profile.min_resolution.SetSize(16, 16);
2511 // NOTE: additional autodetection logic may require updating input buffer size
2512 // selection.
2513 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2514 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode))
2515 profile.max_resolution.SetSize(4096, 2160);
2516 else
2517 profile.max_resolution.SetSize(1920, 1088);
2518
2519 v4l2_fmtdesc fmtdesc; 2512 v4l2_fmtdesc fmtdesc;
2520 memset(&fmtdesc, 0, sizeof(fmtdesc)); 2513 memset(&fmtdesc, 0, sizeof(fmtdesc));
2521 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; 2514 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
2522 for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) { 2515 for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
2516 // Get maximum resolution for each format
Pawel Osciak 2015/04/22 08:50:56 I feel this comment doesn't really add anything, t
henryhsu 2015/04/23 03:56:43 Done.
2517 profile.max_resolution = device->GetMaxSupportedResolution(
2518 fmtdesc.pixelformat);
2523 switch (fmtdesc.pixelformat) { 2519 switch (fmtdesc.pixelformat) {
2524 case V4L2_PIX_FMT_H264_SLICE: 2520 case V4L2_PIX_FMT_H264_SLICE:
2525 for (uint32 media_profile = media::H264PROFILE_MIN; 2521 for (uint32 media_profile = media::H264PROFILE_MIN;
2526 media_profile <= media::H264PROFILE_MAX; ++media_profile) { 2522 media_profile <= media::H264PROFILE_MAX; ++media_profile) {
2527 profile.profile = 2523 profile.profile =
2528 static_cast<media::VideoCodecProfile>(media_profile); 2524 static_cast<media::VideoCodecProfile>(media_profile);
2529 profiles.push_back(profile); 2525 profiles.push_back(profile);
2530 } 2526 }
2531 break; 2527 break;
2532 case V4L2_PIX_FMT_VP8_FRAME: 2528 case V4L2_PIX_FMT_VP8_FRAME:
2533 profile.profile = media::VP8PROFILE_ANY; 2529 profile.profile = media::VP8PROFILE_ANY;
2534 profiles.push_back(profile); 2530 profiles.push_back(profile);
2535 break; 2531 break;
2536 } 2532 }
2537 } 2533 }
2538 2534
2539 return profiles; 2535 return profiles;
2540 } 2536 }
2541 2537
2542 } // namespace content 2538 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698