OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const media::Picture& picture) | 151 const media::Picture& picture) |
152 : cleared(cleared), picture(picture) {} | 152 : cleared(cleared), picture(picture) {} |
153 | 153 |
154 V4L2VideoDecodeAccelerator::PictureRecord::~PictureRecord() {} | 154 V4L2VideoDecodeAccelerator::PictureRecord::~PictureRecord() {} |
155 | 155 |
156 V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator( | 156 V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator( |
157 EGLDisplay egl_display, | 157 EGLDisplay egl_display, |
158 EGLContext egl_context, | 158 EGLContext egl_context, |
159 const base::WeakPtr<Client>& io_client, | 159 const base::WeakPtr<Client>& io_client, |
160 const base::Callback<bool(void)>& make_context_current, | 160 const base::Callback<bool(void)>& make_context_current, |
161 const scoped_refptr<V4L2Device>& device, | 161 scoped_ptr<V4L2Device> device, |
162 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | 162 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) |
163 : child_message_loop_proxy_(base::MessageLoopProxy::current()), | 163 : child_message_loop_proxy_(base::MessageLoopProxy::current()), |
164 io_message_loop_proxy_(io_message_loop_proxy), | 164 io_message_loop_proxy_(io_message_loop_proxy), |
165 io_client_(io_client), | 165 io_client_(io_client), |
166 decoder_thread_("V4L2DecoderThread"), | 166 decoder_thread_("V4L2DecoderThread"), |
167 decoder_state_(kUninitialized), | 167 decoder_state_(kUninitialized), |
168 device_(device), | 168 device_(device.Pass()), |
169 decoder_delay_bitstream_buffer_id_(-1), | 169 decoder_delay_bitstream_buffer_id_(-1), |
170 decoder_current_input_buffer_(-1), | 170 decoder_current_input_buffer_(-1), |
171 decoder_decode_buffer_tasks_scheduled_(0), | 171 decoder_decode_buffer_tasks_scheduled_(0), |
172 decoder_frames_at_client_(0), | 172 decoder_frames_at_client_(0), |
173 decoder_flushing_(false), | 173 decoder_flushing_(false), |
174 resolution_change_pending_(false), | 174 resolution_change_pending_(false), |
175 resolution_change_reset_pending_(false), | 175 resolution_change_reset_pending_(false), |
176 decoder_partial_frame_pending_(false), | 176 decoder_partial_frame_pending_(false), |
177 input_streamon_(false), | 177 input_streamon_(false), |
178 input_buffer_queued_count_(0), | 178 input_buffer_queued_count_(0), |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 return true; | 1696 return true; |
1697 } | 1697 } |
1698 | 1698 |
1699 bool V4L2VideoDecodeAccelerator::SetupFormats() { | 1699 bool V4L2VideoDecodeAccelerator::SetupFormats() { |
1700 // We always run this as we prepare to initialize. | 1700 // We always run this as we prepare to initialize. |
1701 DCHECK_EQ(decoder_state_, kUninitialized); | 1701 DCHECK_EQ(decoder_state_, kUninitialized); |
1702 DCHECK(!input_streamon_); | 1702 DCHECK(!input_streamon_); |
1703 DCHECK(!output_streamon_); | 1703 DCHECK(!output_streamon_); |
1704 | 1704 |
1705 __u32 input_format_fourcc = | 1705 __u32 input_format_fourcc = |
1706 V4L2Device::VideoCodecProfileToV4L2PixFmt(video_profile_, false); | 1706 V4L2Device::VideoCodecProfileToV4L2PixFmt(video_profile_); |
1707 if (!input_format_fourcc) { | 1707 if (!input_format_fourcc) { |
1708 NOTREACHED(); | 1708 NOTREACHED(); |
1709 return false; | 1709 return false; |
1710 } | 1710 } |
1711 | 1711 |
1712 size_t input_size; | 1712 size_t input_size; |
1713 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1713 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1714 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode)) | 1714 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode)) |
1715 input_size = kInputBufferMaxSizeFor4k; | 1715 input_size = kInputBufferMaxSizeFor4k; |
1716 else | 1716 else |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 gfx::Size new_size(base::checked_cast<int>(format.fmt.pix_mp.width), | 1969 gfx::Size new_size(base::checked_cast<int>(format.fmt.pix_mp.width), |
1970 base::checked_cast<int>(format.fmt.pix_mp.height)); | 1970 base::checked_cast<int>(format.fmt.pix_mp.height)); |
1971 if (frame_buffer_size_ != new_size) { | 1971 if (frame_buffer_size_ != new_size) { |
1972 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected"; | 1972 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected"; |
1973 return true; | 1973 return true; |
1974 } | 1974 } |
1975 return false; | 1975 return false; |
1976 } | 1976 } |
1977 | 1977 |
1978 } // namespace content | 1978 } // namespace content |
OLD | NEW |