| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/capture/video/fake_video_capture_device.h" | 5 #include "media/capture/video/fake_video_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 return; | 584 return; |
| 585 | 585 |
| 586 auto required_sk_n32_buffer_size = VideoFrame::AllocationSize( | 586 auto required_sk_n32_buffer_size = VideoFrame::AllocationSize( |
| 587 PIXEL_FORMAT_ARGB, device_state()->format.frame_size); | 587 PIXEL_FORMAT_ARGB, device_state()->format.frame_size); |
| 588 sk_n32_buffer_.resize(required_sk_n32_buffer_size); | 588 sk_n32_buffer_.resize(required_sk_n32_buffer_size); |
| 589 memset(&sk_n32_buffer_[0], 0, required_sk_n32_buffer_size); | 589 memset(&sk_n32_buffer_[0], 0, required_sk_n32_buffer_size); |
| 590 | 590 |
| 591 frame_painter()->PaintFrame(timestamp_to_paint, &sk_n32_buffer_[0]); | 591 frame_painter()->PaintFrame(timestamp_to_paint, &sk_n32_buffer_[0]); |
| 592 | 592 |
| 593 static const int kQuality = 75; | 593 static const int kQuality = 75; |
| 594 const gfx::JPEGCodec::ColorFormat encoding_source_format = | |
| 595 (kN32_SkColorType == kRGBA_8888_SkColorType) | |
| 596 ? gfx::JPEGCodec::FORMAT_RGBA | |
| 597 : gfx::JPEGCodec::FORMAT_BGRA; | |
| 598 bool success = gfx::JPEGCodec::Encode( | 594 bool success = gfx::JPEGCodec::Encode( |
| 599 &sk_n32_buffer_[0], encoding_source_format, | 595 &sk_n32_buffer_[0], kN32_SkColorType, |
| 600 device_state()->format.frame_size.width(), | 596 device_state()->format.frame_size.width(), |
| 601 device_state()->format.frame_size.height(), | 597 device_state()->format.frame_size.height(), |
| 602 VideoFrame::RowBytes(0 /* plane */, PIXEL_FORMAT_ARGB, | 598 VideoFrame::RowBytes(0 /* plane */, PIXEL_FORMAT_ARGB, |
| 603 device_state()->format.frame_size.width()), | 599 device_state()->format.frame_size.width()), |
| 604 kQuality, &jpeg_buffer_); | 600 kQuality, &jpeg_buffer_); |
| 605 if (!success) { | 601 if (!success) { |
| 606 DLOG(ERROR) << "Jpeg encoding failed"; | 602 DLOG(ERROR) << "Jpeg encoding failed"; |
| 607 return; | 603 return; |
| 608 } | 604 } |
| 609 | 605 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 int session_id) { | 646 int session_id) { |
| 651 DCHECK(thread_checker_.CalledOnValidThread()); | 647 DCHECK(thread_checker_.CalledOnValidThread()); |
| 652 if (session_id != current_session_id_) | 648 if (session_id != current_session_id_) |
| 653 return; | 649 return; |
| 654 | 650 |
| 655 frame_deliverer_->PaintAndDeliverNextFrame(elapsed_time_); | 651 frame_deliverer_->PaintAndDeliverNextFrame(elapsed_time_); |
| 656 BeepAndScheduleNextCapture(expected_execution_time); | 652 BeepAndScheduleNextCapture(expected_execution_time); |
| 657 } | 653 } |
| 658 | 654 |
| 659 } // namespace media | 655 } // namespace media |
| OLD | NEW |