| 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 << " bitstream input_id=" << bitstream_buffer_id; | 1359 << " bitstream input_id=" << bitstream_buffer_id; |
| 1360 if (image_processor_device_) { | 1360 if (image_processor_device_) { |
| 1361 if (!ProcessFrame(bitstream_buffer_id, dqbuf.index)) { | 1361 if (!ProcessFrame(bitstream_buffer_id, dqbuf.index)) { |
| 1362 DLOGF(ERROR) << "Processing frame failed"; | 1362 DLOGF(ERROR) << "Processing frame failed"; |
| 1363 NOTIFY_ERROR(PLATFORM_FAILURE); | 1363 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 1364 return; | 1364 return; |
| 1365 } | 1365 } |
| 1366 } else { | 1366 } else { |
| 1367 output_record.state = kAtClient; | 1367 output_record.state = kAtClient; |
| 1368 decoder_frames_at_client_++; | 1368 decoder_frames_at_client_++; |
| 1369 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 |
| 1369 const Picture picture(output_record.picture_id, bitstream_buffer_id, | 1370 const Picture picture(output_record.picture_id, bitstream_buffer_id, |
| 1370 gfx::Rect(visible_size_), false); | 1371 gfx::Rect(visible_size_), gfx::ColorSpace(), |
| 1372 false); |
| 1371 pending_picture_ready_.push( | 1373 pending_picture_ready_.push( |
| 1372 PictureRecord(output_record.cleared, picture)); | 1374 PictureRecord(output_record.cleared, picture)); |
| 1373 SendPictureReady(); | 1375 SendPictureReady(); |
| 1374 output_record.cleared = true; | 1376 output_record.cleared = true; |
| 1375 } | 1377 } |
| 1376 } | 1378 } |
| 1377 } | 1379 } |
| 1378 | 1380 |
| 1379 NotifyFlushDoneIfNeeded(); | 1381 NotifyFlushDoneIfNeeded(); |
| 1380 } | 1382 } |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 | 2487 |
| 2486 OutputRecord& output_record = output_buffer_map_[output_buffer_index]; | 2488 OutputRecord& output_record = output_buffer_map_[output_buffer_index]; |
| 2487 DVLOGF(3) << "picture_id=" << output_record.picture_id; | 2489 DVLOGF(3) << "picture_id=" << output_record.picture_id; |
| 2488 DCHECK_EQ(output_record.state, kAtProcessor); | 2490 DCHECK_EQ(output_record.state, kAtProcessor); |
| 2489 DCHECK_NE(output_record.picture_id, -1); | 2491 DCHECK_NE(output_record.picture_id, -1); |
| 2490 | 2492 |
| 2491 // Send the processed frame to render. | 2493 // Send the processed frame to render. |
| 2492 output_record.state = kAtClient; | 2494 output_record.state = kAtClient; |
| 2493 decoder_frames_at_client_++; | 2495 decoder_frames_at_client_++; |
| 2494 image_processor_bitstream_buffer_ids_.pop(); | 2496 image_processor_bitstream_buffer_ids_.pop(); |
| 2497 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 |
| 2495 const Picture picture(output_record.picture_id, bitstream_buffer_id, | 2498 const Picture picture(output_record.picture_id, bitstream_buffer_id, |
| 2496 gfx::Rect(visible_size_), false); | 2499 gfx::Rect(visible_size_), gfx::ColorSpace(), false); |
| 2497 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); | 2500 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); |
| 2498 SendPictureReady(); | 2501 SendPictureReady(); |
| 2499 output_record.cleared = true; | 2502 output_record.cleared = true; |
| 2500 // Flush or resolution change may be waiting image processor to finish. | 2503 // Flush or resolution change may be waiting image processor to finish. |
| 2501 if (image_processor_bitstream_buffer_ids_.empty()) { | 2504 if (image_processor_bitstream_buffer_ids_.empty()) { |
| 2502 NotifyFlushDoneIfNeeded(); | 2505 NotifyFlushDoneIfNeeded(); |
| 2503 if (decoder_state_ == kChangingResolution) | 2506 if (decoder_state_ == kChangingResolution) |
| 2504 StartResolutionChange(); | 2507 StartResolutionChange(); |
| 2505 } | 2508 } |
| 2506 } | 2509 } |
| 2507 | 2510 |
| 2508 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2511 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
| 2509 LOGF(ERROR) << "Image processor error"; | 2512 LOGF(ERROR) << "Image processor error"; |
| 2510 NOTIFY_ERROR(PLATFORM_FAILURE); | 2513 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 2511 } | 2514 } |
| 2512 | 2515 |
| 2513 } // namespace media | 2516 } // namespace media |
| OLD | NEW |