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