| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 DestroyInputBuffers(); | 193 DestroyInputBuffers(); |
| 194 DestroyOutputBuffers(); | 194 DestroyOutputBuffers(); |
| 195 | 195 |
| 196 // These maps have members that should be manually destroyed, e.g. file | 196 // These maps have members that should be manually destroyed, e.g. file |
| 197 // descriptors, mmap() segments, etc. | 197 // descriptors, mmap() segments, etc. |
| 198 DCHECK(input_buffer_map_.empty()); | 198 DCHECK(input_buffer_map_.empty()); |
| 199 DCHECK(output_buffer_map_.empty()); | 199 DCHECK(output_buffer_map_.empty()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 202 bool V4L2VideoDecodeAccelerator::Initialize( |
| 203 Client* client) { | 203 const media::VideoDecodeAccelerator::InitParams& params, |
| 204 Client* client) { |
| 204 DVLOG(3) << "Initialize()"; | 205 DVLOG(3) << "Initialize()"; |
| 205 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 206 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 206 DCHECK_EQ(decoder_state_, kUninitialized); | 207 DCHECK_EQ(decoder_state_, kUninitialized); |
| 207 | 208 |
| 208 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 209 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 209 client_ = client_ptr_factory_->GetWeakPtr(); | 210 client_ = client_ptr_factory_->GetWeakPtr(); |
| 210 | 211 |
| 211 switch (profile) { | 212 switch (params.profile) { |
| 212 case media::H264PROFILE_BASELINE: | 213 case media::H264PROFILE_BASELINE: |
| 213 DVLOG(2) << "Initialize(): profile H264PROFILE_BASELINE"; | 214 DVLOG(2) << "Initialize(): profile H264PROFILE_BASELINE"; |
| 214 break; | 215 break; |
| 215 case media::H264PROFILE_MAIN: | 216 case media::H264PROFILE_MAIN: |
| 216 DVLOG(2) << "Initialize(): profile H264PROFILE_MAIN"; | 217 DVLOG(2) << "Initialize(): profile H264PROFILE_MAIN"; |
| 217 break; | 218 break; |
| 218 case media::H264PROFILE_HIGH: | 219 case media::H264PROFILE_HIGH: |
| 219 DVLOG(2) << "Initialize(): profile H264PROFILE_HIGH"; | 220 DVLOG(2) << "Initialize(): profile H264PROFILE_HIGH"; |
| 220 break; | 221 break; |
| 221 case media::VP8PROFILE_ANY: | 222 case media::VP8PROFILE_ANY: |
| 222 DVLOG(2) << "Initialize(): profile VP8PROFILE_ANY"; | 223 DVLOG(2) << "Initialize(): profile VP8PROFILE_ANY"; |
| 223 break; | 224 break; |
| 224 case media::VP9PROFILE_ANY: | 225 case media::VP9PROFILE_ANY: |
| 225 DVLOG(2) << "Initialize(): profile VP9PROFILE_ANY"; | 226 DVLOG(2) << "Initialize(): profile VP9PROFILE_ANY"; |
| 226 break; | 227 break; |
| 227 default: | 228 default: |
| 228 DLOG(ERROR) << "Initialize(): unsupported profile=" << profile; | 229 DLOG(ERROR) << "Initialize(): unsupported profile=" << profile; |
| 229 return false; | 230 return false; |
| 230 }; | 231 }; |
| 231 video_profile_ = profile; | 232 video_profile_ = params.profile; |
| 232 | 233 |
| 233 if (egl_display_ == EGL_NO_DISPLAY) { | 234 if (egl_display_ == EGL_NO_DISPLAY) { |
| 234 LOG(ERROR) << "Initialize(): could not get EGLDisplay"; | 235 LOG(ERROR) << "Initialize(): could not get EGLDisplay"; |
| 235 return false; | 236 return false; |
| 236 } | 237 } |
| 237 | 238 |
| 238 // We need the context to be initialized to query extensions. | 239 // We need the context to be initialized to query extensions. |
| 239 if (!make_context_current_.Run()) { | 240 if (!make_context_current_.Run()) { |
| 240 LOG(ERROR) << "Initialize(): could not make context current"; | 241 LOG(ERROR) << "Initialize(): could not make context current"; |
| 241 return false; | 242 return false; |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2040 |
| 2040 void V4L2VideoDecodeAccelerator::PictureCleared() { | 2041 void V4L2VideoDecodeAccelerator::PictureCleared() { |
| 2041 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 2042 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
| 2042 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2043 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 2043 DCHECK_GT(picture_clearing_count_, 0); | 2044 DCHECK_GT(picture_clearing_count_, 0); |
| 2044 picture_clearing_count_--; | 2045 picture_clearing_count_--; |
| 2045 SendPictureReady(); | 2046 SendPictureReady(); |
| 2046 } | 2047 } |
| 2047 | 2048 |
| 2048 } // namespace content | 2049 } // namespace content |
| OLD | NEW |