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

Side by Side Diff: media/base/audio_block_fifo.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "media/base/audio_block_fifo.h" 7 #include "media/base/audio_block_fifo.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 void AudioBlockFifo::Push(const void* source, 25 void AudioBlockFifo::Push(const void* source,
26 int frames, 26 int frames,
27 int bytes_per_sample) { 27 int bytes_per_sample) {
28 DCHECK(source); 28 DCHECK(source);
29 DCHECK_GT(frames, 0); 29 DCHECK_GT(frames, 0);
30 DCHECK_GT(bytes_per_sample, 0); 30 DCHECK_GT(bytes_per_sample, 0);
31 DCHECK_LT(available_blocks_, static_cast<int>(audio_blocks_.size())); 31 DCHECK_LT(available_blocks_, static_cast<int>(audio_blocks_.size()));
32 CHECK_LE(frames, GetUnfilledFrames()); 32 CHECK_LE(frames, GetUnfilledFrames());
33 33
34 const uint8* source_ptr = static_cast<const uint8*>(source); 34 const uint8_t* source_ptr = static_cast<const uint8_t*>(source);
35 int frames_to_push = frames; 35 int frames_to_push = frames;
36 while (frames_to_push) { 36 while (frames_to_push) {
37 // Get the current write block. 37 // Get the current write block.
38 AudioBus* current_block = audio_blocks_[write_block_]; 38 AudioBus* current_block = audio_blocks_[write_block_];
39 39
40 // Figure out what segment sizes we need when adding the new content to 40 // Figure out what segment sizes we need when adding the new content to
41 // the FIFO. 41 // the FIFO.
42 const int push_frames = 42 const int push_frames =
43 std::min(block_frames_ - write_pos_, frames_to_push); 43 std::min(block_frames_ - write_pos_, frames_to_push);
44 44
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 write_block_ += blocks; 109 write_block_ += blocks;
110 110
111 // Update the read pointers correspondingly. 111 // Update the read pointers correspondingly.
112 read_block_ += blocks; 112 read_block_ += blocks;
113 113
114 DCHECK_LT(read_block_, static_cast<int>(audio_blocks_.size())); 114 DCHECK_LT(read_block_, static_cast<int>(audio_blocks_.size()));
115 DCHECK_LT(write_block_, static_cast<int>(audio_blocks_.size())); 115 DCHECK_LT(write_block_, static_cast<int>(audio_blocks_.size()));
116 } 116 }
117 117
118 } // namespace media 118 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698