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

Side by Side Diff: remoting/client/audio_player.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 4 years, 12 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
« no previous file with comments | « remoting/client/audio_player.h ('k') | remoting/client/audio_player_unittest.cc » ('j') | 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 "remoting/client/audio_player.h" 5 #include "remoting/client/audio_player.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 queued_bytes_ -= queued_packets_.front()->data(0).size() - bytes_consumed_; 73 queued_bytes_ -= queued_packets_.front()->data(0).size() - bytes_consumed_;
74 DCHECK_GE(queued_bytes_, 0); 74 DCHECK_GE(queued_bytes_, 0);
75 delete queued_packets_.front(); 75 delete queued_packets_.front();
76 queued_packets_.pop_front(); 76 queued_packets_.pop_front();
77 bytes_consumed_ = 0; 77 bytes_consumed_ = 0;
78 } 78 }
79 } 79 }
80 80
81 // static 81 // static
82 void AudioPlayer::AudioPlayerCallback(void* samples, 82 void AudioPlayer::AudioPlayerCallback(void* samples,
83 uint32 buffer_size, 83 uint32_t buffer_size,
84 void* data) { 84 void* data) {
85 AudioPlayer* audio_player = static_cast<AudioPlayer*>(data); 85 AudioPlayer* audio_player = static_cast<AudioPlayer*>(data);
86 audio_player->FillWithSamples(samples, buffer_size); 86 audio_player->FillWithSamples(samples, buffer_size);
87 } 87 }
88 88
89 void AudioPlayer::ResetQueue() { 89 void AudioPlayer::ResetQueue() {
90 lock_.AssertAcquired(); 90 lock_.AssertAcquired();
91 STLDeleteElements(&queued_packets_); 91 STLDeleteElements(&queued_packets_);
92 queued_bytes_ = 0; 92 queued_bytes_ = 0;
93 bytes_consumed_ = 0; 93 bytes_consumed_ = 0;
94 } 94 }
95 95
96 void AudioPlayer::FillWithSamples(void* samples, uint32 buffer_size) { 96 void AudioPlayer::FillWithSamples(void* samples, uint32_t buffer_size) {
97 base::AutoLock auto_lock(lock_); 97 base::AutoLock auto_lock(lock_);
98 98
99 const size_t bytes_needed = kChannels * kSampleSizeBytes * 99 const size_t bytes_needed = kChannels * kSampleSizeBytes *
100 GetSamplesPerFrame(); 100 GetSamplesPerFrame();
101 101
102 // Make sure we don't overrun the buffer. 102 // Make sure we don't overrun the buffer.
103 CHECK_EQ(buffer_size, bytes_needed); 103 CHECK_EQ(buffer_size, bytes_needed);
104 104
105 char* next_sample = static_cast<char*>(samples); 105 char* next_sample = static_cast<char*>(samples);
106 size_t bytes_extracted = 0; 106 size_t bytes_extracted = 0;
(...skipping 21 matching lines...) Expand all
128 128
129 next_sample += bytes_to_copy; 129 next_sample += bytes_to_copy;
130 bytes_consumed_ += bytes_to_copy; 130 bytes_consumed_ += bytes_to_copy;
131 bytes_extracted += bytes_to_copy; 131 bytes_extracted += bytes_to_copy;
132 queued_bytes_ -= bytes_to_copy; 132 queued_bytes_ -= bytes_to_copy;
133 DCHECK_GE(queued_bytes_, 0); 133 DCHECK_GE(queued_bytes_, 0);
134 } 134 }
135 } 135 }
136 136
137 } // namespace remoting 137 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/audio_player.h ('k') | remoting/client/audio_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698