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

Unified Diff: media/cast/sender/audio_encoder.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 side-by-side diff with in-line comments
Download patch
Index: media/cast/sender/audio_encoder.cc
diff --git a/media/cast/sender/audio_encoder.cc b/media/cast/sender/audio_encoder.cc
index bf1811803f9bfb510c79c5b1510ca8fe2fa14173..aaf84d14425a0b558fd75e2ef205d9827670068f 100644
--- a/media/cast/sender/audio_encoder.cc
+++ b/media/cast/sender/audio_encoder.cc
@@ -97,13 +97,13 @@ class AudioEncoder::ImplBase
if (!frame_capture_time_.is_null()) {
const base::TimeDelta amount_ahead_by =
recorded_time - (frame_capture_time_ + buffer_fill_duration);
- const int64 num_frames_missed = amount_ahead_by / frame_duration_;
+ const int64_t num_frames_missed = amount_ahead_by / frame_duration_;
if (num_frames_missed > kUnderrunSkipThreshold) {
samples_dropped_from_buffer_ += buffer_fill_end_;
buffer_fill_end_ = 0;
buffer_fill_duration = base::TimeDelta();
frame_rtp_timestamp_ +=
- static_cast<uint32>(num_frames_missed * samples_per_frame_);
+ static_cast<uint32_t>(num_frames_missed * samples_per_frame_);
DVLOG(1) << "Skipping RTP timestamp ahead to account for "
<< num_frames_missed * samples_per_frame_
<< " samples' worth of underrun.";
@@ -205,14 +205,14 @@ class AudioEncoder::ImplBase
int buffer_fill_end_;
// A counter used to label EncodedFrames.
- uint32 frame_id_;
+ uint32_t frame_id_;
// The RTP timestamp for the next frame of encoded audio. This is defined as
// the number of audio samples encoded so far, plus the estimated number of
// samples that were missed due to data underruns. A receiver uses this value
// to detect gaps in the audio signal data being provided. Per the spec, RTP
// timestamp values are allowed to overflow and roll around past zero.
- uint32 frame_rtp_timestamp_;
+ uint32_t frame_rtp_timestamp_;
// The local system time associated with the start of the next frame of
// encoded audio. This value is passed on to a receiver as a reference clock
@@ -242,7 +242,7 @@ class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
sampling_rate,
sampling_rate / kDefaultFramesPerSecond, /* 10 ms frames */
callback),
- encoder_memory_(new uint8[opus_encoder_get_size(num_channels)]),
+ encoder_memory_(new uint8_t[opus_encoder_get_size(num_channels)]),
opus_encoder_(reinterpret_cast<OpusEncoder*>(encoder_memory_.get())),
buffer_(new float[num_channels * samples_per_frame_]) {
if (ImplBase::operational_status_ != STATUS_UNINITIALIZED ||
@@ -289,12 +289,9 @@ class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
bool EncodeFromFilledBuffer(std::string* out) final {
out->resize(kOpusMaxPayloadSize);
- const opus_int32 result =
- opus_encode_float(opus_encoder_,
- buffer_.get(),
- samples_per_frame_,
- reinterpret_cast<uint8*>(string_as_array(out)),
- kOpusMaxPayloadSize);
+ const opus_int32 result = opus_encode_float(
+ opus_encoder_, buffer_.get(), samples_per_frame_,
+ reinterpret_cast<uint8_t*>(string_as_array(out)), kOpusMaxPayloadSize);
if (result > 1) {
out->resize(result);
return true;
@@ -318,7 +315,7 @@ class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
duration == base::TimeDelta::FromMilliseconds(60);
}
- const scoped_ptr<uint8[]> encoder_memory_;
+ const scoped_ptr<uint8_t[]> encoder_memory_;
OpusEncoder* const opus_encoder_;
const scoped_ptr<float[]> buffer_;
@@ -492,8 +489,8 @@ class AudioEncoder::AppleAacImpl : public AudioEncoder::ImplBase {
// Allocate a buffer to store one access unit. This is the only location
// where the implementation modifies |access_unit_buffer_|.
- const_cast<scoped_ptr<uint8[]>&>(access_unit_buffer_)
- .reset(new uint8[max_access_unit_size]);
+ const_cast<scoped_ptr<uint8_t[]>&>(access_unit_buffer_)
+ .reset(new uint8_t[max_access_unit_size]);
// Initialize the converter ABL. Note that the buffer size has to be set
// before every encode operation, since the field is modified to indicate
@@ -512,7 +509,7 @@ class AudioEncoder::AppleAacImpl : public AudioEncoder::ImplBase {
nullptr) != noErr) {
return false;
}
- scoped_ptr<uint8[]> cookie_data(new uint8[cookie_size]);
+ scoped_ptr<uint8_t[]> cookie_data(new uint8_t[cookie_size]);
if (AudioConverterGetProperty(converter_,
kAudioConverterCompressionMagicCookie,
&cookie_size,
@@ -701,7 +698,7 @@ class AudioEncoder::AppleAacImpl : public AudioEncoder::ImplBase {
// A buffer that holds one AAC access unit. Initialized in |Initialize| once
// the maximum access unit size is known.
- const scoped_ptr<uint8[]> access_unit_buffer_;
+ const scoped_ptr<uint8_t[]> access_unit_buffer_;
// The maximum size of an access unit that the encoder can emit.
const uint32_t max_access_unit_size_;
@@ -749,7 +746,7 @@ class AudioEncoder::Pcm16Impl : public AudioEncoder::ImplBase {
sampling_rate,
sampling_rate / kDefaultFramesPerSecond, /* 10 ms frames */
callback),
- buffer_(new int16[num_channels * samples_per_frame_]) {
+ buffer_(new int16_t[num_channels * samples_per_frame_]) {
if (ImplBase::operational_status_ != STATUS_UNINITIALIZED)
return;
operational_status_ = STATUS_INITIALIZED;
@@ -763,25 +760,23 @@ class AudioEncoder::Pcm16Impl : public AudioEncoder::ImplBase {
int buffer_fill_offset,
int num_samples) final {
audio_bus->ToInterleavedPartial(
- source_offset,
- num_samples,
- sizeof(int16),
+ source_offset, num_samples, sizeof(int16_t),
buffer_.get() + buffer_fill_offset * num_channels_);
}
bool EncodeFromFilledBuffer(std::string* out) final {
// Output 16-bit PCM integers in big-endian byte order.
- out->resize(num_channels_ * samples_per_frame_ * sizeof(int16));
- const int16* src = buffer_.get();
- const int16* const src_end = src + num_channels_ * samples_per_frame_;
- uint16* dest = reinterpret_cast<uint16*>(&out->at(0));
+ out->resize(num_channels_ * samples_per_frame_ * sizeof(int16_t));
+ const int16_t* src = buffer_.get();
+ const int16_t* const src_end = src + num_channels_ * samples_per_frame_;
+ uint16_t* dest = reinterpret_cast<uint16_t*>(&out->at(0));
for (; src < src_end; ++src, ++dest)
*dest = base::HostToNet16(*src);
return true;
}
private:
- const scoped_ptr<int16[]> buffer_;
+ const scoped_ptr<int16_t[]> buffer_;
DISALLOW_COPY_AND_ASSIGN(Pcm16Impl);
};

Powered by Google App Engine
This is Rietveld 408576698