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

Side by Side Diff: webrtc/modules/audio_device/fine_audio_buffer.cc

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test Created 4 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 RTC_CHECK_LE(bytes_left, 0); 99 RTC_CHECK_LE(bytes_left, 0);
100 // Put the samples that were written to |buffer| but are not used in the 100 // Put the samples that were written to |buffer| but are not used in the
101 // cache. 101 // cache.
102 size_t cache_location = desired_frame_size_bytes_; 102 size_t cache_location = desired_frame_size_bytes_;
103 int8_t* cache_ptr = &buffer[cache_location]; 103 int8_t* cache_ptr = &buffer[cache_location];
104 playout_cached_bytes_ = number_of_requests * bytes_per_10_ms_ - 104 playout_cached_bytes_ = number_of_requests * bytes_per_10_ms_ -
105 (desired_frame_size_bytes_ - playout_cached_bytes_); 105 (desired_frame_size_bytes_ - playout_cached_bytes_);
106 // If playout_cached_bytes_ is larger than the cache buffer, uninitialized 106 // If playout_cached_bytes_ is larger than the cache buffer, uninitialized
107 // memory will be read. 107 // memory will be read.
108 RTC_CHECK_LE(playout_cached_bytes_, bytes_per_10_ms_); 108 RTC_CHECK_LE(playout_cached_bytes_, bytes_per_10_ms_);
109 RTC_CHECK_EQ(static_cast<size_t>(-bytes_left), playout_cached_bytes_); 109 RTC_CHECK_EQ(-bytes_left, playout_cached_bytes_);
110 playout_cached_buffer_start_ = 0; 110 playout_cached_buffer_start_ = 0;
111 memcpy(playout_cache_buffer_.get(), cache_ptr, playout_cached_bytes_); 111 memcpy(playout_cache_buffer_.get(), cache_ptr, playout_cached_bytes_);
112 } 112 }
113 113
114 void FineAudioBuffer::DeliverRecordedData(const int8_t* buffer, 114 void FineAudioBuffer::DeliverRecordedData(const int8_t* buffer,
115 size_t size_in_bytes, 115 size_t size_in_bytes,
116 int playout_delay_ms, 116 int playout_delay_ms,
117 int record_delay_ms) { 117 int record_delay_ms) {
118 // Check if the temporary buffer can store the incoming buffer. If not, 118 // Check if the temporary buffer can store the incoming buffer. If not,
119 // move the remaining (old) bytes to the beginning of the temporary buffer 119 // move the remaining (old) bytes to the beginning of the temporary buffer
(...skipping 20 matching lines...) Expand all
140 device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms, 0); 140 device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms, 0);
141 device_buffer_->DeliverRecordedData(); 141 device_buffer_->DeliverRecordedData();
142 // Read next chunk of 10ms data. 142 // Read next chunk of 10ms data.
143 record_read_pos_ += bytes_per_10_ms_; 143 record_read_pos_ += bytes_per_10_ms_;
144 // Reduce number of cached bytes with the consumed amount. 144 // Reduce number of cached bytes with the consumed amount.
145 record_cached_bytes_ -= bytes_per_10_ms_; 145 record_cached_bytes_ -= bytes_per_10_ms_;
146 } 146 }
147 } 147 }
148 148
149 } // namespace webrtc 149 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698