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

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() > 1920 && max_resolution.height() > 1088)
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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() {
2504 SupportedProfiles profiles;
2505 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); 2505 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
2506 if (!device) 2506 if (!device)
2507 return profiles; 2507 return SupportedProfiles();
2508 2508
2509 SupportedProfile profile; 2509 uint32_t supported_formats[] = {
Pawel Osciak 2015/04/24 05:55:51 static const?
henryhsu 2015/04/24 07:07:29 Since this function is only called once, I think c
2510 profile.min_resolution.SetSize(16, 16); 2510 V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME};
piman 2015/04/27 23:00:29 nit: } on next line
2511 // NOTE: additional autodetection logic may require updating input buffer size 2511 return device->GetSupportedDecodeProfiles(arraysize(supported_formats),
2512 // selection. 2512 supported_formats);
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;
2520 memset(&fmtdesc, 0, sizeof(fmtdesc));
2521 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
2522 for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
2523 switch (fmtdesc.pixelformat) {
2524 case V4L2_PIX_FMT_H264_SLICE:
2525 for (uint32 media_profile = media::H264PROFILE_MIN;
2526 media_profile <= media::H264PROFILE_MAX; ++media_profile) {
2527 profile.profile =
2528 static_cast<media::VideoCodecProfile>(media_profile);
2529 profiles.push_back(profile);
2530 }
2531 break;
2532 case V4L2_PIX_FMT_VP8_FRAME:
2533 profile.profile = media::VP8PROFILE_ANY;
2534 profiles.push_back(profile);
2535 break;
2536 }
2537 }
2538
2539 return profiles;
2540 } 2513 }
2541 2514
2542 } // namespace content 2515 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698