| 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 <string.h> | 10 #include <string.h> |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 bool V4L2VideoDecodeAccelerator::DequeueResolutionChangeEvent() { | 1016 bool V4L2VideoDecodeAccelerator::DequeueResolutionChangeEvent() { |
| 1017 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 1017 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 1018 DCHECK_NE(decoder_state_, kUninitialized); | 1018 DCHECK_NE(decoder_state_, kUninitialized); |
| 1019 DVLOG(3) << "DequeueResolutionChangeEvent()"; | 1019 DVLOG(3) << "DequeueResolutionChangeEvent()"; |
| 1020 | 1020 |
| 1021 struct v4l2_event ev; | 1021 struct v4l2_event ev; |
| 1022 memset(&ev, 0, sizeof(ev)); | 1022 memset(&ev, 0, sizeof(ev)); |
| 1023 | 1023 |
| 1024 while (device_->Ioctl(VIDIOC_DQEVENT, &ev) == 0) { | 1024 while (device_->Ioctl(VIDIOC_DQEVENT, &ev) == 0) { |
| 1025 if (ev.type == V4L2_EVENT_SOURCE_CHANGE) { | 1025 if (ev.type == V4L2_EVENT_SOURCE_CHANGE) { |
| 1026 uint32_t changes = ev.u.src_change.changes; | 1026 if (ev.u.src_change.changes & V4L2_EVENT_SRC_CH_RESOLUTION) { |
| 1027 // We used to define source change was always resolution change. The union | |
| 1028 // |ev.u| is not used and it is zero by default. When using the upstream | |
| 1029 // version of the resolution event change, we also need to check | |
| 1030 // |ev.u.src_change.changes| to know what is changed. For API backward | |
| 1031 // compatibility, event is treated as resolution change when all bits in | |
| 1032 // |ev.u.src_change.changes| are cleared. | |
| 1033 if (changes == 0 || (changes & V4L2_EVENT_SRC_CH_RESOLUTION)) { | |
| 1034 DVLOG(3) | 1027 DVLOG(3) |
| 1035 << "DequeueResolutionChangeEvent(): got resolution change event."; | 1028 << "DequeueResolutionChangeEvent(): got resolution change event."; |
| 1036 return true; | 1029 return true; |
| 1037 } | 1030 } |
| 1038 } else { | 1031 } else { |
| 1039 LOG(ERROR) << "DequeueResolutionChangeEvent(): got an event (" << ev.type | 1032 LOG(ERROR) << "DequeueResolutionChangeEvent(): got an event (" << ev.type |
| 1040 << ") we haven't subscribed to."; | 1033 << ") we haven't subscribed to."; |
| 1041 } | 1034 } |
| 1042 } | 1035 } |
| 1043 return false; | 1036 return false; |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2032 |
| 2040 void V4L2VideoDecodeAccelerator::PictureCleared() { | 2033 void V4L2VideoDecodeAccelerator::PictureCleared() { |
| 2041 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 2034 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
| 2042 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2035 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 2043 DCHECK_GT(picture_clearing_count_, 0); | 2036 DCHECK_GT(picture_clearing_count_, 0); |
| 2044 picture_clearing_count_--; | 2037 picture_clearing_count_--; |
| 2045 SendPictureReady(); | 2038 SendPictureReady(); |
| 2046 } | 2039 } |
| 2047 | 2040 |
| 2048 } // namespace content | 2041 } // namespace content |
| OLD | NEW |