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

Side by Side Diff: media/audio/win/wavein_input_win.cc

Issue 10820042: Uses DCHECK_GT() instead of DCHECK_LE(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 4 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 | « no previous file | 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) 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/audio/win/wavein_input_win.h" 5 #include "media/audio/win/wavein_input_win.h"
6 6
7 #pragma comment(lib, "winmm.lib") 7 #pragma comment(lib, "winmm.lib")
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/audio/audio_io.h" 10 #include "media/audio/audio_io.h"
(...skipping 17 matching lines...) Expand all
28 AudioManagerWin* manager, const AudioParameters& params, int num_buffers, 28 AudioManagerWin* manager, const AudioParameters& params, int num_buffers,
29 const std::string& device_id) 29 const std::string& device_id)
30 : state_(kStateEmpty), 30 : state_(kStateEmpty),
31 manager_(manager), 31 manager_(manager),
32 device_id_(device_id), 32 device_id_(device_id),
33 wavein_(NULL), 33 wavein_(NULL),
34 callback_(NULL), 34 callback_(NULL),
35 num_buffers_(num_buffers), 35 num_buffers_(num_buffers),
36 buffer_(NULL), 36 buffer_(NULL),
37 channels_(params.channels()) { 37 channels_(params.channels()) {
38 DCHECK_LE(0, num_buffers_); 38 DCHECK_GT(num_buffers_, 0);
39 format_.wFormatTag = WAVE_FORMAT_PCM; 39 format_.wFormatTag = WAVE_FORMAT_PCM;
40 format_.nChannels = params.channels() > 2 ? 2 : params.channels(); 40 format_.nChannels = params.channels() > 2 ? 2 : params.channels();
41 format_.nSamplesPerSec = params.sample_rate(); 41 format_.nSamplesPerSec = params.sample_rate();
42 format_.wBitsPerSample = params.bits_per_sample(); 42 format_.wBitsPerSample = params.bits_per_sample();
43 format_.cbSize = 0; 43 format_.cbSize = 0;
44 format_.nBlockAlign = (format_.nChannels * format_.wBitsPerSample) / 8; 44 format_.nBlockAlign = (format_.nChannels * format_.wBitsPerSample) / 8;
45 format_.nAvgBytesPerSec = format_.nBlockAlign * format_.nSamplesPerSec; 45 format_.nAvgBytesPerSec = format_.nBlockAlign * format_.nSamplesPerSec;
46 buffer_size_ = params.frames_per_buffer() * format_.nBlockAlign; 46 buffer_size_ = params.frames_per_buffer() * format_.nBlockAlign;
47 // If we don't have a packet size we use 100ms. 47 // If we don't have a packet size we use 100ms.
48 if (!buffer_size_) 48 if (!buffer_size_)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 } else if (msg == WIM_CLOSE) { 294 } else if (msg == WIM_CLOSE) {
295 // We can be closed before calling Start, so it is possible to have a 295 // We can be closed before calling Start, so it is possible to have a
296 // null callback at this point. 296 // null callback at this point.
297 if (obj->callback_) 297 if (obj->callback_)
298 obj->callback_->OnClose(obj); 298 obj->callback_->OnClose(obj);
299 } 299 }
300 } 300 }
301 301
302 } // namespace media 302 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698