OLD | NEW |
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 #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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 | 1884 |
1885 void ExynosVideoDecodeAccelerator::NotifyError(Error error) { | 1885 void ExynosVideoDecodeAccelerator::NotifyError(Error error) { |
1886 DVLOG(2) << "NotifyError()"; | 1886 DVLOG(2) << "NotifyError()"; |
1887 | 1887 |
1888 if (!child_message_loop_proxy_->BelongsToCurrentThread()) { | 1888 if (!child_message_loop_proxy_->BelongsToCurrentThread()) { |
1889 child_message_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 1889 child_message_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
1890 &ExynosVideoDecodeAccelerator::NotifyError, weak_this_, error)); | 1890 &ExynosVideoDecodeAccelerator::NotifyError, weak_this_, error)); |
1891 return; | 1891 return; |
1892 } | 1892 } |
1893 | 1893 |
1894 if (client_) { | 1894 if (client_.get()) { |
1895 client_->NotifyError(error); | 1895 client_->NotifyError(error); |
1896 client_ptr_factory_.InvalidateWeakPtrs(); | 1896 client_ptr_factory_.InvalidateWeakPtrs(); |
1897 } | 1897 } |
1898 } | 1898 } |
1899 | 1899 |
1900 void ExynosVideoDecodeAccelerator::SetDecoderState(State state) { | 1900 void ExynosVideoDecodeAccelerator::SetDecoderState(State state) { |
1901 DVLOG(3) << "SetDecoderState(): state=" << state; | 1901 DVLOG(3) << "SetDecoderState(): state=" << state; |
1902 | 1902 |
1903 // We can touch decoder_state_ only if this is the decoder thread or the | 1903 // We can touch decoder_state_ only if this is the decoder thread or the |
1904 // decoder thread isn't running. | 1904 // decoder thread isn't running. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 | 2215 |
2216 size_t i = 0; | 2216 size_t i = 0; |
2217 do { | 2217 do { |
2218 GscOutputRecord& output_record = gsc_output_buffer_map_[i]; | 2218 GscOutputRecord& output_record = gsc_output_buffer_map_[i]; |
2219 if (output_record.fd != -1) | 2219 if (output_record.fd != -1) |
2220 HANDLE_EINTR(close(output_record.fd)); | 2220 HANDLE_EINTR(close(output_record.fd)); |
2221 if (output_record.egl_image != EGL_NO_IMAGE_KHR) | 2221 if (output_record.egl_image != EGL_NO_IMAGE_KHR) |
2222 eglDestroyImageKHR(egl_display_, output_record.egl_image); | 2222 eglDestroyImageKHR(egl_display_, output_record.egl_image); |
2223 if (output_record.egl_sync != EGL_NO_SYNC_KHR) | 2223 if (output_record.egl_sync != EGL_NO_SYNC_KHR) |
2224 eglDestroySyncKHR(egl_display_, output_record.egl_sync); | 2224 eglDestroySyncKHR(egl_display_, output_record.egl_sync); |
2225 if (client_) | 2225 if (client_.get()) |
2226 client_->DismissPictureBuffer(output_record.picture_id); | 2226 client_->DismissPictureBuffer(output_record.picture_id); |
2227 ++i; | 2227 ++i; |
2228 } while (i < gsc_output_buffer_map_.size()); | 2228 } while (i < gsc_output_buffer_map_.size()); |
2229 } | 2229 } |
2230 | 2230 |
2231 struct v4l2_requestbuffers reqbufs; | 2231 struct v4l2_requestbuffers reqbufs; |
2232 memset(&reqbufs, 0, sizeof(reqbufs)); | 2232 memset(&reqbufs, 0, sizeof(reqbufs)); |
2233 reqbufs.count = 0; | 2233 reqbufs.count = 0; |
2234 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 2234 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
2235 reqbufs.memory = V4L2_MEMORY_DMABUF; | 2235 reqbufs.memory = V4L2_MEMORY_DMABUF; |
2236 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) | 2236 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) |
2237 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; | 2237 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; |
2238 | 2238 |
2239 gsc_output_buffer_map_.clear(); | 2239 gsc_output_buffer_map_.clear(); |
2240 gsc_free_output_buffers_.clear(); | 2240 gsc_free_output_buffers_.clear(); |
2241 } | 2241 } |
2242 | 2242 |
2243 } // namespace content | 2243 } // namespace content |
OLD | NEW |