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

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

Issue 7003140: Fix two bugs found by a new clang warning I'm currently testing: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 6 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
« no previous file with comments | « base/md5.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (width > 320) { // VGA 63 if (width > 320) { // VGA
64 current_settings.width = 640; 64 current_settings.width = 640;
65 current_settings.height = 480; 65 current_settings.height = 480;
66 current_settings.frame_rate = 30; 66 current_settings.frame_rate = 30;
67 } else { // QVGA 67 } else { // QVGA
68 current_settings.width = 320; 68 current_settings.width = 320;
69 current_settings.height = 240; 69 current_settings.height = 240;
70 current_settings.frame_rate = 30; 70 current_settings.frame_rate = 30;
71 } 71 }
72 72
73 fake_frame_.reset(new uint8[current_settings.width * 73 size_t fake_frame_size =
74 current_settings.height * 3 / 2]); 74 current_settings.width * current_settings.height * 3 / 2;
75 memset(fake_frame_.get(), 0, sizeof(fake_frame_.get())); 75 fake_frame_.reset(new uint8[fake_frame_size]);
76 memset(fake_frame_.get(), 0, fake_frame_size);
76 77
77 state_ = kAllocated; 78 state_ = kAllocated;
78 observer_->OnFrameInfo(current_settings); 79 observer_->OnFrameInfo(current_settings);
79 } 80 }
80 81
81 void FakeVideoCaptureDevice::Start() { 82 void FakeVideoCaptureDevice::Start() {
82 if (state_ != kAllocated) { 83 if (state_ != kAllocated) {
83 return; // Wrong state. 84 return; // Wrong state.
84 } 85 }
85 state_ = kCapturing; 86 state_ = kCapturing;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 sizeof(fake_frame_.get()), 119 sizeof(fake_frame_.get()),
119 base::Time::Now()); 120 base::Time::Now());
120 // Reschedule next CaptureTask. 121 // Reschedule next CaptureTask.
121 capture_thread_.message_loop()->PostDelayedTask( 122 capture_thread_.message_loop()->PostDelayedTask(
122 FROM_HERE, 123 FROM_HERE,
123 NewRunnableMethod(this, &FakeVideoCaptureDevice::OnCaptureTask), 124 NewRunnableMethod(this, &FakeVideoCaptureDevice::OnCaptureTask),
124 kFakeCaptureTimeoutMs); 125 kFakeCaptureTimeoutMs);
125 } 126 }
126 127
127 } // namespace media 128 } // namespace media
OLDNEW
« no previous file with comments | « base/md5.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698