| 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(const Config& config, |
| 203 Client* client) { | 203 Client* client) { |
| 204 DVLOG(3) << "Initialize()"; | 204 DVLOG(3) << "Initialize()"; |
| 205 if (config.is_encrypted) { |
| 206 NOTREACHED() << "Encrypted streams are not supported for this VDA"; |
| 207 return false; |
| 208 } |
| 209 |
| 205 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 210 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 206 DCHECK_EQ(decoder_state_, kUninitialized); | 211 DCHECK_EQ(decoder_state_, kUninitialized); |
| 207 | 212 |
| 208 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 213 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 209 client_ = client_ptr_factory_->GetWeakPtr(); | 214 client_ = client_ptr_factory_->GetWeakPtr(); |
| 210 | 215 |
| 211 switch (profile) { | 216 switch (config.profile) { |
| 212 case media::H264PROFILE_BASELINE: | 217 case media::H264PROFILE_BASELINE: |
| 213 DVLOG(2) << "Initialize(): profile H264PROFILE_BASELINE"; | 218 DVLOG(2) << "Initialize(): profile H264PROFILE_BASELINE"; |
| 214 break; | 219 break; |
| 215 case media::H264PROFILE_MAIN: | 220 case media::H264PROFILE_MAIN: |
| 216 DVLOG(2) << "Initialize(): profile H264PROFILE_MAIN"; | 221 DVLOG(2) << "Initialize(): profile H264PROFILE_MAIN"; |
| 217 break; | 222 break; |
| 218 case media::H264PROFILE_HIGH: | 223 case media::H264PROFILE_HIGH: |
| 219 DVLOG(2) << "Initialize(): profile H264PROFILE_HIGH"; | 224 DVLOG(2) << "Initialize(): profile H264PROFILE_HIGH"; |
| 220 break; | 225 break; |
| 221 case media::VP8PROFILE_ANY: | 226 case media::VP8PROFILE_ANY: |
| 222 DVLOG(2) << "Initialize(): profile VP8PROFILE_ANY"; | 227 DVLOG(2) << "Initialize(): profile VP8PROFILE_ANY"; |
| 223 break; | 228 break; |
| 224 case media::VP9PROFILE_ANY: | 229 case media::VP9PROFILE_ANY: |
| 225 DVLOG(2) << "Initialize(): profile VP9PROFILE_ANY"; | 230 DVLOG(2) << "Initialize(): profile VP9PROFILE_ANY"; |
| 226 break; | 231 break; |
| 227 default: | 232 default: |
| 228 DLOG(ERROR) << "Initialize(): unsupported profile=" << profile; | 233 DLOG(ERROR) << "Initialize(): unsupported profile=" << config.profile; |
| 229 return false; | 234 return false; |
| 230 }; | 235 }; |
| 231 video_profile_ = profile; | 236 video_profile_ = config.profile; |
| 232 | 237 |
| 233 if (egl_display_ == EGL_NO_DISPLAY) { | 238 if (egl_display_ == EGL_NO_DISPLAY) { |
| 234 LOG(ERROR) << "Initialize(): could not get EGLDisplay"; | 239 LOG(ERROR) << "Initialize(): could not get EGLDisplay"; |
| 235 return false; | 240 return false; |
| 236 } | 241 } |
| 237 | 242 |
| 238 // We need the context to be initialized to query extensions. | 243 // We need the context to be initialized to query extensions. |
| 239 if (!make_context_current_.Run()) { | 244 if (!make_context_current_.Run()) { |
| 240 LOG(ERROR) << "Initialize(): could not make context current"; | 245 LOG(ERROR) << "Initialize(): could not make context current"; |
| 241 return false; | 246 return false; |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2044 |
| 2040 void V4L2VideoDecodeAccelerator::PictureCleared() { | 2045 void V4L2VideoDecodeAccelerator::PictureCleared() { |
| 2041 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 2046 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
| 2042 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2047 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 2043 DCHECK_GT(picture_clearing_count_, 0); | 2048 DCHECK_GT(picture_clearing_count_, 0); |
| 2044 picture_clearing_count_--; | 2049 picture_clearing_count_--; |
| 2045 SendPictureReady(); | 2050 SendPictureReady(); |
| 2046 } | 2051 } |
| 2047 | 2052 |
| 2048 } // namespace content | 2053 } // namespace content |
| OLD | NEW |