Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: media/video/capture/fake_video_capture_device.cc

Issue 83793004: Implement IPCs and VideoCapture::Client interfaces for texture capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: e296ac98 Win32 bits. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "media/audio/fake_audio_input_stream.h" 12 #include "media/audio/fake_audio_input_stream.h"
13 #include "media/base/video_frame.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "third_party/skia/include/core/SkCanvas.h" 15 #include "third_party/skia/include/core/SkCanvas.h"
15 #include "third_party/skia/include/core/SkPaint.h" 16 #include "third_party/skia/include/core/SkPaint.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 static const int kFakeCaptureTimeoutMs = 50; 20 static const int kFakeCaptureTimeoutMs = 50;
20 static const int kFakeCaptureBeepCycle = 20; // Visual beep every 1s. 21 static const int kFakeCaptureBeepCycle = 20; // Visual beep every 1s.
21 static const int kFakeCaptureCapabilityChangePeriod = 30; 22 static const int kFakeCaptureCapabilityChangePeriod = 30;
22 enum { kNumberOfFakeDevices = 2 }; 23 enum { kNumberOfFakeDevices = 2 };
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 if (frame_count_ % kFakeCaptureBeepCycle == 0) { 209 if (frame_count_ % kFakeCaptureBeepCycle == 0) {
209 // Generate a synchronized beep sound if there is one audio input 210 // Generate a synchronized beep sound if there is one audio input
210 // stream created. 211 // stream created.
211 FakeAudioInputStream::BeepOnce(); 212 FakeAudioInputStream::BeepOnce();
212 } 213 }
213 214
214 frame_count_++; 215 frame_count_++;
215 216
216 // Give the captured frame to the client. 217 // Give the captured frame to the client.
217 client_->OnIncomingCapturedFrame(fake_frame_.get(), 218 client_->OnIncomingCapturedData(fake_frame_.get(),
218 frame_size, 219 frame_size,
219 base::TimeTicks::Now(), 220 capture_format_,
220 0, 221 0,
221 capture_format_); 222 base::TimeTicks::Now());
222 if (!(frame_count_ % kFakeCaptureCapabilityChangePeriod) && 223 if (!(frame_count_ % kFakeCaptureCapabilityChangePeriod) &&
223 format_roster_.size() > 0U) { 224 format_roster_.size() > 0U) {
224 Reallocate(); 225 Reallocate();
225 } 226 }
226 // Reschedule next CaptureTask. 227 // Reschedule next CaptureTask.
227 capture_thread_.message_loop()->PostDelayedTask( 228 capture_thread_.message_loop()->PostDelayedTask(
228 FROM_HERE, 229 FROM_HERE,
229 base::Bind(&FakeVideoCaptureDevice::OnCaptureTask, 230 base::Bind(&FakeVideoCaptureDevice::OnCaptureTask,
230 base::Unretained(this)), 231 base::Unretained(this)),
231 base::TimeDelta::FromMilliseconds(kFakeCaptureTimeoutMs)); 232 base::TimeDelta::FromMilliseconds(kFakeCaptureTimeoutMs));
(...skipping 18 matching lines...) Expand all
250 media::VideoCaptureFormat(gfx::Size(320, 240), 30, PIXEL_FORMAT_I420)); 251 media::VideoCaptureFormat(gfx::Size(320, 240), 30, PIXEL_FORMAT_I420));
251 format_roster_.push_back( 252 format_roster_.push_back(
252 media::VideoCaptureFormat(gfx::Size(640, 480), 30, PIXEL_FORMAT_I420)); 253 media::VideoCaptureFormat(gfx::Size(640, 480), 30, PIXEL_FORMAT_I420));
253 format_roster_.push_back( 254 format_roster_.push_back(
254 media::VideoCaptureFormat(gfx::Size(800, 600), 30, PIXEL_FORMAT_I420)); 255 media::VideoCaptureFormat(gfx::Size(800, 600), 30, PIXEL_FORMAT_I420));
255 256
256 format_roster_index_ = 0; 257 format_roster_index_ = 0;
257 } 258 }
258 259
259 } // namespace media 260 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/android/video_capture_device_android.cc ('k') | media/video/capture/file_video_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698