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 "media/gpu/v4l2_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_video_decode_accelerator.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 base::TimeDelta()); | 1223 base::TimeDelta()); |
1224 // Unretained is safe because |this| owns image processor and there will | 1224 // Unretained is safe because |this| owns image processor and there will |
1225 // be no callbacks after processor destroys. | 1225 // be no callbacks after processor destroys. |
1226 image_processor_->Process( | 1226 image_processor_->Process( |
1227 frame, dqbuf.index, | 1227 frame, dqbuf.index, |
1228 base::Bind(&V4L2VideoDecodeAccelerator::FrameProcessed, | 1228 base::Bind(&V4L2VideoDecodeAccelerator::FrameProcessed, |
1229 base::Unretained(this), bitstream_buffer_id)); | 1229 base::Unretained(this), bitstream_buffer_id)); |
1230 } else { | 1230 } else { |
1231 output_record.state = kAtClient; | 1231 output_record.state = kAtClient; |
1232 decoder_frames_at_client_++; | 1232 decoder_frames_at_client_++; |
| 1233 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 |
1233 const Picture picture(output_record.picture_id, bitstream_buffer_id, | 1234 const Picture picture(output_record.picture_id, bitstream_buffer_id, |
1234 gfx::Rect(visible_size_), false); | 1235 gfx::Rect(visible_size_), gfx::ColorSpace(), |
| 1236 false); |
1235 pending_picture_ready_.push( | 1237 pending_picture_ready_.push( |
1236 PictureRecord(output_record.cleared, picture)); | 1238 PictureRecord(output_record.cleared, picture)); |
1237 SendPictureReady(); | 1239 SendPictureReady(); |
1238 output_record.cleared = true; | 1240 output_record.cleared = true; |
1239 } | 1241 } |
1240 } | 1242 } |
1241 } | 1243 } |
1242 | 1244 |
1243 NotifyFlushDoneIfNeeded(); | 1245 NotifyFlushDoneIfNeeded(); |
1244 } | 1246 } |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 OutputRecord& output_record = output_buffer_map_[output_buffer_index]; | 2263 OutputRecord& output_record = output_buffer_map_[output_buffer_index]; |
2262 DVLOGF(3) << "picture_id=" << output_record.picture_id; | 2264 DVLOGF(3) << "picture_id=" << output_record.picture_id; |
2263 DCHECK_EQ(output_record.state, kAtProcessor); | 2265 DCHECK_EQ(output_record.state, kAtProcessor); |
2264 DCHECK_NE(output_record.egl_image, EGL_NO_IMAGE_KHR); | 2266 DCHECK_NE(output_record.egl_image, EGL_NO_IMAGE_KHR); |
2265 DCHECK_NE(output_record.picture_id, -1); | 2267 DCHECK_NE(output_record.picture_id, -1); |
2266 | 2268 |
2267 // Send the processed frame to render. | 2269 // Send the processed frame to render. |
2268 output_record.state = kAtClient; | 2270 output_record.state = kAtClient; |
2269 decoder_frames_at_client_++; | 2271 decoder_frames_at_client_++; |
2270 image_processor_bitstream_buffer_ids_.pop(); | 2272 image_processor_bitstream_buffer_ids_.pop(); |
| 2273 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 |
2271 const Picture picture(output_record.picture_id, bitstream_buffer_id, | 2274 const Picture picture(output_record.picture_id, bitstream_buffer_id, |
2272 gfx::Rect(visible_size_), false); | 2275 gfx::Rect(visible_size_), gfx::ColorSpace(), false); |
2273 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); | 2276 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); |
2274 SendPictureReady(); | 2277 SendPictureReady(); |
2275 output_record.cleared = true; | 2278 output_record.cleared = true; |
2276 // Flush or resolution change may be waiting image processor to finish. | 2279 // Flush or resolution change may be waiting image processor to finish. |
2277 if (image_processor_bitstream_buffer_ids_.empty()) { | 2280 if (image_processor_bitstream_buffer_ids_.empty()) { |
2278 NotifyFlushDoneIfNeeded(); | 2281 NotifyFlushDoneIfNeeded(); |
2279 if (decoder_state_ == kChangingResolution) | 2282 if (decoder_state_ == kChangingResolution) |
2280 StartResolutionChange(); | 2283 StartResolutionChange(); |
2281 } | 2284 } |
2282 } | 2285 } |
2283 | 2286 |
2284 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2287 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
2285 LOGF(ERROR) << "Image processor error"; | 2288 LOGF(ERROR) << "Image processor error"; |
2286 NOTIFY_ERROR(PLATFORM_FAILURE); | 2289 NOTIFY_ERROR(PLATFORM_FAILURE); |
2287 } | 2290 } |
2288 | 2291 |
2289 } // namespace media | 2292 } // namespace media |
OLD | NEW |