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 <libdrm/drm_fourcc.h> | 8 #include <libdrm/drm_fourcc.h> |
9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
10 #include <poll.h> | 10 #include <poll.h> |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 make_context_current_(make_context_current), | 214 make_context_current_(make_context_current), |
215 egl_display_(egl_display), | 215 egl_display_(egl_display), |
216 egl_context_(egl_context), | 216 egl_context_(egl_context), |
217 video_profile_(media::VIDEO_CODEC_PROFILE_UNKNOWN) {} | 217 video_profile_(media::VIDEO_CODEC_PROFILE_UNKNOWN) {} |
218 | 218 |
219 ExynosVideoDecodeAccelerator::~ExynosVideoDecodeAccelerator() { | 219 ExynosVideoDecodeAccelerator::~ExynosVideoDecodeAccelerator() { |
220 DCHECK(!decoder_thread_.IsRunning()); | 220 DCHECK(!decoder_thread_.IsRunning()); |
221 DCHECK(!device_poll_thread_.IsRunning()); | 221 DCHECK(!device_poll_thread_.IsRunning()); |
222 | 222 |
223 if (device_poll_interrupt_fd_ != -1) { | 223 if (device_poll_interrupt_fd_ != -1) { |
224 HANDLE_EINTR(close(device_poll_interrupt_fd_)); | 224 close(device_poll_interrupt_fd_); |
225 device_poll_interrupt_fd_ = -1; | 225 device_poll_interrupt_fd_ = -1; |
226 } | 226 } |
227 if (mfc_fd_ != -1) { | 227 if (mfc_fd_ != -1) { |
228 DestroyMfcInputBuffers(); | 228 DestroyMfcInputBuffers(); |
229 DestroyMfcOutputBuffers(); | 229 DestroyMfcOutputBuffers(); |
230 HANDLE_EINTR(close(mfc_fd_)); | 230 close(mfc_fd_); |
231 mfc_fd_ = -1; | 231 mfc_fd_ = -1; |
232 } | 232 } |
233 | 233 |
234 // These maps have members that should be manually destroyed, e.g. file | 234 // These maps have members that should be manually destroyed, e.g. file |
235 // descriptors, mmap() segments, etc. | 235 // descriptors, mmap() segments, etc. |
236 DCHECK(mfc_input_buffer_map_.empty()); | 236 DCHECK(mfc_input_buffer_map_.empty()); |
237 DCHECK(mfc_output_buffer_map_.empty()); | 237 DCHECK(mfc_output_buffer_map_.empty()); |
238 } | 238 } |
239 | 239 |
240 bool ExynosVideoDecodeAccelerator::Initialize( | 240 bool ExynosVideoDecodeAccelerator::Initialize( |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 if (mfc_output_buffer_map_.size() != 0) { | 1899 if (mfc_output_buffer_map_.size() != 0) { |
1900 if (!make_context_current_.Run()) { | 1900 if (!make_context_current_.Run()) { |
1901 DLOG(ERROR) << "DestroyMfcOutputBuffers(): " | 1901 DLOG(ERROR) << "DestroyMfcOutputBuffers(): " |
1902 << "could not make context current"; | 1902 << "could not make context current"; |
1903 } else { | 1903 } else { |
1904 size_t i = 0; | 1904 size_t i = 0; |
1905 do { | 1905 do { |
1906 MfcOutputRecord& output_record = mfc_output_buffer_map_[i]; | 1906 MfcOutputRecord& output_record = mfc_output_buffer_map_[i]; |
1907 for (size_t j = 0; j < arraysize(output_record.fds); ++j) { | 1907 for (size_t j = 0; j < arraysize(output_record.fds); ++j) { |
1908 if (output_record.fds[j] != -1) | 1908 if (output_record.fds[j] != -1) |
1909 HANDLE_EINTR(close(output_record.fds[j])); | 1909 close(output_record.fds[j]); |
1910 if (output_record.egl_image != EGL_NO_IMAGE_KHR) | 1910 if (output_record.egl_image != EGL_NO_IMAGE_KHR) |
1911 eglDestroyImageKHR(egl_display_, output_record.egl_image); | 1911 eglDestroyImageKHR(egl_display_, output_record.egl_image); |
1912 if (output_record.egl_sync != EGL_NO_SYNC_KHR) | 1912 if (output_record.egl_sync != EGL_NO_SYNC_KHR) |
1913 eglDestroySyncKHR(egl_display_, output_record.egl_sync); | 1913 eglDestroySyncKHR(egl_display_, output_record.egl_sync); |
1914 } | 1914 } |
1915 DVLOG(1) << "DestroyMfcOutputBuffers(): dismissing PictureBuffer id=" | 1915 DVLOG(1) << "DestroyMfcOutputBuffers(): dismissing PictureBuffer id=" |
1916 << output_record.picture_id; | 1916 << output_record.picture_id; |
1917 child_message_loop_proxy_->PostTask( | 1917 child_message_loop_proxy_->PostTask( |
1918 FROM_HERE, | 1918 FROM_HERE, |
1919 base::Bind(&Client::DismissPictureBuffer, | 1919 base::Bind(&Client::DismissPictureBuffer, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 | 1993 |
1994 void ExynosVideoDecodeAccelerator::PictureCleared() { | 1994 void ExynosVideoDecodeAccelerator::PictureCleared() { |
1995 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 1995 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
1996 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 1996 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
1997 DCHECK_GT(picture_clearing_count_, 0); | 1997 DCHECK_GT(picture_clearing_count_, 0); |
1998 picture_clearing_count_--; | 1998 picture_clearing_count_--; |
1999 SendPictureReady(); | 1999 SendPictureReady(); |
2000 } | 2000 } |
2001 | 2001 |
2002 } // namespace content | 2002 } // namespace content |
OLD | NEW |