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/video/capture/fake_video_capture_device.h" | 5 #include "media/video/capture/fake_video_capture_device.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 scoped_ptr<VideoCaptureDevice::Client> client) { | 74 scoped_ptr<VideoCaptureDevice::Client> client) { |
75 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current()); | 75 DCHECK_EQ(capture_thread_.message_loop(), base::MessageLoop::current()); |
76 client_ = client.Pass(); | 76 client_ = client.Pass(); |
77 | 77 |
78 // Incoming |params| can be none of the supported formats, so we get the | 78 // Incoming |params| can be none of the supported formats, so we get the |
79 // closest thing rounded up. TODO(mcasas): Use the |params|, if they belong to | 79 // closest thing rounded up. TODO(mcasas): Use the |params|, if they belong to |
80 // the supported ones, when http://crbug.com/309554 is verified. | 80 // the supported ones, when http://crbug.com/309554 is verified. |
81 DCHECK_EQ(params.requested_format.pixel_format, PIXEL_FORMAT_I420); | 81 DCHECK_EQ(params.requested_format.pixel_format, PIXEL_FORMAT_I420); |
82 capture_format_.pixel_format = params.requested_format.pixel_format; | 82 capture_format_.pixel_format = params.requested_format.pixel_format; |
83 capture_format_.frame_rate = 30; | 83 capture_format_.frame_rate = 30; |
84 if (params.requested_format.frame_size.width() > 640) | 84 if (params.requested_format.frame_size.width() > 720) |
| 85 capture_format_.frame_size.SetSize(1920, 1080); |
| 86 else if (params.requested_format.frame_size.width() > 640) |
85 capture_format_.frame_size.SetSize(1280, 720); | 87 capture_format_.frame_size.SetSize(1280, 720); |
86 else if (params.requested_format.frame_size.width() > 320) | 88 else if (params.requested_format.frame_size.width() > 320) |
87 capture_format_.frame_size.SetSize(640, 480); | 89 capture_format_.frame_size.SetSize(640, 480); |
88 else | 90 else |
89 capture_format_.frame_size.SetSize(320, 240); | 91 capture_format_.frame_size.SetSize(320, 240); |
90 const size_t fake_frame_size = | 92 const size_t fake_frame_size = |
91 VideoFrame::AllocationSize(VideoFrame::I420, capture_format_.frame_size); | 93 VideoFrame::AllocationSize(VideoFrame::I420, capture_format_.frame_size); |
92 fake_frame_.reset(new uint8[fake_frame_size]); | 94 fake_frame_.reset(new uint8[fake_frame_size]); |
93 | 95 |
94 capture_thread_.message_loop()->PostTask( | 96 capture_thread_.message_loop()->PostTask( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 DCHECK_EQ(capture_format_.pixel_format, PIXEL_FORMAT_I420); | 187 DCHECK_EQ(capture_format_.pixel_format, PIXEL_FORMAT_I420); |
186 DVLOG(3) << "Reallocating FakeVideoCaptureDevice, new capture resolution " | 188 DVLOG(3) << "Reallocating FakeVideoCaptureDevice, new capture resolution " |
187 << capture_format_.frame_size.ToString(); | 189 << capture_format_.frame_size.ToString(); |
188 | 190 |
189 const size_t fake_frame_size = | 191 const size_t fake_frame_size = |
190 VideoFrame::AllocationSize(VideoFrame::I420, capture_format_.frame_size); | 192 VideoFrame::AllocationSize(VideoFrame::I420, capture_format_.frame_size); |
191 fake_frame_.reset(new uint8[fake_frame_size]); | 193 fake_frame_.reset(new uint8[fake_frame_size]); |
192 } | 194 } |
193 | 195 |
194 } // namespace media | 196 } // namespace media |
OLD | NEW |