diff options
Diffstat (limited to 'media')
670 files changed, 5775 insertions, 5874 deletions
diff --git a/media/audio/alsa/alsa_input.cc b/media/audio/alsa/alsa_input.cc index 67f23593..a6b4cc3 100644 --- a/media/audio/alsa/alsa_input.cc +++ b/media/audio/alsa/alsa_input.cc @@ -4,7 +4,6 @@ #include "media/audio/alsa/alsa_input.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" @@ -60,7 +59,7 @@ bool AlsaPcmInputStream::Open() { return false; } - uint32 latency_us = + uint32_t latency_us = buffer_duration_.InMicroseconds() * kNumPacketsInRingBuffer; // Use the same minimum required latency as output. @@ -87,7 +86,7 @@ bool AlsaPcmInputStream::Open() { } if (device_handle_) { - audio_buffer_.reset(new uint8[bytes_per_buffer_]); + audio_buffer_.reset(new uint8_t[bytes_per_buffer_]); // Open the microphone mixer. mixer_handle_ = alsa_util::OpenMixer(wrapper_, device_name_); @@ -196,8 +195,8 @@ void AlsaPcmInputStream::ReadAudio() { } int num_buffers = frames / params_.frames_per_buffer(); - uint32 hardware_delay_bytes = - static_cast<uint32>(GetCurrentDelay() * params_.GetBytesPerFrame()); + uint32_t hardware_delay_bytes = + static_cast<uint32_t>(GetCurrentDelay() * params_.GetBytesPerFrame()); double normalized_volume = 0.0; // Update the AGC volume level once every second. Note that, |volume| is diff --git a/media/audio/alsa/alsa_input.h b/media/audio/alsa/alsa_input.h index b04e628..b9272c7a 100644 --- a/media/audio/alsa/alsa_input.h +++ b/media/audio/alsa/alsa_input.h @@ -81,7 +81,7 @@ class AlsaPcmInputStream : public AgcAudioStream<AudioInputStream> { snd_pcm_t* device_handle_; // Handle to the ALSA PCM recording device. snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer. snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element. - scoped_ptr<uint8[]> audio_buffer_; // Buffer used for reading audio data. + scoped_ptr<uint8_t[]> audio_buffer_; // Buffer used for reading audio data. bool read_callback_behind_schedule_; scoped_ptr<AudioBus> audio_bus_; diff --git a/media/audio/alsa/alsa_output.cc b/media/audio/alsa/alsa_output.cc index 046c9bc..604f2d8 100644 --- a/media/audio/alsa/alsa_output.cc +++ b/media/audio/alsa/alsa_output.cc @@ -78,7 +78,7 @@ static const ChannelLayout kDefaultOutputChannelLayout = CHANNEL_LAYOUT_STEREO; // TODO(ajwong): The source data should have enough info to tell us if we want // surround41 versus surround51, etc., instead of needing us to guess based on // channel number. Fix API to pass that data down. -static const char* GuessSpecificDeviceName(uint32 channels) { +static const char* GuessSpecificDeviceName(uint32_t channels) { switch (channels) { case 8: return "surround71"; @@ -131,7 +131,7 @@ const char AlsaPcmOutputStream::kPlugPrefix[] = "plug:"; // We use 40ms as our minimum required latency. If it is needed, we may be able // to get it down to 20ms. -const uint32 AlsaPcmOutputStream::kMinLatencyMicros = 40 * 1000; +const uint32_t AlsaPcmOutputStream::kMinLatencyMicros = 40 * 1000; AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, const AudioParameters& params, @@ -222,7 +222,7 @@ bool AlsaPcmOutputStream::Open() { bytes_per_output_frame_ = channel_mixer_ ? mixed_audio_bus_->channels() * bytes_per_sample_ : bytes_per_frame_; - uint32 output_packet_size = frames_per_packet_ * bytes_per_output_frame_; + uint32_t output_packet_size = frames_per_packet_ * bytes_per_output_frame_; buffer_.reset(new media::SeekableBuffer(0, output_packet_size)); // Get alsa buffer size. @@ -358,7 +358,7 @@ void AlsaPcmOutputStream::BufferPacket(bool* source_exhausted) { if (!buffer_->forward_bytes()) { // Before making a request to source for data we need to determine the // delay (in bytes) for the requested data to be played. - const uint32 hardware_delay = GetCurrentDelay() * bytes_per_frame_; + const uint32_t hardware_delay = GetCurrentDelay() * bytes_per_frame_; scoped_refptr<media::DataBuffer> packet = new media::DataBuffer(packet_size_); @@ -429,7 +429,7 @@ void AlsaPcmOutputStream::WritePacket() { CHECK_EQ(buffer_->forward_bytes() % bytes_per_output_frame_, 0u); - const uint8* buffer_data; + const uint8_t* buffer_data; int buffer_size; if (buffer_->GetCurrentChunk(&buffer_data, &buffer_size)) { snd_pcm_sframes_t frames = std::min( @@ -496,8 +496,8 @@ void AlsaPcmOutputStream::ScheduleNextWrite(bool source_exhausted) { if (stop_stream_ || state() != kIsPlaying) return; - const uint32 kTargetFramesAvailable = alsa_buffer_frames_ / 2; - uint32 available_frames = GetAvailableFrames(); + const uint32_t kTargetFramesAvailable = alsa_buffer_frames_ / 2; + uint32_t available_frames = GetAvailableFrames(); base::TimeDelta next_fill_time; if (buffer_->forward_bytes() && available_frames) { @@ -536,7 +536,7 @@ base::TimeDelta AlsaPcmOutputStream::FramesToTimeDelta(int frames, frames * base::Time::kMicrosecondsPerSecond / sample_rate); } -std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { +std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32_t channels) { // Constants specified by the ALSA API for device hints. static const int kGetAllDevices = -1; static const char kPcmInterfaceName[] = "pcm"; @@ -642,7 +642,7 @@ snd_pcm_sframes_t AlsaPcmOutputStream::GetAvailableFrames() { << wrapper_->StrError(available_frames); return 0; } - if (static_cast<uint32>(available_frames) > alsa_buffer_frames_ * 2) { + if (static_cast<uint32_t>(available_frames) > alsa_buffer_frames_ * 2) { LOG(ERROR) << "ALSA returned " << available_frames << " of " << alsa_buffer_frames_ << " frames available."; return alsa_buffer_frames_; @@ -699,7 +699,7 @@ snd_pcm_t* AlsaPcmOutputStream::AutoSelectDevice(unsigned int latency) { // output to have the correct ordering according to Lennart. For the channel // formats that we know how to downmix from (3 channel to 8 channel), setup // downmixing. - uint32 default_channels = channels_; + uint32_t default_channels = channels_; if (default_channels > 2) { channel_mixer_.reset( new ChannelMixer(channel_layout_, kDefaultOutputChannelLayout)); @@ -777,7 +777,7 @@ bool AlsaPcmOutputStream::IsOnAudioThread() const { } int AlsaPcmOutputStream::RunDataCallback(AudioBus* audio_bus, - uint32 total_bytes_delay) { + uint32_t total_bytes_delay) { TRACE_EVENT0("audio", "AlsaPcmOutputStream::RunDataCallback"); if (source_callback_) diff --git a/media/audio/alsa/alsa_output.h b/media/audio/alsa/alsa_output.h index fd0910a..6ef3108 100644 --- a/media/audio/alsa/alsa_output.h +++ b/media/audio/alsa/alsa_output.h @@ -58,7 +58,7 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { static const char kPlugPrefix[]; // The minimum latency that is accepted by the device. - static const uint32 kMinLatencyMicros; + static const uint32_t kMinLatencyMicros; // Create a PCM Output stream for the ALSA device identified by // |device_name|. The AlsaPcmOutputStream uses |wrapper| to communicate with @@ -128,13 +128,13 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { // Utility functions for talking with the ALSA API. static base::TimeDelta FramesToTimeDelta(int frames, double sample_rate); - std::string FindDeviceForChannels(uint32 channels); + std::string FindDeviceForChannels(uint32_t channels); snd_pcm_sframes_t GetAvailableFrames(); snd_pcm_sframes_t GetCurrentDelay(); // Attempts to find the best matching linux audio device for the given number // of channels. This function will set |device_name_| and |channel_mixer_|. - snd_pcm_t* AutoSelectDevice(uint32 latency); + snd_pcm_t* AutoSelectDevice(uint32_t latency); // Functions to safeguard state transitions. All changes to the object state // should go through these functions. @@ -154,7 +154,7 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { // is passed into the output stream, but ownership is not transfered which // requires a synchronization on access of the |source_callback_| to avoid // using a deleted callback. - int RunDataCallback(AudioBus* audio_bus, uint32 total_bytes_delay); + int RunDataCallback(AudioBus* audio_bus, uint32_t total_bytes_delay); void RunErrorCallback(int code); // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to @@ -165,18 +165,18 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { // since they are constants. const std::string requested_device_name_; const snd_pcm_format_t pcm_format_; - const uint32 channels_; + const uint32_t channels_; const ChannelLayout channel_layout_; - const uint32 sample_rate_; - const uint32 bytes_per_sample_; - const uint32 bytes_per_frame_; + const uint32_t sample_rate_; + const uint32_t bytes_per_sample_; + const uint32_t bytes_per_frame_; // Device configuration data. Populated after OpenTask() completes. std::string device_name_; - uint32 packet_size_; + uint32_t packet_size_; base::TimeDelta latency_; - uint32 bytes_per_output_frame_; - uint32 alsa_buffer_frames_; + uint32_t bytes_per_output_frame_; + uint32_t alsa_buffer_frames_; // Flag indicating the code should stop reading from the data source or // writing to the ALSA device. This is set because the device has entered @@ -199,7 +199,7 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { snd_pcm_t* playback_handle_; scoped_ptr<media::SeekableBuffer> buffer_; - uint32 frames_per_packet_; + uint32_t frames_per_packet_; InternalState state_; float volume_; // Volume level from 0.0 to 1.0. diff --git a/media/audio/alsa/alsa_output_unittest.cc b/media/audio/alsa/alsa_output_unittest.cc index af2c46a..59cd889 100644 --- a/media/audio/alsa/alsa_output_unittest.cc +++ b/media/audio/alsa/alsa_output_unittest.cc @@ -114,7 +114,7 @@ class AlsaPcmOutputStreamTest : public testing::Test { } AlsaPcmOutputStream* CreateStream(ChannelLayout layout, - int32 samples_per_packet) { + int32_t samples_per_packet) { AudioParameters params(kTestFormat, layout, kTestSampleRate, kTestBitsPerSample, samples_per_packet); return new AlsaPcmOutputStream(kTestDeviceName, @@ -150,7 +150,7 @@ class AlsaPcmOutputStreamTest : public testing::Test { static const AudioParameters::Format kTestFormat; static const char kTestDeviceName[]; static const char kDummyMessage[]; - static const uint32 kTestFramesPerPacket; + static const uint32_t kTestFramesPerPacket; static const int kTestPacketSize; static const int kTestFailedErrno; static snd_pcm_t* const kFakeHandle; @@ -186,7 +186,7 @@ const AudioParameters::Format AlsaPcmOutputStreamTest::kTestFormat = AudioParameters::AUDIO_PCM_LINEAR; const char AlsaPcmOutputStreamTest::kTestDeviceName[] = "TestDevice"; const char AlsaPcmOutputStreamTest::kDummyMessage[] = "dummy"; -const uint32 AlsaPcmOutputStreamTest::kTestFramesPerPacket = 1000; +const uint32_t AlsaPcmOutputStreamTest::kTestFramesPerPacket = 1000; const int AlsaPcmOutputStreamTest::kTestPacketSize = AlsaPcmOutputStreamTest::kTestFramesPerPacket * AlsaPcmOutputStreamTest::kTestBytesPerFrame; @@ -273,8 +273,9 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { // Test that having more packets ends up with a latency based on packet size. const int kOverMinLatencyPacketSize = kPacketFramesInMinLatency + 1; - int64 expected_micros = AlsaPcmOutputStream::FramesToTimeDelta( - kOverMinLatencyPacketSize * 2, kTestSampleRate).InMicroseconds(); + int64_t expected_micros = AlsaPcmOutputStream::FramesToTimeDelta( + kOverMinLatencyPacketSize * 2, kTestSampleRate) + .InMicroseconds(); EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), Return(0))); @@ -302,8 +303,9 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { } TEST_F(AlsaPcmOutputStreamTest, OpenClose) { - int64 expected_micros = AlsaPcmOutputStream::FramesToTimeDelta( - 2 * kTestFramesPerPacket, kTestSampleRate).InMicroseconds(); + int64_t expected_micros = AlsaPcmOutputStream::FramesToTimeDelta( + 2 * kTestFramesPerPacket, kTestSampleRate) + .InMicroseconds(); // Open() call opens the playback device, sets the parameters, posts a task // with the resulting configuration data, and transitions the object state to diff --git a/media/audio/alsa/alsa_util.cc b/media/audio/alsa/alsa_util.cc index ffc3a39..f556dc0 100644 --- a/media/audio/alsa/alsa_util.cc +++ b/media/audio/alsa/alsa_util.cc @@ -4,7 +4,6 @@ #include "media/audio/alsa/alsa_util.h" - #include "base/logging.h" #include "media/audio/alsa/alsa_wrapper.h" diff --git a/media/audio/alsa/alsa_wrapper.cc b/media/audio/alsa/alsa_wrapper.cc index 4e229a5..16fe9ea 100644 --- a/media/audio/alsa/alsa_wrapper.cc +++ b/media/audio/alsa/alsa_wrapper.cc @@ -4,7 +4,6 @@ #include "media/audio/alsa/alsa_wrapper.h" - namespace media { AlsaWrapper::AlsaWrapper() { diff --git a/media/audio/alsa/alsa_wrapper.h b/media/audio/alsa/alsa_wrapper.h index d8b817a..9539bf1 100644 --- a/media/audio/alsa/alsa_wrapper.h +++ b/media/audio/alsa/alsa_wrapper.h @@ -11,7 +11,7 @@ #include <alsa/asoundlib.h> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" namespace media { diff --git a/media/audio/android/audio_android_unittest.cc b/media/audio/android/audio_android_unittest.cc index 68b53ed..1946219 100644 --- a/media/audio/android/audio_android_unittest.cc +++ b/media/audio/android/audio_android_unittest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/android/build_info.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" @@ -153,7 +152,7 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { MOCK_METHOD4(OnData, void(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume)); MOCK_METHOD1(OnError, void(AudioInputStream* stream)); }; @@ -248,7 +247,7 @@ class FileAudioSink : public AudioInputStream::AudioInputCallback { ~FileAudioSink() override { int bytes_written = 0; while (bytes_written < buffer_->forward_capacity()) { - const uint8* chunk; + const uint8_t* chunk; int chunk_size; // Stop writing if no more data is available. @@ -267,10 +266,10 @@ class FileAudioSink : public AudioInputStream::AudioInputCallback { // AudioInputStream::AudioInputCallback implementation. void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { const int num_samples = src->frames() * src->channels(); - scoped_ptr<int16> interleaved(new int16[num_samples]); + scoped_ptr<int16_t> interleaved(new int16_t[num_samples]); const int bytes_per_sample = sizeof(*interleaved); src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); @@ -278,7 +277,7 @@ class FileAudioSink : public AudioInputStream::AudioInputCallback { // fwrite() calls in the audio callback. The complete buffer will be // written to file in the destructor. const int size = bytes_per_sample * num_samples; - if (!buffer_->Append((const uint8*)interleaved.get(), size)) + if (!buffer_->Append((const uint8_t*)interleaved.get(), size)) event_->Signal(); } @@ -307,7 +306,7 @@ class FullDuplexAudioSinkSource // Start with a reasonably small FIFO size. It will be increased // dynamically during the test if required. fifo_.reset(new media::SeekableBuffer(0, 2 * params.GetBytesPerBuffer())); - buffer_.reset(new uint8[params_.GetBytesPerBuffer()]); + buffer_.reset(new uint8_t[params_.GetBytesPerBuffer()]); } ~FullDuplexAudioSinkSource() override {} @@ -315,14 +314,14 @@ class FullDuplexAudioSinkSource // AudioInputStream::AudioInputCallback implementation void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { const base::TimeTicks now_time = base::TimeTicks::Now(); const int diff = (now_time - previous_time_).InMilliseconds(); EXPECT_EQ(params_.bits_per_sample(), 16); const int num_samples = src->frames() * src->channels(); - scoped_ptr<int16> interleaved(new int16[num_samples]); + scoped_ptr<int16_t> interleaved(new int16_t[num_samples]); const int bytes_per_sample = sizeof(*interleaved); src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); const int size = bytes_per_sample * num_samples; @@ -347,7 +346,7 @@ class FullDuplexAudioSinkSource // Append new data to the FIFO and extend the size if the max capacity // was exceeded. Flush the FIFO when extended just in case. - if (!fifo_->Append((const uint8*)interleaved.get(), size)) { + if (!fifo_->Append((const uint8_t*)interleaved.get(), size)) { fifo_->set_forward_capacity(2 * fifo_->forward_capacity()); fifo_->Clear(); } @@ -402,7 +401,7 @@ class FullDuplexAudioSinkSource base::TimeTicks previous_time_; base::Lock lock_; scoped_ptr<media::SeekableBuffer> fifo_; - scoped_ptr<uint8[]> buffer_; + scoped_ptr<uint8_t[]> buffer_; bool started_; DISALLOW_COPY_AND_ASSIGN(FullDuplexAudioSinkSource); diff --git a/media/audio/android/audio_record_input.cc b/media/audio/android/audio_record_input.cc index cc759ca..90102ff 100644 --- a/media/audio/android/audio_record_input.cc +++ b/media/audio/android/audio_record_input.cc @@ -42,8 +42,8 @@ void AudioRecordInputStream::CacheDirectBufferAddress( const JavaParamRef<jobject>& obj, const JavaParamRef<jobject>& byte_buffer) { DCHECK(thread_checker_.CalledOnValidThread()); - direct_buffer_address_ = static_cast<uint8*>( - env->GetDirectBufferAddress(byte_buffer)); + direct_buffer_address_ = + static_cast<uint8_t*>(env->GetDirectBufferAddress(byte_buffer)); } // static diff --git a/media/audio/android/audio_record_input.h b/media/audio/android/audio_record_input.h index b716f8a..6b0b36c 100644 --- a/media/audio/android/audio_record_input.h +++ b/media/audio/android/audio_record_input.h @@ -70,7 +70,7 @@ class MEDIA_EXPORT AudioRecordInputStream : public AudioInputStream { AudioInputCallback* callback_; // Owned by j_audio_record_. - uint8* direct_buffer_address_; + uint8_t* direct_buffer_address_; scoped_ptr<media::AudioBus> audio_bus_; int bytes_per_sample_; diff --git a/media/audio/android/opensles_input.cc b/media/audio/android/opensles_input.cc index 51588a3..6a37cbfc 100644 --- a/media/audio/android/opensles_input.cc +++ b/media/audio/android/opensles_input.cc @@ -327,7 +327,7 @@ void OpenSLESInputStream::SetupAudioBuffer() { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!audio_data_[0]); for (int i = 0; i < kMaxNumOfBuffersInQueue; ++i) { - audio_data_[i] = new uint8[buffer_size_bytes_]; + audio_data_[i] = new uint8_t[buffer_size_bytes_]; } } diff --git a/media/audio/android/opensles_input.h b/media/audio/android/opensles_input.h index e4ec082..e8751f6 100644 --- a/media/audio/android/opensles_input.h +++ b/media/audio/android/opensles_input.h @@ -89,7 +89,7 @@ class OpenSLESInputStream : public AudioInputStream { // Audio buffers that are allocated in the constructor based on // info from audio parameters. - uint8* audio_data_[kMaxNumOfBuffersInQueue]; + uint8_t* audio_data_[kMaxNumOfBuffersInQueue]; int active_buffer_index_; int buffer_size_bytes_; diff --git a/media/audio/android/opensles_output.cc b/media/audio/android/opensles_output.cc index 7fffe3b..2a89f945 100644 --- a/media/audio/android/opensles_output.cc +++ b/media/audio/android/opensles_output.cc @@ -330,7 +330,7 @@ void OpenSLESOutputStream::FillBufferQueueNoLock() { // Read data from the registered client source. // TODO(henrika): Investigate if it is possible to get a more accurate // delay estimation. - const uint32 hardware_delay = buffer_size_bytes_; + const uint32_t hardware_delay = buffer_size_bytes_; int frames_filled = callback_->OnMoreData(audio_bus_.get(), hardware_delay, 0); if (frames_filled <= 0) { @@ -365,7 +365,7 @@ void OpenSLESOutputStream::SetupAudioBuffer() { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!audio_data_[0]); for (int i = 0; i < kMaxNumOfBuffersInQueue; ++i) { - audio_data_[i] = new uint8[buffer_size_bytes_]; + audio_data_[i] = new uint8_t[buffer_size_bytes_]; } } diff --git a/media/audio/android/opensles_output.h b/media/audio/android/opensles_output.h index 0fef1bd..bc500f1 100644 --- a/media/audio/android/opensles_output.h +++ b/media/audio/android/opensles_output.h @@ -98,7 +98,7 @@ class OpenSLESOutputStream : public AudioOutputStream { // Audio buffers that are allocated in the constructor based on // info from audio parameters. - uint8* audio_data_[kMaxNumOfBuffersInQueue]; + uint8_t* audio_data_[kMaxNumOfBuffersInQueue]; int active_buffer_index_; size_t buffer_size_bytes_; diff --git a/media/audio/android/opensles_wrapper.cc b/media/audio/android/opensles_wrapper.cc index b8f9ea4..c2317b3 100644 --- a/media/audio/android/opensles_wrapper.cc +++ b/media/audio/android/opensles_wrapper.cc @@ -14,7 +14,6 @@ #include <SLES/OpenSLES_Android.h> #undef const -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/native_library.h" diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index 54eda2f..dc207b0 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -507,7 +507,7 @@ void AudioInputController::DoCheckForNoData() { void AudioInputController::OnData(AudioInputStream* stream, const AudioBus* source, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) { // |input_writer_| should only be accessed on the audio thread, but as a means // to avoid copying data and posting on the audio thread, we just check for diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h index 58e0464..df38c16 100644 --- a/media/audio/audio_input_controller.h +++ b/media/audio/audio_input_controller.h @@ -137,7 +137,7 @@ class MEDIA_EXPORT AudioInputController virtual void Write(const AudioBus* data, double volume, bool key_pressed, - uint32 hardware_delay_bytes) = 0; + uint32_t hardware_delay_bytes) = 0; // Close this synchronous writer. virtual void Close() = 0; @@ -225,7 +225,7 @@ class MEDIA_EXPORT AudioInputController // device-specific implementation. void OnData(AudioInputStream* stream, const AudioBus* source, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override; void OnError(AudioInputStream* stream) override; diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc index 3f14ae4..cd17ca6 100644 --- a/media/audio/audio_input_controller_unittest.cc +++ b/media/audio/audio_input_controller_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/synchronization/waitable_event.h" diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc index 074291f..91f1c68 100644 --- a/media/audio/audio_input_device.cc +++ b/media/audio/audio_input_device.cc @@ -40,7 +40,7 @@ class AudioInputDevice::AudioThreadCallback private: int current_segment_id_; - uint32 last_buffer_id_; + uint32_t last_buffer_id_; ScopedVector<media::AudioBus> audio_buses_; CaptureCallback* capture_callback_; @@ -286,7 +286,7 @@ void AudioInputDevice::AudioThreadCallback::MapSharedMemory() { shared_memory_.Map(memory_length_); // Create vector of audio buses by wrapping existing blocks of memory. - uint8* ptr = static_cast<uint8*>(shared_memory_.memory()); + uint8_t* ptr = static_cast<uint8_t*>(shared_memory_.memory()); for (int i = 0; i < total_segments_; ++i) { media::AudioInputBuffer* buffer = reinterpret_cast<media::AudioInputBuffer*>(ptr); @@ -301,7 +301,7 @@ void AudioInputDevice::AudioThreadCallback::Process(uint32_t pending_data) { // The shared memory represents parameters, size of the data buffer and the // actual data buffer containing audio data. Map the memory into this // structure and parse out parameters and the data area. - uint8* ptr = static_cast<uint8*>(shared_memory_.memory()); + uint8_t* ptr = static_cast<uint8_t*>(shared_memory_.memory()); ptr += current_segment_id_ * segment_length_; AudioInputBuffer* buffer = reinterpret_cast<AudioInputBuffer*>(ptr); diff --git a/media/audio/audio_input_device.h b/media/audio/audio_input_device.h index c1bee10..b1b03ac 100644 --- a/media/audio/audio_input_device.h +++ b/media/audio/audio_input_device.h @@ -55,7 +55,6 @@ #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/memory/shared_memory.h" diff --git a/media/audio/audio_input_ipc.h b/media/audio/audio_input_ipc.h index f9784f5..cf8da50 100644 --- a/media/audio/audio_input_ipc.h +++ b/media/audio/audio_input_ipc.h @@ -70,7 +70,7 @@ class MEDIA_EXPORT AudioInputIPC { int session_id, const AudioParameters& params, bool automatic_gain_control, - uint32 total_segments) = 0; + uint32_t total_segments) = 0; // Corresponds to a call to AudioInputController::Record() on the server side. virtual void RecordStream() = 0; diff --git a/media/audio/audio_input_unittest.cc b/media/audio/audio_input_unittest.cc index dc1f720..cfa7084 100644 --- a/media/audio/audio_input_unittest.cc +++ b/media/audio/audio_input_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/environment.h" #include "base/memory/scoped_ptr.h" @@ -27,7 +26,7 @@ class TestInputCallback : public AudioInputStream::AudioInputCallback { } void OnData(AudioInputStream* stream, const AudioBus* source, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { ++callback_count_; } diff --git a/media/audio/audio_io.h b/media/audio/audio_io.h index 45af3d2..b9665f8 100644 --- a/media/audio/audio_io.h +++ b/media/audio/audio_io.h @@ -5,7 +5,6 @@ #ifndef MEDIA_AUDIO_AUDIO_IO_H_ #define MEDIA_AUDIO_AUDIO_IO_H_ -#include "base/basictypes.h" #include "media/base/audio_bus.h" // Low-level audio output support. To make sound there are 3 objects involved: @@ -112,15 +111,15 @@ class MEDIA_EXPORT AudioInputStream { // TODO(henrika): should be pure virtual when old OnData() is phased out. virtual void OnData(AudioInputStream* stream, const AudioBus* source, - uint32 hardware_delay_bytes, - double volume) {}; + uint32_t hardware_delay_bytes, + double volume){}; // TODO(henrika): don't use; to be removed. virtual void OnData(AudioInputStream* stream, - const uint8* src, - uint32 size, - uint32 hardware_delay_bytes, - double volume) {}; + const uint8_t* src, + uint32_t size, + uint32_t hardware_delay_bytes, + double volume){}; // There was an error while recording audio. The audio sink cannot be // destroyed yet. No direct action needed by the AudioInputStream, but it diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc index b47c785..9598697 100644 --- a/media/audio/audio_low_latency_input_output_unittest.cc +++ b/media/audio/audio_low_latency_input_output_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" @@ -184,7 +183,7 @@ class FullDuplexAudioSinkSource // AudioInputStream::AudioInputCallback. void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { base::AutoLock lock(lock_); @@ -230,7 +229,7 @@ class FullDuplexAudioSinkSource } int size; - const uint8* source; + const uint8_t* source; // Read the data from the seekable media buffer which contains // captured data at the same size and sample rate as the output side. if (buffer_->GetCurrentChunk(&source, &size) && size > 0) { @@ -251,7 +250,7 @@ class FullDuplexAudioSinkSource protected: // Converts from bytes to milliseconds taking the sample rate and size // of an audio frame into account. - int BytesToMilliseconds(uint32 delay_bytes) const { + int BytesToMilliseconds(uint32_t delay_bytes) const { return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); } diff --git a/media/audio/audio_manager.h b/media/audio/audio_manager.h index 858654f..776b77f 100644 --- a/media/audio/audio_manager.h +++ b/media/audio/audio_manager.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "media/audio/audio_device_name.h" diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc index 9addca8..2e1eedf 100644 --- a/media/audio/audio_output_controller_unittest.cc +++ b/media/audio/audio_output_controller_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/environment.h" #include "base/logging.h" diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc index cc0804b..418736f 100644 --- a/media/audio/audio_output_device.cc +++ b/media/audio/audio_output_device.cc @@ -33,7 +33,7 @@ class AudioOutputDevice::AudioThreadCallback private: AudioRendererSink::RenderCallback* render_callback_; scoped_ptr<AudioBus> output_bus_; - uint64 callback_num_; + uint64_t callback_num_; DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); }; diff --git a/media/audio/audio_output_device.h b/media/audio/audio_output_device.h index fd1676b..d8e5425 100644 --- a/media/audio/audio_output_device.h +++ b/media/audio/audio_output_device.h @@ -64,7 +64,6 @@ #include <string> -#include "base/basictypes.h" #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/memory/shared_memory.h" diff --git a/media/audio/audio_output_dispatcher.h b/media/audio/audio_output_dispatcher.h index 59521c7..74f55c7 100644 --- a/media/audio/audio_output_dispatcher.h +++ b/media/audio/audio_output_dispatcher.h @@ -18,7 +18,6 @@ #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/audio/audio_io.h" #include "media/audio/audio_manager.h" diff --git a/media/audio/audio_output_dispatcher_impl.h b/media/audio/audio_output_dispatcher_impl.h index a2782f0..0b1a7c5 100644 --- a/media/audio/audio_output_dispatcher_impl.h +++ b/media/audio/audio_output_dispatcher_impl.h @@ -16,7 +16,6 @@ #include <map> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/timer/timer.h" #include "media/audio/audio_io.h" diff --git a/media/audio/audio_output_proxy.h b/media/audio/audio_output_proxy.h index d4fd56c..7e93736 100644 --- a/media/audio/audio_output_proxy.h +++ b/media/audio/audio_output_proxy.h @@ -5,7 +5,6 @@ #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_ #define MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/threading/non_thread_safe.h" diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc index ba33835..e007d15 100644 --- a/media/audio/audio_output_resampler.cc +++ b/media/audio/audio_output_resampler.cc @@ -58,7 +58,7 @@ class OnMoreDataConverter // Last |total_bytes_delay| received via OnMoreData(), used to correct // playback delay by ProvideInput() and passed on to |source_callback_|. - uint32 current_total_bytes_delay_; + uint32_t current_total_bytes_delay_; const int input_bytes_per_second_; @@ -387,7 +387,7 @@ double OnMoreDataConverter::ProvideInput(AudioBus* dest, // Adjust playback delay to include |buffer_delay|. // TODO(dalecurtis): Stop passing bytes around, it doesn't make sense since // AudioBus is just float data. Use TimeDelta instead. - uint32 new_total_bytes_delay = base::saturated_cast<uint32>( + uint32_t new_total_bytes_delay = base::saturated_cast<uint32_t>( io_ratio_ * (current_total_bytes_delay_ + buffer_delay.InSecondsF() * input_bytes_per_second_)); diff --git a/media/audio/audio_output_resampler.h b/media/audio/audio_output_resampler.h index 18d4905..14c056f 100644 --- a/media/audio/audio_output_resampler.h +++ b/media/audio/audio_output_resampler.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" #include "base/timer/timer.h" diff --git a/media/audio/audio_parameters.cc b/media/audio/audio_parameters.cc index 14c3214..08e5825 100644 --- a/media/audio/audio_parameters.cc +++ b/media/audio/audio_parameters.cc @@ -78,7 +78,7 @@ int AudioParameters::GetBytesPerFrame() const { } base::TimeDelta AudioParameters::GetBufferDuration() const { - return base::TimeDelta::FromMicroseconds(static_cast<int64>( + return base::TimeDelta::FromMicroseconds(static_cast<int64_t>( frames_per_buffer_ * base::Time::kMicrosecondsPerSecond / static_cast<float>(sample_rate_))); } diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h index f936881..e1ac6a5 100644 --- a/media/audio/audio_parameters.h +++ b/media/audio/audio_parameters.h @@ -8,7 +8,6 @@ #include <stdint.h> #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/time/time.h" #include "media/audio/point.h" @@ -57,11 +56,11 @@ static_assert(sizeof(AudioOutputBufferParameters) % struct MEDIA_EXPORT AudioInputBuffer { AudioInputBufferParameters params; - int8 audio[1]; + int8_t audio[1]; }; struct MEDIA_EXPORT AudioOutputBuffer { AudioOutputBufferParameters params; - int8 audio[1]; + int8_t audio[1]; }; class MEDIA_EXPORT AudioParameters { diff --git a/media/audio/audio_parameters_unittest.cc b/media/audio/audio_parameters_unittest.cc index 71d23ec..fa65a5c 100644 --- a/media/audio/audio_parameters_unittest.cc +++ b/media/audio/audio_parameters_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/strings/string_number_conversions.h" #include "media/audio/audio_parameters.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/media/audio/cras/cras_input.cc b/media/audio/cras/cras_input.cc index 335417f..d9fff0b 100644 --- a/media/audio/cras/cras_input.cc +++ b/media/audio/cras/cras_input.cc @@ -6,7 +6,6 @@ #include <math.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/time/time.h" #include "media/audio/audio_manager.h" @@ -163,7 +162,7 @@ void CrasInputStream::Start(AudioInputCallback* callback) { // Initialize channel layout to all -1 to indicate that none of // the channels is set in the layout. - int8 layout[CRAS_CH_MAX]; + int8_t layout[CRAS_CH_MAX]; for (size_t i = 0; i < arraysize(layout); ++i) layout[i] = -1; @@ -240,7 +239,7 @@ void CrasInputStream::Stop() { // Static callback asking for samples. Run on high priority thread. int CrasInputStream::SamplesReady(cras_client* client, cras_stream_id_t stream_id, - uint8* samples, + uint8_t* samples, size_t frames, const timespec* sample_ts, void* arg) { @@ -260,7 +259,7 @@ int CrasInputStream::StreamError(cras_client* client, } void CrasInputStream::ReadAudio(size_t frames, - uint8* buffer, + uint8_t* buffer, const timespec* sample_ts) { DCHECK(callback_); diff --git a/media/audio/cras/cras_input.h b/media/audio/cras/cras_input.h index 7520ab6..2efed6b 100644 --- a/media/audio/cras/cras_input.h +++ b/media/audio/cras/cras_input.h @@ -49,7 +49,7 @@ class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> { // called by the audio server when it has samples ready. static int SamplesReady(cras_client* client, cras_stream_id_t stream_id, - uint8* samples, + uint8_t* samples, size_t frames, const timespec* sample_ts, void* arg); @@ -62,7 +62,7 @@ class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> { // Reads one or more buffers of audio from the device, passes on to the // registered callback. Called from SamplesReady(). - void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); + void ReadAudio(size_t frames, uint8_t* buffer, const timespec* sample_ts); // Deals with an error that occured in the stream. Called from StreamError(). void NotifyStreamError(int err); @@ -81,7 +81,7 @@ class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> { AudioManagerCras* const audio_manager_; // Size of frame in bytes. - uint32 bytes_per_frame_; + uint32_t bytes_per_frame_; // Callback to pass audio samples too, valid while recording. AudioInputCallback* callback_; diff --git a/media/audio/cras/cras_input_unittest.cc b/media/audio/cras/cras_input_unittest.cc index 6c5a40c..7924207 100644 --- a/media/audio/cras/cras_input_unittest.cc +++ b/media/audio/cras/cras_input_unittest.cc @@ -29,7 +29,7 @@ namespace media { class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { public: MOCK_METHOD4(OnData, - void(AudioInputStream*, const AudioBus*, uint32, double)); + void(AudioInputStream*, const AudioBus*, uint32_t, double)); MOCK_METHOD1(OnError, void(AudioInputStream*)); }; @@ -64,13 +64,13 @@ class CrasInputStreamTest : public testing::Test { } CrasInputStream* CreateStream(ChannelLayout layout, - int32 samples_per_packet) { + int32_t samples_per_packet) { return CreateStream(layout, samples_per_packet, AudioManagerBase::kDefaultDeviceId); } CrasInputStream* CreateStream(ChannelLayout layout, - int32 samples_per_packet, + int32_t samples_per_packet, const std::string& device_id) { AudioParameters params(kTestFormat, layout, @@ -109,7 +109,7 @@ class CrasInputStreamTest : public testing::Test { static const unsigned int kTestCaptureDurationMs; static const ChannelLayout kTestChannelLayout; static const AudioParameters::Format kTestFormat; - static const uint32 kTestFramesPerPacket; + static const uint32_t kTestFramesPerPacket; static const int kTestSampleRate; scoped_ptr<StrictMock<MockAudioManagerCrasInput> > mock_manager_; @@ -124,7 +124,7 @@ const ChannelLayout CrasInputStreamTest::kTestChannelLayout = CHANNEL_LAYOUT_STEREO; const AudioParameters::Format CrasInputStreamTest::kTestFormat = AudioParameters::AUDIO_PCM_LINEAR; -const uint32 CrasInputStreamTest::kTestFramesPerPacket = 1000; +const uint32_t CrasInputStreamTest::kTestFramesPerPacket = 1000; const int CrasInputStreamTest::kTestSampleRate = 44100; TEST_F(CrasInputStreamTest, OpenMono) { diff --git a/media/audio/cras/cras_unified.cc b/media/audio/cras/cras_unified.cc index 180cfc1..1a2fa3e 100644 --- a/media/audio/cras/cras_unified.cc +++ b/media/audio/cras/cras_unified.cc @@ -158,7 +158,7 @@ void CrasUnifiedStream::Start(AudioSourceCallback* callback) { // Initialize channel layout to all -1 to indicate that none of // the channels is set in the layout. - int8 layout[CRAS_CH_MAX] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + int8_t layout[CRAS_CH_MAX] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // Converts to CRAS defined channels. ChannelOrder will return -1 // for channels that does not present in params_.channel_layout(). @@ -232,9 +232,8 @@ void CrasUnifiedStream::GetVolume(double* volume) { *volume = volume_; } -uint32 CrasUnifiedStream::GetBytesLatency( - const struct timespec& latency_ts) { - uint32 latency_usec; +uint32_t CrasUnifiedStream::GetBytesLatency(const struct timespec& latency_ts) { + uint32_t latency_usec; // Treat negative latency (if we are too slow to render) as 0. if (latency_ts.tv_sec < 0 || latency_ts.tv_nsec < 0) { @@ -253,8 +252,8 @@ uint32 CrasUnifiedStream::GetBytesLatency( // Static callback asking for samples. int CrasUnifiedStream::UnifiedCallback(cras_client* client, cras_stream_id_t stream_id, - uint8* input_samples, - uint8* output_samples, + uint8_t* input_samples, + uint8_t* output_samples, unsigned int frames, const timespec* input_ts, const timespec* output_ts, @@ -278,11 +277,11 @@ int CrasUnifiedStream::StreamError(cras_client* client, } // Calls the appropriate rendering function for this type of stream. -uint32 CrasUnifiedStream::DispatchCallback(size_t frames, - uint8* input_samples, - uint8* output_samples, - const timespec* input_ts, - const timespec* output_ts) { +uint32_t CrasUnifiedStream::DispatchCallback(size_t frames, + uint8_t* input_samples, + uint8_t* output_samples, + const timespec* input_ts, + const timespec* output_ts) { switch (stream_direction_) { case CRAS_STREAM_OUTPUT: return WriteAudio(frames, output_samples, output_ts); @@ -296,9 +295,9 @@ uint32 CrasUnifiedStream::DispatchCallback(size_t frames, return 0; } -uint32 CrasUnifiedStream::WriteAudio(size_t frames, - uint8* buffer, - const timespec* sample_ts) { +uint32_t CrasUnifiedStream::WriteAudio(size_t frames, + uint8_t* buffer, + const timespec* sample_ts) { DCHECK_EQ(frames, static_cast<size_t>(output_bus_->frames())); // Determine latency and pass that on to the source. diff --git a/media/audio/cras/cras_unified.h b/media/audio/cras/cras_unified.h index 2326648..c0533d0 100644 --- a/media/audio/cras/cras_unified.h +++ b/media/audio/cras/cras_unified.h @@ -45,13 +45,13 @@ class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { private: // Convert Latency in time to bytes. - uint32 GetBytesLatency(const struct timespec& latency); + uint32_t GetBytesLatency(const struct timespec& latency); // Handles captured audio and fills the ouput with audio to be played. static int UnifiedCallback(cras_client* client, cras_stream_id_t stream_id, - uint8* input_samples, - uint8* output_samples, + uint8_t* input_samples, + uint8_t* output_samples, unsigned int frames, const timespec* input_ts, const timespec* output_ts, @@ -64,14 +64,16 @@ class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { void* arg); // Chooses the correct audio callback based on stream direction. - uint32 DispatchCallback(size_t frames, - uint8* input_samples, - uint8* output_samples, - const timespec* input_ts, - const timespec* output_ts); + uint32_t DispatchCallback(size_t frames, + uint8_t* input_samples, + uint8_t* output_samples, + const timespec* input_ts, + const timespec* output_ts); // Writes audio for a playback stream. - uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts); + uint32_t WriteAudio(size_t frames, + uint8_t* buffer, + const timespec* sample_ts); // Deals with an error that occured in the stream. Called from StreamError(). void NotifyStreamError(int err); @@ -86,7 +88,7 @@ class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { AudioParameters params_; // Size of frame in bytes. - uint32 bytes_per_frame_; + uint32_t bytes_per_frame_; // True if stream is playing. bool is_playing_; diff --git a/media/audio/cras/cras_unified_unittest.cc b/media/audio/cras/cras_unified_unittest.cc index 64014c6..8062688 100644 --- a/media/audio/cras/cras_unified_unittest.cc +++ b/media/audio/cras/cras_unified_unittest.cc @@ -72,7 +72,7 @@ class CrasUnifiedStreamTest : public testing::Test { } CrasUnifiedStream* CreateStream(ChannelLayout layout, - int32 samples_per_packet) { + int32_t samples_per_packet) { AudioParameters params(kTestFormat, layout, kTestSampleRate, kTestBitsPerSample, samples_per_packet); return new CrasUnifiedStream(params, mock_manager_.get()); @@ -86,7 +86,7 @@ class CrasUnifiedStreamTest : public testing::Test { static const int kTestSampleRate; static const int kTestBitsPerSample; static const AudioParameters::Format kTestFormat; - static const uint32 kTestFramesPerPacket; + static const uint32_t kTestFramesPerPacket; scoped_ptr<StrictMock<MockAudioManagerCras> > mock_manager_; @@ -101,7 +101,7 @@ const int CrasUnifiedStreamTest::kTestSampleRate = const int CrasUnifiedStreamTest::kTestBitsPerSample = 16; const AudioParameters::Format CrasUnifiedStreamTest::kTestFormat = AudioParameters::AUDIO_PCM_LINEAR; -const uint32 CrasUnifiedStreamTest::kTestFramesPerPacket = 1000; +const uint32_t CrasUnifiedStreamTest::kTestFramesPerPacket = 1000; TEST_F(CrasUnifiedStreamTest, ConstructedState) { CrasUnifiedStream* test_stream = CreateStream(kTestChannelLayout); diff --git a/media/audio/fake_audio_input_stream.h b/media/audio/fake_audio_input_stream.h index 4b8a98bc..7be559b 100644 --- a/media/audio/fake_audio_input_stream.h +++ b/media/audio/fake_audio_input_stream.h @@ -15,7 +15,6 @@ #include "media/audio/audio_parameters.h" #include "media/audio/fake_audio_worker.h" - namespace media { class AudioBus; diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc index ab0d26e..9ddc6f9 100644 --- a/media/audio/mac/audio_auhal_mac.cc +++ b/media/audio/mac/audio_auhal_mac.cc @@ -6,7 +6,6 @@ #include <CoreServices/CoreServices.h> -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" @@ -240,7 +239,7 @@ OSStatus AUHALStream::Render( // Update the playout latency. const double playout_latency_frames = GetPlayoutLatency(output_time_stamp); - current_hardware_pending_bytes_ = static_cast<uint32>( + current_hardware_pending_bytes_ = static_cast<uint32_t>( (playout_latency_frames + 0.5) * params_.GetBytesPerFrame()); if (audio_fifo_) diff --git a/media/audio/mac/audio_auhal_mac.h b/media/audio/mac/audio_auhal_mac.h index 351c662..6d0bc73 100644 --- a/media/audio/mac/audio_auhal_mac.h +++ b/media/audio/mac/audio_auhal_mac.h @@ -182,7 +182,7 @@ class AUHALStream : public AudioOutputStream { scoped_ptr<AudioPullFifo> audio_fifo_; // Current buffer delay. Set by Render(). - uint32 current_hardware_pending_bytes_; + uint32_t current_hardware_pending_bytes_; // Lost frames not yet reported to the provider. Increased in // UpdatePlayoutTimestamp() if any lost frame since last time. Forwarded to diff --git a/media/audio/mac/audio_auhal_mac_unittest.cc b/media/audio/mac/audio_auhal_mac_unittest.cc index 14499b7..8e75f3e 100644 --- a/media/audio/mac/audio_auhal_mac_unittest.cc +++ b/media/audio/mac/audio_auhal_mac_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" diff --git a/media/audio/mac/audio_device_listener_mac.h b/media/audio/mac/audio_device_listener_mac.h index b513cd4..7f06e5c 100644 --- a/media/audio/mac/audio_device_listener_mac.h +++ b/media/audio/mac/audio_device_listener_mac.h @@ -7,7 +7,6 @@ #include <CoreAudio/AudioHardware.h> -#include "base/basictypes.h" #include "base/callback.h" #include "base/threading/thread_checker.h" #include "media/base/media_export.h" diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc index bc44386..88c6a01 100644 --- a/media/audio/mac/audio_input_mac.cc +++ b/media/audio/mac/audio_input_mac.cc @@ -6,7 +6,6 @@ #include <CoreServices/CoreServices.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/mac/mac_logging.h" #include "media/audio/mac/audio_manager_mac.h" @@ -224,7 +223,7 @@ void PCMQueueInAudioInputStream::HandleInputBuffer( if (elapsed < kMinDelay) base::PlatformThread::Sleep(kMinDelay - elapsed); - uint8* audio_data = reinterpret_cast<uint8*>(audio_buffer->mAudioData); + uint8_t* audio_data = reinterpret_cast<uint8_t*>(audio_buffer->mAudioData); audio_bus_->FromInterleaved( audio_data, audio_bus_->frames(), format_.mBitsPerChannel / 8); callback_->OnData( diff --git a/media/audio/mac/audio_input_mac.h b/media/audio/mac/audio_input_mac.h index 0220334..f13439c 100644 --- a/media/audio/mac/audio_input_mac.h +++ b/media/audio/mac/audio_input_mac.h @@ -77,7 +77,7 @@ class PCMQueueInAudioInputStream : public AudioInputStream { // Handle to the OS audio queue object. AudioQueueRef audio_queue_; // Size of each of the buffers in |audio_buffers_| - uint32 buffer_size_bytes_; + uint32_t buffer_size_bytes_; // True iff Start() has been called successfully. bool started_; // Used to determine if we need to slow down |callback_| calls. diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc index 3beb2c0..4a6a39b 100644 --- a/media/audio/mac/audio_low_latency_input_mac.cc +++ b/media/audio/mac/audio_low_latency_input_mac.cc @@ -6,7 +6,6 @@ #include <CoreServices/CoreServices.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/mac/mac_logging.h" #include "base/metrics/histogram_macros.h" @@ -89,7 +88,7 @@ AUAudioInputStream::AUAudioInputStream(AudioManagerMac* manager, // Allocate AudioBuffers to be used as storage for the received audio. // The AudioBufferList structure works as a placeholder for the // AudioBuffer structure, which holds a pointer to the actual data buffer. - audio_data_buffer_.reset(new uint8[data_byte_size]); + audio_data_buffer_.reset(new uint8_t[data_byte_size]); audio_buffer_list_.mNumberBuffers = 1; AudioBuffer* audio_buffer = audio_buffer_list_.mBuffers; @@ -521,7 +520,7 @@ OSStatus AUAudioInputStream::InputProc(void* user_data, // handles it. // See See http://www.crbug.com/434681 for one example when we can enter // this scope. - audio_input->audio_data_buffer_.reset(new uint8[new_size]); + audio_input->audio_data_buffer_.reset(new uint8_t[new_size]); audio_buffer->mData = audio_input->audio_data_buffer_.get(); } @@ -582,9 +581,9 @@ OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames, GetAgcVolume(&normalized_volume); AudioBuffer& buffer = io_data->mBuffers[0]; - uint8* audio_data = reinterpret_cast<uint8*>(buffer.mData); - uint32 capture_delay_bytes = static_cast<uint32> - ((capture_latency_frames + 0.5) * format_.mBytesPerFrame); + uint8_t* audio_data = reinterpret_cast<uint8_t*>(buffer.mData); + uint32_t capture_delay_bytes = static_cast<uint32_t>( + (capture_latency_frames + 0.5) * format_.mBytesPerFrame); DCHECK(audio_data); if (!audio_data) return kAudioUnitErr_InvalidElement; diff --git a/media/audio/mac/audio_low_latency_input_mac.h b/media/audio/mac/audio_low_latency_input_mac.h index 982b27b..437b2a8 100644 --- a/media/audio/mac/audio_low_latency_input_mac.h +++ b/media/audio/mac/audio_low_latency_input_mac.h @@ -162,7 +162,7 @@ class AUAudioInputStream : public AgcAudioStream<AudioInputStream> { // Temporary storage for recorded data. The InputProc() renders into this // array as soon as a frame of the desired buffer size has been recorded. - scoped_ptr<uint8[]> audio_data_buffer_; + scoped_ptr<uint8_t[]> audio_data_buffer_; // True after successful Start(), false after successful Stop(). bool started_; diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc index b1a8b3b..22691a7 100644 --- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc +++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/environment.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -35,7 +34,7 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { MOCK_METHOD4(OnData, void(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume)); MOCK_METHOD1(OnError, void(AudioInputStream* stream)); }; @@ -60,7 +59,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { ~WriteToFileAudioSink() override { int bytes_written = 0; while (bytes_written < bytes_to_write_) { - const uint8* chunk; + const uint8_t* chunk; int chunk_size; // Stop writing if no more data is available. @@ -78,10 +77,10 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { // AudioInputStream::AudioInputCallback implementation. void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { const int num_samples = src->frames() * src->channels(); - scoped_ptr<int16> interleaved(new int16[num_samples]); + scoped_ptr<int16_t> interleaved(new int16_t[num_samples]); const int bytes_per_sample = sizeof(*interleaved); src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); @@ -89,7 +88,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { // fwrite() calls in the audio callback. The complete buffer will be // written to file in the destructor. const int size = bytes_per_sample * num_samples; - if (buffer_.Append((const uint8*)interleaved.get(), size)) { + if (buffer_.Append((const uint8_t*)interleaved.get(), size)) { bytes_to_write_ += size; } } diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index 62a66f0..16490f2 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -4,7 +4,6 @@ #include "media/audio/mac/audio_manager_mac.h" - #include "base/bind.h" #include "base/command_line.h" #include "base/mac/mac_logging.h" @@ -429,7 +428,7 @@ bool AudioManagerMac::GetDeviceChannels(AudioDeviceID device, return false; // Allocate storage. - scoped_ptr<uint8[]> list_storage(new uint8[size]); + scoped_ptr<uint8_t[]> list_storage(new uint8_t[size]); AudioBufferList& buffer_list = *reinterpret_cast<AudioBufferList*>(list_storage.get()); diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h index c9a8db3..c3ccb2c 100644 --- a/media/audio/mac/audio_manager_mac.h +++ b/media/audio/mac/audio_manager_mac.h @@ -10,7 +10,6 @@ #include <list> #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "media/audio/audio_manager_base.h" #include "media/audio/mac/audio_device_listener_mac.h" diff --git a/media/audio/pulse/pulse_input.cc b/media/audio/pulse/pulse_input.cc index 3d3c770..b52eec6 100644 --- a/media/audio/pulse/pulse_input.cc +++ b/media/audio/pulse/pulse_input.cc @@ -267,7 +267,7 @@ void PulseAudioInputStream::StreamNotifyCallback(pa_stream* s, } void PulseAudioInputStream::ReadData() { - uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( + uint32_t hardware_delay = pulse::GetHardwareLatencyInBytes( handle_, params_.sample_rate(), params_.GetBytesPerFrame()); // Update the AGC volume level once every second. Note that, diff --git a/media/audio/pulse/pulse_output.cc b/media/audio/pulse/pulse_output.cc index 1077e25..9cd2da4 100644 --- a/media/audio/pulse/pulse_output.cc +++ b/media/audio/pulse/pulse_output.cc @@ -130,7 +130,7 @@ void PulseAudioOutputStream::FulfillWriteRequest(size_t requested_bytes) { int frames_filled = 0; if (source_callback_) { - const uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( + const uint32_t hardware_delay = pulse::GetHardwareLatencyInBytes( pa_stream_, params_.sample_rate(), params_.GetBytesPerFrame()); frames_filled = source_callback_->OnMoreData(audio_bus_.get(), hardware_delay, 0); diff --git a/media/audio/pulse/pulse_util.h b/media/audio/pulse/pulse_util.h index 94c4aa4..b8e5cdc 100644 --- a/media/audio/pulse/pulse_util.h +++ b/media/audio/pulse/pulse_util.h @@ -7,7 +7,7 @@ #include <pulse/pulseaudio.h> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/audio/audio_device_name.h" #include "media/base/channel_layout.h" diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index b75b96d..afcd8b9 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc @@ -231,7 +231,7 @@ void FileSource::OnError(AudioOutputStream* stream) { BeepingSource::BeepingSource(const AudioParameters& params) : buffer_size_(params.GetBytesPerBuffer()), - buffer_(new uint8[buffer_size_]), + buffer_(new uint8_t[buffer_size_]), params_(params), last_callback_time_(base::TimeTicks::Now()), beep_duration_in_buffers_(kBeepDurationMilliseconds * @@ -239,8 +239,7 @@ BeepingSource::BeepingSource(const AudioParameters& params) params.frames_per_buffer() / 1000), beep_generated_in_buffers_(0), - beep_period_in_frames_(params.sample_rate() / kBeepFrequency) { -} + beep_period_in_frames_(params.sample_rate() / kBeepFrequency) {} BeepingSource::~BeepingSource() { } diff --git a/media/audio/simple_sources.h b/media/audio/simple_sources.h index 075b4a7..7d5c3c4 100644 --- a/media/audio/simple_sources.h +++ b/media/audio/simple_sources.h @@ -99,7 +99,7 @@ class BeepingSource : public AudioOutputStream::AudioSourceCallback { static void BeepOnce(); private: int buffer_size_; - scoped_ptr<uint8[]> buffer_; + scoped_ptr<uint8_t[]> buffer_; AudioParameters params_; base::TimeTicks last_callback_time_; base::TimeDelta interval_from_last_beep_; diff --git a/media/audio/simple_sources_unittest.cc b/media/audio/simple_sources_unittest.cc index 86963bc..c4c068e 100644 --- a/media/audio/simple_sources_unittest.cc +++ b/media/audio/simple_sources_unittest.cc @@ -6,7 +6,6 @@ #include "base/files/file_util.h" #include "base/logging.h" -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/audio/audio_parameters.h" #include "media/audio/simple_sources.h" @@ -18,8 +17,8 @@ namespace media { // Validate that the SineWaveAudioSource writes the expected values. TEST(SimpleSources, SineWaveAudioSource) { - static const uint32 samples = 1024; - static const uint32 bytes_per_sample = 2; + static const uint32_t samples = 1024; + static const uint32_t bytes_per_sample = 2; static const int freq = 200; AudioParameters params( @@ -32,7 +31,7 @@ TEST(SimpleSources, SineWaveAudioSource) { EXPECT_EQ(1, source.callbacks()); EXPECT_EQ(0, source.errors()); - uint32 half_period = AudioParameters::kTelephoneSampleRate / (freq * 2); + uint32_t half_period = AudioParameters::kTelephoneSampleRate / (freq * 2); // Spot test positive incursion of sine wave. EXPECT_NEAR(0, audio_bus->channel(0)[0], diff --git a/media/audio/sounds/audio_stream_handler.h b/media/audio/sounds/audio_stream_handler.h index 4caa603..8be8914 100644 --- a/media/audio/sounds/audio_stream_handler.h +++ b/media/audio/sounds/audio_stream_handler.h @@ -5,7 +5,6 @@ #ifndef MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ #define MEDIA_AUDIO_SOUNDS_AUDIO_STREAM_HANDLER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/strings/string_piece.h" #include "base/threading/non_thread_safe.h" diff --git a/media/audio/sounds/audio_stream_handler_unittest.cc b/media/audio/sounds/audio_stream_handler_unittest.cc index 5393162..a559297 100644 --- a/media/audio/sounds/audio_stream_handler_unittest.cc +++ b/media/audio/sounds/audio_stream_handler_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" diff --git a/media/audio/sounds/sounds_manager.h b/media/audio/sounds/sounds_manager.h index 7db164f..a5f8a3a 100644 --- a/media/audio/sounds/sounds_manager.h +++ b/media/audio/sounds/sounds_manager.h @@ -5,7 +5,6 @@ #ifndef MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ #define MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/strings/string_piece.h" #include "base/threading/non_thread_safe.h" diff --git a/media/audio/sounds/test_data.h b/media/audio/sounds/test_data.h index ce81266..0fca5ad 100644 --- a/media/audio/sounds/test_data.h +++ b/media/audio/sounds/test_data.h @@ -5,7 +5,6 @@ #ifndef MEDIA_AUDIO_SOUNDS_TEST_DATA_H_ #define MEDIA_AUDIO_SOUNDS_TEST_DATA_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "media/audio/sounds/audio_stream_handler.h" diff --git a/media/audio/sounds/wav_audio_handler.cc b/media/audio/sounds/wav_audio_handler.cc index 9e27197..22645ea 100644 --- a/media/audio/sounds/wav_audio_handler.cc +++ b/media/audio/sounds/wav_audio_handler.cc @@ -76,10 +76,10 @@ bool ParseFmtChunk(const base::StringPiece data, WavAudioParameters* params) { } // Read in serialized parameters. - params->audio_format = ReadInt<uint16>(data, kAudioFormatOffset); - params->num_channels = ReadInt<uint16>(data, kChannelOffset); - params->sample_rate = ReadInt<uint32>(data, kSampleRateOffset); - params->bits_per_sample = ReadInt<uint16>(data, kBitsPerSampleOffset); + params->audio_format = ReadInt<uint16_t>(data, kAudioFormatOffset); + params->num_channels = ReadInt<uint16_t>(data, kChannelOffset); + params->sample_rate = ReadInt<uint32_t>(data, kSampleRateOffset); + params->bits_per_sample = ReadInt<uint16_t>(data, kBitsPerSampleOffset); return true; } diff --git a/media/audio/sounds/wav_audio_handler_unittest.cc b/media/audio/sounds/wav_audio_handler_unittest.cc index 5f8c6be..0f2304a 100644 --- a/media/audio/sounds/wav_audio_handler_unittest.cc +++ b/media/audio/sounds/wav_audio_handler_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" diff --git a/media/audio/virtual_audio_input_stream.cc b/media/audio/virtual_audio_input_stream.cc index 6f35bec..1025dcc 100644 --- a/media/audio/virtual_audio_input_stream.cc +++ b/media/audio/virtual_audio_input_stream.cc @@ -21,7 +21,7 @@ VirtualAudioInputStream::VirtualAudioInputStream( : worker_task_runner_(worker_task_runner), after_close_cb_(after_close_cb), callback_(NULL), - buffer_(new uint8[params.GetBytesPerBuffer()]), + buffer_(new uint8_t[params.GetBytesPerBuffer()]), params_(params), mixer_(params_, params_, false), num_attached_output_streams_(0), diff --git a/media/audio/virtual_audio_input_stream.h b/media/audio/virtual_audio_input_stream.h index 1ab0da4..dd82429 100644 --- a/media/audio/virtual_audio_input_stream.h +++ b/media/audio/virtual_audio_input_stream.h @@ -85,7 +85,7 @@ class MEDIA_EXPORT VirtualAudioInputStream : public AudioInputStream { AudioInputCallback* callback_; // Non-const for testing. - scoped_ptr<uint8[]> buffer_; + scoped_ptr<uint8_t[]> buffer_; AudioParameters params_; // Guards concurrent access to the converter network: converters_, mixer_, and diff --git a/media/audio/virtual_audio_input_stream_unittest.cc b/media/audio/virtual_audio_input_stream_unittest.cc index 48a8e61..392b505 100644 --- a/media/audio/virtual_audio_input_stream_unittest.cc +++ b/media/audio/virtual_audio_input_stream_unittest.cc @@ -41,7 +41,7 @@ class MockInputCallback : public AudioInputStream::AudioInputCallback { MOCK_METHOD4(OnData, void(AudioInputStream* stream, const AudioBus* source, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume)); MOCK_METHOD1(OnError, void(AudioInputStream* stream)); diff --git a/media/audio/virtual_audio_output_stream.cc b/media/audio/virtual_audio_output_stream.cc index 149f3cc..81c40cc 100644 --- a/media/audio/virtual_audio_output_stream.cc +++ b/media/audio/virtual_audio_output_stream.cc @@ -78,11 +78,11 @@ double VirtualAudioOutputStream::ProvideInput(AudioBus* audio_bus, DCHECK(callback_); DCHECK_GE(buffer_delay, base::TimeDelta()); - const int64 upstream_delay_in_bytes = - params_.GetBytesPerSecond() * buffer_delay / - base::TimeDelta::FromSeconds(1); + const int64_t upstream_delay_in_bytes = params_.GetBytesPerSecond() * + buffer_delay / + base::TimeDelta::FromSeconds(1); const int frames = callback_->OnMoreData( - audio_bus, static_cast<uint32>(upstream_delay_in_bytes), 0); + audio_bus, static_cast<uint32_t>(upstream_delay_in_bytes), 0); if (frames < audio_bus->frames()) audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames); diff --git a/media/audio/win/audio_device_listener_win.h b/media/audio/win/audio_device_listener_win.h index 053afa6..d789d0d 100644 --- a/media/audio/win/audio_device_listener_win.h +++ b/media/audio/win/audio_device_listener_win.h @@ -8,7 +8,6 @@ #include <MMDeviceAPI.h> #include <string> -#include "base/basictypes.h" #include "base/callback.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc index 2939522..7fff5ff4 100644 --- a/media/audio/win/audio_low_latency_input_win.cc +++ b/media/audio/win/audio_low_latency_input_win.cc @@ -291,7 +291,7 @@ void WASAPIAudioInputStream::Run() { size_t capture_buffer_size = std::max( 2 * endpoint_buffer_size_frames_ * frame_size_, 2 * packet_size_frames_ * frame_size_); - scoped_ptr<uint8[]> capture_buffer(new uint8[capture_buffer_size]); + scoped_ptr<uint8_t[]> capture_buffer(new uint8_t[capture_buffer_size]); LARGE_INTEGER now_count = {}; bool recording = true; @@ -387,10 +387,12 @@ void WASAPIAudioInputStream::Run() { // Deliver captured data to the registered consumer using a packet // size which was specified at construction. - uint32 delay_frames = static_cast<uint32>(audio_delay_frames + 0.5); + uint32_t delay_frames = + static_cast<uint32_t>(audio_delay_frames + 0.5); while (buffer_frame_index >= packet_size_frames_) { // Copy data to audio bus to match the OnData interface. - uint8* audio_data = reinterpret_cast<uint8*>(capture_buffer.get()); + uint8_t* audio_data = + reinterpret_cast<uint8_t*>(capture_buffer.get()); audio_bus_->FromInterleaved( audio_data, audio_bus_->frames(), format_.wBitsPerSample / 8); diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h index f88c614..35e6818 100644 --- a/media/audio/win/audio_low_latency_input_win.h +++ b/media/audio/win/audio_low_latency_input_win.h @@ -145,7 +145,7 @@ class MEDIA_EXPORT WASAPIAudioInputStream size_t packet_size_bytes_; // Length of the audio endpoint buffer. - uint32 endpoint_buffer_size_frames_; + uint32_t endpoint_buffer_size_frames_; // Contains the unique name of the selected endpoint device. // Note that AudioManagerBase::kDefaultDeviceId represents the default diff --git a/media/audio/win/audio_low_latency_input_win_unittest.cc b/media/audio/win/audio_low_latency_input_win_unittest.cc index 6a8e8a9..3190b7b 100644 --- a/media/audio/win/audio_low_latency_input_win_unittest.cc +++ b/media/audio/win/audio_low_latency_input_win_unittest.cc @@ -5,7 +5,6 @@ #include <windows.h> #include <mmsystem.h> -#include "base/basictypes.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" @@ -41,7 +40,7 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { MOCK_METHOD4(OnData, void(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume)); MOCK_METHOD1(OnError, void(AudioInputStream* stream)); }; @@ -63,7 +62,7 @@ class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback { void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { EXPECT_GE(hardware_delay_bytes, 0u); EXPECT_LT(hardware_delay_bytes, 0xFFFFu); // Arbitrarily picked. @@ -107,7 +106,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { ~WriteToFileAudioSink() override { size_t bytes_written = 0; while (bytes_written < bytes_to_write_) { - const uint8* chunk; + const uint8_t* chunk; int chunk_size; // Stop writing if no more data is available. @@ -125,11 +124,11 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { // AudioInputStream::AudioInputCallback implementation. void OnData(AudioInputStream* stream, const AudioBus* src, - uint32 hardware_delay_bytes, + uint32_t hardware_delay_bytes, double volume) override { EXPECT_EQ(bits_per_sample_, 16); const int num_samples = src->frames() * src->channels(); - scoped_ptr<int16> interleaved(new int16[num_samples]); + scoped_ptr<int16_t> interleaved(new int16_t[num_samples]); const int bytes_per_sample = sizeof(*interleaved); src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); @@ -137,7 +136,7 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { // fwrite() calls in the audio callback. The complete buffer will be // written to file in the destructor. const int size = bytes_per_sample * num_samples; - if (buffer_.Append((const uint8*)interleaved.get(), size)) { + if (buffer_.Append((const uint8_t*)interleaved.get(), size)) { bytes_to_write_ += size; } } @@ -360,8 +359,8 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamTestPacketSizes) { MockAudioInputCallback sink; // Derive the expected size in bytes of each recorded packet. - uint32 bytes_per_packet = aisw.channels() * aisw.frames_per_buffer() * - (aisw.bits_per_sample() / 8); + uint32_t bytes_per_packet = + aisw.channels() * aisw.frames_per_buffer() * (aisw.bits_per_sample() / 8); // We use 10ms packets and will run the test until ten packets are received. // All should contain valid packets of the same size and a valid delay diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc index 9ead48a..23467f7 100644 --- a/media/audio/win/audio_low_latency_output_win.cc +++ b/media/audio/win/audio_low_latency_output_win.cc @@ -440,7 +440,7 @@ bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { HRESULT hr = S_FALSE; UINT32 num_queued_frames = 0; - uint8* audio_data = NULL; + uint8_t* audio_data = NULL; // Contains how much new data we can write to the buffer without // the risk of overwriting previously written data that the audio @@ -509,7 +509,7 @@ bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { // can typically be utilized by an acoustic echo-control (AEC) // unit at the render side. UINT64 position = 0; - uint32 audio_delay_bytes = 0; + uint32_t audio_delay_bytes = 0; hr = audio_clock_->GetPosition(&position, NULL); if (SUCCEEDED(hr)) { // Stream position of the sample that is currently playing @@ -534,7 +534,7 @@ bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { int frames_filled = source_->OnMoreData(audio_bus_.get(), audio_delay_bytes, 0); - uint32 num_filled_bytes = frames_filled * format_.Format.nBlockAlign; + uint32_t num_filled_bytes = frames_filled * format_.Format.nBlockAlign; DCHECK_LE(num_filled_bytes, packet_size_bytes_); // Note: If this ever changes to output raw float the data must be @@ -558,7 +558,9 @@ bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { } HRESULT WASAPIAudioOutputStream::ExclusiveModeInitialization( - IAudioClient* client, HANDLE event_handle, uint32* endpoint_buffer_size) { + IAudioClient* client, + HANDLE event_handle, + uint32_t* endpoint_buffer_size) { DCHECK_EQ(share_mode_, AUDCLNT_SHAREMODE_EXCLUSIVE); float f = (1000.0 * packet_size_frames_) / format_.Format.nSamplesPerSec; diff --git a/media/audio/win/audio_low_latency_output_win.h b/media/audio/win/audio_low_latency_output_win.h index a62e470..007b4e0 100644 --- a/media/audio/win/audio_low_latency_output_win.h +++ b/media/audio/win/audio_low_latency_output_win.h @@ -165,7 +165,7 @@ class MEDIA_EXPORT WASAPIAudioOutputStream : // for exclusive audio mode. HRESULT ExclusiveModeInitialization(IAudioClient* client, HANDLE event_handle, - uint32* endpoint_buffer_size); + uint32_t* endpoint_buffer_size); // If |render_thread_| is valid, sets |stop_render_event_| and blocks until // the thread has stopped. |stop_render_event_| is reset after the call. @@ -202,7 +202,7 @@ class MEDIA_EXPORT WASAPIAudioOutputStream : size_t packet_size_bytes_; // Length of the audio endpoint buffer. - uint32 endpoint_buffer_size_frames_; + uint32_t endpoint_buffer_size_frames_; // The target device id or an empty string for the default device. const std::string device_id_; diff --git a/media/audio/win/audio_low_latency_output_win_unittest.cc b/media/audio/win/audio_low_latency_output_win_unittest.cc index 8f30411..075cd7d 100644 --- a/media/audio/win/audio_low_latency_output_win_unittest.cc +++ b/media/audio/win/audio_low_latency_output_win_unittest.cc @@ -5,7 +5,6 @@ #include <windows.h> #include <mmsystem.h> -#include "base/basictypes.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/memory/scoped_ptr.h" @@ -379,8 +378,8 @@ TEST(WASAPIAudioOutputStreamTest, ValidPacketSize) { EXPECT_TRUE(aos->Open()); // Derive the expected size in bytes of each packet. - uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * - (aosw.bits_per_sample() / 8); + uint32_t bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * + (aosw.bits_per_sample() / 8); // Wait for the first callback and verify its parameters. Ignore any // subsequent callbacks that might arrive. @@ -574,8 +573,8 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeMinBufferSizeAt48kHz) { EXPECT_TRUE(aos->Open()); // Derive the expected size in bytes of each packet. - uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * - (aosw.bits_per_sample() / 8); + uint32_t bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * + (aosw.bits_per_sample() / 8); // Wait for the first callback and verify its parameters. EXPECT_CALL(source, OnMoreData(NotNull(), HasValidDelay(bytes_per_packet), 0)) @@ -608,8 +607,8 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeMinBufferSizeAt44kHz) { EXPECT_TRUE(aos->Open()); // Derive the expected size in bytes of each packet. - uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * - (aosw.bits_per_sample() / 8); + uint32_t bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * + (aosw.bits_per_sample() / 8); // Wait for the first callback and verify its parameters. EXPECT_CALL(source, OnMoreData(NotNull(), HasValidDelay(bytes_per_packet), 0)) diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 1028488..5b5a2e7 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc @@ -5,7 +5,6 @@ #include <windows.h> #include <mmsystem.h> -#include "base/basictypes.h" #include "base/base_paths.h" #include "base/memory/aligned_memory.h" #include "base/sync_socket.h" @@ -132,18 +131,14 @@ class ReadOnlyMappedFile { return ((start_ > 0) && (size_ > 0)); } // Returns the size in bytes of the mapped memory. - uint32 size() const { - return size_; - } + uint32_t size() const { return size_; } // Returns the memory backing the file. - const void* GetChunkAt(uint32 offset) { - return &start_[offset]; - } + const void* GetChunkAt(uint32_t offset) { return &start_[offset]; } private: HANDLE fmap_; char* start_; - uint32 size_; + uint32_t size_; }; // =========================================================================== @@ -260,7 +255,7 @@ TEST(WinAudioTest, PCMWaveStreamPlaySlowLoop) { scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); - uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; + uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, AudioParameters::kAudioCDSampleRate, 16, samples_100_ms), @@ -291,7 +286,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) { return; } - uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; + uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, AudioParameters::kAudioCDSampleRate, 16, samples_100_ms), @@ -316,7 +311,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) { scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); - uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 20; + uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 20; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, AudioParameters::kAudioCDSampleRate / 2, 16, @@ -351,7 +346,7 @@ TEST(WinAudioTest, PushSourceFile16KHz) { static const int kSampleRate = 16000; SineWaveAudioSource source(1, 200.0, kSampleRate); // Compute buffer size for 100ms of audio. - const uint32 kSamples100ms = (kSampleRate / 1000) * 100; + const uint32_t kSamples100ms = (kSampleRate / 1000) * 100; // Restrict SineWaveAudioSource to 100ms of samples. source.CapSamples(kSamples100ms); @@ -369,7 +364,7 @@ TEST(WinAudioTest, PushSourceFile16KHz) { // We buffer and play at the same time, buffering happens every ~10ms and the // consuming of the buffer happens every ~100ms. We do 100 buffers which // effectively wrap around the file more than once. - for (uint32 ix = 0; ix != 100; ++ix) { + for (uint32_t ix = 0; ix != 100; ++ix) { ::Sleep(10); source.Reset(); } @@ -388,7 +383,7 @@ TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) { scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); - uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; + uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, AudioParameters::kAudioCDSampleRate, 16, samples_100_ms), @@ -426,7 +421,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) { // Take the existing native sample rate into account. const AudioParameters params = audio_man->GetDefaultOutputStreamParameters(); int sample_rate = params.sample_rate(); - uint32 samples_10_ms = sample_rate / 100; + uint32_t samples_10_ms = sample_rate / 100; int n = 1; (base::win::GetVersion() <= base::win::VERSION_XP) ? n = 5 : n = 1; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( @@ -460,7 +455,7 @@ TEST(WinAudioTest, PCMWaveStreamPendingBytes) { scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); - uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; + uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, AudioParameters::kAudioCDSampleRate, 16, samples_100_ms), @@ -470,7 +465,7 @@ TEST(WinAudioTest, PCMWaveStreamPendingBytes) { NiceMock<MockAudioSourceCallback> source; EXPECT_TRUE(oas->Open()); - uint32 bytes_100_ms = samples_100_ms * 2; + uint32_t bytes_100_ms = samples_100_ms * 2; // Audio output stream has either a double or triple buffer scheme. // We expect the amount of pending bytes will reaching up to 2 times of @@ -523,7 +518,7 @@ class SyncSocketSource : public AudioOutputStream::AudioSourceCallback { uint32_t total_bytes_delay, uint32_t frames_skipped) override { socket_->Send(&total_bytes_delay, sizeof(total_bytes_delay)); - uint32 size = socket_->Receive(data_.get(), data_size_); + uint32_t size = socket_->Receive(data_.get(), data_size_); DCHECK_EQ(static_cast<size_t>(size) % sizeof(*audio_bus_->channel(0)), 0U); audio_bus_->CopyTo(audio_bus); return audio_bus_->frames(); @@ -545,7 +540,7 @@ struct SyncThreadContext { int channels; int frames; double sine_freq; - uint32 packet_size_bytes; + uint32_t packet_size_bytes; }; // This thread provides the data that the SyncSocketSource above needs @@ -566,7 +561,7 @@ DWORD __stdcall SyncSocketThread(void* context) { SineWaveAudioSource sine(1, ctx.sine_freq, ctx.sample_rate); const int kTwoSecFrames = ctx.sample_rate * 2; - uint32 total_bytes_delay = 0; + uint32_t total_bytes_delay = 0; int times = 0; for (int ix = 0; ix < kTwoSecFrames; ix += ctx.frames) { if (ctx.socket->Receive(&total_bytes_delay, sizeof(total_bytes_delay)) == 0) @@ -593,7 +588,7 @@ TEST(WinAudioTest, SyncSocketBasic) { ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); static const int sample_rate = AudioParameters::kAudioCDSampleRate; - static const uint32 kSamples20ms = sample_rate / 50; + static const uint32_t kSamples20ms = sample_rate / 50; AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, sample_rate, 16, kSamples20ms); diff --git a/media/audio/win/avrt_wrapper_win.h b/media/audio/win/avrt_wrapper_win.h index 8127b6b..0b3462a 100644 --- a/media/audio/win/avrt_wrapper_win.h +++ b/media/audio/win/avrt_wrapper_win.h @@ -20,8 +20,6 @@ #include <windows.h> #include <avrt.h> -#include "base/basictypes.h" - namespace avrt { // Loads the Avrt.dll which is available on Windows Vista and later. diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index fce679c..48d8575 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc @@ -797,9 +797,11 @@ ChannelConfig CoreAudioUtil::GetChannelConfig(const std::string& device_id, return static_cast<ChannelConfig>(format.dwChannelMask); } -HRESULT CoreAudioUtil::SharedModeInitialize( - IAudioClient* client, const WAVEFORMATPCMEX* format, HANDLE event_handle, - uint32* endpoint_buffer_size, const GUID* session_guid) { +HRESULT CoreAudioUtil::SharedModeInitialize(IAudioClient* client, + const WAVEFORMATPCMEX* format, + HANDLE event_handle, + uint32_t* endpoint_buffer_size, + const GUID* session_guid) { DCHECK(IsSupported()); // Use default flags (i.e, dont set AUDCLNT_STREAMFLAGS_NOPERSIST) to diff --git a/media/audio/win/core_audio_util_win.h b/media/audio/win/core_audio_util_win.h index 6ad14365..3ca7ff4 100644 --- a/media/audio/win/core_audio_util_win.h +++ b/media/audio/win/core_audio_util_win.h @@ -15,7 +15,6 @@ #include <mmdeviceapi.h> #include <string> -#include "base/basictypes.h" #include "base/time/time.h" #include "base/win/scoped_comptr.h" #include "media/audio/audio_device_name.h" @@ -30,7 +29,7 @@ namespace media { // Represents audio channel configuration constants as understood by Windows. // E.g. KSAUDIO_SPEAKER_MONO. For a list of possible values see: // http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083(v=vs.85).aspx -typedef uint32 ChannelConfig; +typedef uint32_t ChannelConfig; class MEDIA_EXPORT CoreAudioUtil { public: @@ -205,7 +204,7 @@ class MEDIA_EXPORT CoreAudioUtil { static HRESULT SharedModeInitialize(IAudioClient* client, const WAVEFORMATPCMEX* format, HANDLE event_handle, - uint32* endpoint_buffer_size, + uint32_t* endpoint_buffer_size, const GUID* session_guid); // TODO(henrika): add ExclusiveModeInitialize(...) diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc index 82da188..1f5b2e0 100644 --- a/media/audio/win/core_audio_util_win_unittest.cc +++ b/media/audio/win/core_audio_util_win_unittest.cc @@ -336,7 +336,7 @@ TEST_F(CoreAudioUtilWinTest, SharedModeInitialize) { SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format))); // Perform a shared-mode initialization without event-driven buffer handling. - uint32 endpoint_buffer_size = 0; + uint32_t endpoint_buffer_size = 0; HRESULT hr = CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL, &endpoint_buffer_size, NULL); EXPECT_TRUE(SUCCEEDED(hr)); @@ -392,7 +392,7 @@ TEST_F(CoreAudioUtilWinTest, CreateRenderAndCaptureClients) { EDataFlow data[] = {eRender, eCapture}; WAVEFORMATPCMEX format; - uint32 endpoint_buffer_size = 0; + uint32_t endpoint_buffer_size = 0; for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IAudioClient> client; @@ -440,7 +440,7 @@ TEST_F(CoreAudioUtilWinTest, FillRenderEndpointBufferWithSilence) { EXPECT_TRUE(client.get()); WAVEFORMATPCMEX format; - uint32 endpoint_buffer_size = 0; + uint32_t endpoint_buffer_size = 0; EXPECT_TRUE( SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format))); CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL, diff --git a/media/audio/win/device_enumeration_win.cc b/media/audio/win/device_enumeration_win.cc index 1beddbb..47d5bbd 100644 --- a/media/audio/win/device_enumeration_win.cc +++ b/media/audio/win/device_enumeration_win.cc @@ -8,7 +8,6 @@ #include "media/audio/win/audio_manager_win.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/win/scoped_co_mem.h" diff --git a/media/audio/win/wavein_input_win.cc b/media/audio/win/wavein_input_win.cc index d93d62d..3d92818 100644 --- a/media/audio/win/wavein_input_win.cc +++ b/media/audio/win/wavein_input_win.cc @@ -86,7 +86,7 @@ void PCMWaveInAudioInputStream::SetupBuffers() { WAVEHDR* last = NULL; WAVEHDR* first = NULL; for (int ix = 0; ix != num_buffers_; ++ix) { - uint32 sz = sizeof(WAVEHDR) + buffer_size_; + uint32_t sz = sizeof(WAVEHDR) + buffer_size_; buffer_ = reinterpret_cast<WAVEHDR*>(new char[sz]); buffer_->lpData = reinterpret_cast<char*>(buffer_) + sizeof(WAVEHDR); buffer_->dwBufferLength = buffer_size_; @@ -300,9 +300,9 @@ void PCMWaveInAudioInputStream::WaveCallback(HWAVEIN hwi, UINT msg, // there is currently no support for controlling the microphone volume // level. WAVEHDR* buffer = reinterpret_cast<WAVEHDR*>(param1); - obj->audio_bus_->FromInterleaved(reinterpret_cast<uint8*>(buffer->lpData), - obj->audio_bus_->frames(), - obj->format_.wBitsPerSample / 8); + obj->audio_bus_->FromInterleaved( + reinterpret_cast<uint8_t*>(buffer->lpData), obj->audio_bus_->frames(), + obj->format_.wBitsPerSample / 8); obj->callback_->OnData( obj, obj->audio_bus_.get(), buffer->dwBytesRecorded, 0.0); diff --git a/media/audio/win/wavein_input_win.h b/media/audio/win/wavein_input_win.h index a2c77c3..673eca3 100644 --- a/media/audio/win/wavein_input_win.h +++ b/media/audio/win/wavein_input_win.h @@ -10,7 +10,6 @@ #include <windows.h> #include <mmsystem.h> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" @@ -100,7 +99,7 @@ class PCMWaveInAudioInputStream : public AudioInputStream { const int num_buffers_; // The size in bytes of each audio buffer. - uint32 buffer_size_; + uint32_t buffer_size_; // Channels, 1 or 2. const int channels_; diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc index 456124d..7c76ba8e 100644 --- a/media/audio/win/waveout_output_win.cc +++ b/media/audio/win/waveout_output_win.cc @@ -7,7 +7,6 @@ #pragma comment(lib, "winmm.lib") #include "base/atomicops.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "media/audio/audio_io.h" @@ -25,7 +24,7 @@ namespace media { // synchronized to the actual device state. // Sixty four MB is the maximum buffer size per AudioOutputStream. -static const uint32 kMaxOpenBufferSize = 1024 * 1024 * 64; +static const uint32_t kMaxOpenBufferSize = 1024 * 1024 * 64; // See Also // http://www.thx.com/consumer/home-entertainment/home-theater/surround-sound-speaker-set-up/ @@ -326,11 +325,11 @@ void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { // TODO(fbarchard): Handle used 0 by queueing more. // TODO(sergeyu): Specify correct hardware delay for |total_delay_bytes|. - uint32 total_delay_bytes = pending_bytes_; + uint32_t total_delay_bytes = pending_bytes_; int frames_filled = callback_->OnMoreData(audio_bus_.get(), total_delay_bytes, 0); - uint32 used = frames_filled * audio_bus_->channels() * - format_.Format.wBitsPerSample / 8; + uint32_t used = frames_filled * audio_bus_->channels() * + format_.Format.wBitsPerSample / 8; if (used <= buffer_size_) { // Note: If this ever changes to output raw float the data must be clipped diff --git a/media/audio/win/waveout_output_win.h b/media/audio/win/waveout_output_win.h index bd9da5e..ec0a410 100644 --- a/media/audio/win/waveout_output_win.h +++ b/media/audio/win/waveout_output_win.h @@ -9,7 +9,6 @@ #include <mmsystem.h> #include <mmreg.h> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "base/win/scoped_handle.h" @@ -96,7 +95,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { const int num_buffers_; // The size in bytes of each audio buffer, we usually have two of these. - uint32 buffer_size_; + uint32_t buffer_size_; // Volume level from 0 to 1. float volume_; @@ -105,7 +104,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { const int channels_; // Number of bytes yet to be played in the hardware buffer. - uint32 pending_bytes_; + uint32_t pending_bytes_; // The id assigned by the operating system to the selected wave output // hardware device. Usually this is just -1 which means 'default device'. diff --git a/media/base/android/access_unit_queue_unittest.cc b/media/base/android/access_unit_queue_unittest.cc index 5dca077..e82450c 100644 --- a/media/base/android/access_unit_queue_unittest.cc +++ b/media/base/android/access_unit_queue_unittest.cc @@ -48,7 +48,7 @@ DemuxerData AccessUnitQueueTest::CreateDemuxerData(const AUDescriptor* descr, continue; } - au.data = std::vector<uint8>(descr[i].data.begin(), descr[i].data.end()); + au.data = std::vector<uint8_t>(descr[i].data.begin(), descr[i].data.end()); if (descr[i].unit_type == kKeyFrame) au.is_key_frame = true; diff --git a/media/base/android/audio_decoder_job.cc b/media/base/android/audio_decoder_job.cc index 3cf2c5f..dd1fa53 100644 --- a/media/base/android/audio_decoder_job.cc +++ b/media/base/android/audio_decoder_job.cc @@ -105,16 +105,16 @@ void AudioDecoderJob::ReleaseOutputBuffer( render_output = render_output && (size != 0u); bool is_audio_underrun = false; if (render_output) { - int64 head_position = (static_cast<AudioCodecBridge*>( - media_codec_bridge_.get()))->PlayOutputBuffer( - output_buffer_index, size, offset); + int64_t head_position = + (static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) + ->PlayOutputBuffer(output_buffer_index, size, offset); base::TimeTicks current_time = base::TimeTicks::Now(); size_t new_frames_count = size / bytes_per_frame_; frame_count_ += new_frames_count; audio_timestamp_helper_->AddFrames(new_frames_count); - int64 frames_to_play = frame_count_ - head_position; + int64_t frames_to_play = frame_count_ - head_position; DCHECK_GE(frames_to_play, 0); const base::TimeDelta last_buffered = diff --git a/media/base/android/audio_decoder_job.h b/media/base/android/audio_decoder_job.h index f302a59..5d13b1c 100644 --- a/media/base/android/audio_decoder_job.h +++ b/media/base/android/audio_decoder_job.h @@ -62,9 +62,9 @@ class AudioDecoderJob : public MediaDecoderJob { AudioCodec audio_codec_; int num_channels_; int config_sampling_rate_; - std::vector<uint8> audio_extra_data_; - int64 audio_codec_delay_ns_; - int64 audio_seek_preroll_ns_; + std::vector<uint8_t> audio_extra_data_; + int64_t audio_codec_delay_ns_; + int64_t audio_seek_preroll_ns_; double volume_; int bytes_per_frame_; @@ -72,7 +72,7 @@ class AudioDecoderJob : public MediaDecoderJob { int output_sampling_rate_; // Frame count to sync with audio codec output - int64 frame_count_; + int64_t frame_count_; // Base timestamp for the |audio_timestamp_helper_|. base::TimeDelta base_timestamp_; diff --git a/media/base/android/demuxer_android.h b/media/base/android/demuxer_android.h index c8e6ffc..0c7427f 100644 --- a/media/base/android/demuxer_android.h +++ b/media/base/android/demuxer_android.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_ANDROID_DEMUXER_ANDROID_H_ #define MEDIA_BASE_ANDROID_DEMUXER_ANDROID_H_ -#include "base/basictypes.h" #include "base/time/time.h" #include "media/base/demuxer_stream.h" #include "media/base/media_export.h" diff --git a/media/base/android/demuxer_stream_player_params.cc b/media/base/android/demuxer_stream_player_params.cc index 6e86a7f..2452711 100644 --- a/media/base/android/demuxer_stream_player_params.cc +++ b/media/base/android/demuxer_stream_player_params.cc @@ -140,7 +140,7 @@ std::ostream& operator<<(std::ostream& os, const media::DemuxerConfigs& conf) { if (!conf.audio_extra_data.empty()) { os << " extra:{" << std::hex; - for (uint8 byte : conf.audio_extra_data) + for (uint8_t byte : conf.audio_extra_data) os << " " << std::setfill('0') << std::setw(2) << (int)byte; os << "}" << std::dec; } diff --git a/media/base/android/demuxer_stream_player_params.h b/media/base/android/demuxer_stream_player_params.h index 33d8976a..db89c18 100644 --- a/media/base/android/demuxer_stream_player_params.h +++ b/media/base/android/demuxer_stream_player_params.h @@ -24,14 +24,14 @@ struct MEDIA_EXPORT DemuxerConfigs { int audio_channels; int audio_sampling_rate; bool is_audio_encrypted; - std::vector<uint8> audio_extra_data; - int64 audio_codec_delay_ns; - int64 audio_seek_preroll_ns; + std::vector<uint8_t> audio_extra_data; + int64_t audio_codec_delay_ns; + int64_t audio_seek_preroll_ns; VideoCodec video_codec; gfx::Size video_size; bool is_video_encrypted; - std::vector<uint8> video_extra_data; + std::vector<uint8_t> video_extra_data; base::TimeDelta duration; }; @@ -43,7 +43,7 @@ struct MEDIA_EXPORT AccessUnit { DemuxerStream::Status status; bool is_end_of_stream; // TODO(ycheo): Use the shared memory to transfer the block data. - std::vector<uint8> data; + std::vector<uint8_t> data; base::TimeDelta timestamp; std::vector<char> key_id; std::vector<char> iv; diff --git a/media/base/android/media_codec_audio_decoder.cc b/media/base/android/media_codec_audio_decoder.cc index f68a07e..e1c1fdb 100644 --- a/media/base/android/media_codec_audio_decoder.cc +++ b/media/base/android/media_codec_audio_decoder.cc @@ -202,7 +202,7 @@ void MediaCodecAudioDecoder::Render(int buffer_index, const bool postpone = (render_mode == kRenderAfterPreroll); - int64 head_position = + int64_t head_position = audio_codec->PlayOutputBuffer(buffer_index, size, offset, postpone); base::TimeTicks current_time = base::TimeTicks::Now(); @@ -227,7 +227,7 @@ void MediaCodecAudioDecoder::Render(int buffer_index, media_task_runner_->PostTask( FROM_HERE, base::Bind(update_current_time_cb_, pts, pts, true)); } else { - int64 frames_to_play = frame_count_ - head_position; + int64_t frames_to_play = frame_count_ - head_position; DCHECK_GE(frames_to_play, 0) << class_name() << "::" << __FUNCTION__ << " pts:" << pts diff --git a/media/base/android/media_codec_audio_decoder.h b/media/base/android/media_codec_audio_decoder.h index 3143d56..4faab61 100644 --- a/media/base/android/media_codec_audio_decoder.h +++ b/media/base/android/media_codec_audio_decoder.h @@ -77,7 +77,7 @@ class MediaCodecAudioDecoder : public MediaCodecDecoder { int output_sampling_rate_; // Frame count to sync with audio codec output. - int64 frame_count_; + int64_t frame_count_; // Base timestamp for the |audio_timestamp_helper_|. base::TimeDelta base_timestamp_; diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc index cb31ef9..4307c00 100644 --- a/media/base/android/media_codec_util.cc +++ b/media/base/android/media_codec_util.cc @@ -10,7 +10,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "jni/MediaCodecUtil_jni.h" diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc index 3de86c6..d8bb6dc 100644 --- a/media/base/android/media_drm_bridge.cc +++ b/media/base/android/media_drm_bridge.cc @@ -65,7 +65,7 @@ std::string AsString(JNIEnv* env, jbyteArray j_byte_array) { return std::string(byte_vector.begin(), byte_vector.end()); } -const uint8 kWidevineUuid[16] = { +const uint8_t kWidevineUuid[16] = { 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, // 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED}; @@ -220,9 +220,9 @@ bool MediaDrmBridge::IsAvailable() { if (base::android::BuildInfo::GetInstance()->sdk_int() < 19) return false; - int32 os_major_version = 0; - int32 os_minor_version = 0; - int32 os_bugfix_version = 0; + int32_t os_major_version = 0; + int32_t os_minor_version = 0; + int32_t os_bugfix_version = 0; base::SysInfo::OperatingSystemVersionNumbers( &os_major_version, &os_minor_version, &os_bugfix_version); if (os_major_version == 4 && os_minor_version == 4 && os_bugfix_version == 0) @@ -336,7 +336,7 @@ void MediaDrmBridge::CreateSessionAndGenerateRequest( MediaDrmBridgeDelegate* delegate = client->GetMediaDrmBridgeDelegate(scheme_uuid_); if (delegate) { - std::vector<uint8> init_data_from_delegate; + std::vector<uint8_t> init_data_from_delegate; std::vector<std::string> optional_parameters_from_delegate; if (!delegate->OnCreateSession(init_data_type, init_data, &init_data_from_delegate, @@ -580,7 +580,7 @@ void MediaDrmBridge::OnSessionMessage( const JavaParamRef<jstring>& j_legacy_destination_url) { DVLOG(2) << __FUNCTION__; - std::vector<uint8> message; + std::vector<uint8_t> message; JavaByteArrayToByteVector(env, j_message, &message); GURL legacy_destination_url = GURL(ConvertJavaStringToUTF8(env, j_legacy_destination_url)); @@ -623,7 +623,7 @@ void MediaDrmBridge::OnSessionKeysChange( ScopedJavaLocalRef<jbyteArray> j_key_id = Java_KeyStatus_getKeyId(env, j_key_status.obj()); - std::vector<uint8> key_id; + std::vector<uint8_t> key_id; JavaByteArrayToByteVector(env, j_key_id.obj(), &key_id); DCHECK(!key_id.empty()); @@ -697,7 +697,7 @@ void MediaDrmBridge::OnResetDeviceCredentialsCompleted( // The following are private methods. MediaDrmBridge::MediaDrmBridge( - const std::vector<uint8>& scheme_uuid, + const std::vector<uint8_t>& scheme_uuid, SecurityLevel security_level, const CreateFetcherCB& create_fetcher_cb, const SessionMessageCB& session_message_cb, diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h index ff17252..87c1af2 100644 --- a/media/base/android/media_drm_bridge.h +++ b/media/base/android/media_drm_bridge.h @@ -243,7 +243,7 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys, public PlayerTracker { // Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The // default security level will be used if |security_level| is // SECURITY_LEVEL_DEFAULT. - MediaDrmBridge(const std::vector<uint8>& scheme_uuid, + MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid, SecurityLevel security_level, const CreateFetcherCB& create_fetcher_cb, const SessionMessageCB& session_message_cb, @@ -273,7 +273,7 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys, public PlayerTracker { void ProcessProvisionResponse(bool success, const std::string& response); // UUID of the key system. - std::vector<uint8> scheme_uuid_; + std::vector<uint8_t> scheme_uuid_; // Java MediaDrm instance. base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; diff --git a/media/base/android/media_drm_bridge_unittest.cc b/media/base/android/media_drm_bridge_unittest.cc index d9f0e47..62f25d6 100644 --- a/media/base/android/media_drm_bridge_unittest.cc +++ b/media/base/android/media_drm_bridge_unittest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/android/build_info.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" diff --git a/media/base/android/media_jni_registrar.cc b/media/base/android/media_jni_registrar.cc index cc8bc1d..70f16eb 100644 --- a/media/base/android/media_jni_registrar.cc +++ b/media/base/android/media_jni_registrar.cc @@ -4,7 +4,6 @@ #include "media/base/android/media_jni_registrar.h" -#include "base/basictypes.h" #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc index 246bd7c..e0cdb66 100644 --- a/media/base/android/media_player_bridge.cc +++ b/media/base/android/media_player_bridge.cc @@ -7,7 +7,6 @@ #include "base/android/context_utils.h" #include "base/android/jni_android.h" #include "base/android/jni_string.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "jni/MediaPlayerBridge_jni.h" @@ -144,8 +143,8 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) { CHECK(env); int fd; - int64 offset; - int64 size; + int64_t offset; + int64_t size; if (InterceptMediaUrl(url, &fd, &offset, &size)) { if (!Java_MediaPlayerBridge_setDataSourceFromFd( env, j_media_player_bridge_.obj(), fd, offset, size)) { @@ -186,8 +185,10 @@ void MediaPlayerBridge::SetDataSource(const std::string& url) { OnMediaError(MEDIA_ERROR_FORMAT); } -bool MediaPlayerBridge::InterceptMediaUrl( - const std::string& url, int* fd, int64* offset, int64* size) { +bool MediaPlayerBridge::InterceptMediaUrl(const std::string& url, + int* fd, + int64_t* offset, + int64_t* size) { // Sentinel value to check whether the output arguments have been set. const int kUnsetValue = -1; @@ -246,8 +247,8 @@ void MediaPlayerBridge::ExtractMediaMetadata(const std::string& url) { } int fd; - int64 offset; - int64 size; + int64_t offset; + int64_t size; if (InterceptMediaUrl(url, &fd, &offset, &size)) { manager()->GetMediaResourceGetter()->ExtractMediaMetadata( fd, offset, size, diff --git a/media/base/android/media_player_bridge.h b/media/base/android/media_player_bridge.h index 903f34b..b5031e8 100644 --- a/media/base/android/media_player_bridge.h +++ b/media/base/android/media_player_bridge.h @@ -138,8 +138,10 @@ class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid { // Returns true if a MediaUrlInterceptor registered by the embedder has // intercepted the url. - bool InterceptMediaUrl( - const std::string& url, int* fd, int64* offset, int64* size); + bool InterceptMediaUrl(const std::string& url, + int* fd, + int64_t* offset, + int64_t* size); // Whether the player is prepared for playback. bool prepared_; diff --git a/media/base/android/media_player_manager.h b/media/base/android/media_player_manager.h index e9edd88..802c1c9 100644 --- a/media/base/android/media_player_manager.h +++ b/media/base/android/media_player_manager.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_ #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_ -#include "base/basictypes.h" #include "base/time/time.h" #include "media/base/android/demuxer_stream_player_params.h" #include "media/base/media_export.h" diff --git a/media/base/android/media_resource_getter.h b/media/base/android/media_resource_getter.h index 19560ed..a0d1bb4 100644 --- a/media/base/android/media_resource_getter.h +++ b/media/base/android/media_resource_getter.h @@ -60,11 +60,10 @@ class MEDIA_EXPORT MediaResourceGetter { // Extracts the metadata from a file descriptor. Once completed, the // provided callback function will be run. - virtual void ExtractMediaMetadata( - const int fd, - const int64 offset, - const int64 size, - const ExtractMediaMetadataCB& callback) = 0; + virtual void ExtractMediaMetadata(const int fd, + const int64_t offset, + const int64_t size, + const ExtractMediaMetadataCB& callback) = 0; }; } // namespace media diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc index 610f459..eaa7269 100644 --- a/media/base/android/media_source_player.cc +++ b/media/base/android/media_source_player.cc @@ -9,7 +9,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "base/barrier_closure.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" @@ -117,7 +116,7 @@ bool MediaSourcePlayer::Seekable() { // 2^31 is the bound due to java player using 32-bit integer for time // values at millisecond resolution. return duration_ < - base::TimeDelta::FromMilliseconds(std::numeric_limits<int32>::max()); + base::TimeDelta::FromMilliseconds(std::numeric_limits<int32_t>::max()); } void MediaSourcePlayer::Start() { diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc index b7cab6c..16e0b29 100644 --- a/media/base/android/media_source_player_unittest.cc +++ b/media/base/android/media_source_player_unittest.cc @@ -4,7 +4,6 @@ #include <string> -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/stringprintf.h" @@ -247,9 +246,8 @@ class MediaSourcePlayerTest : public testing::Test { configs.audio_sampling_rate = use_low_sample_rate ? 11025 : 44100; scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile( "vorbis-extradata"); - configs.audio_extra_data = std::vector<uint8>( - buffer->data(), - buffer->data() + buffer->data_size()); + configs.audio_extra_data = std::vector<uint8_t>( + buffer->data(), buffer->data() + buffer->data_size()); return configs; } @@ -257,10 +255,9 @@ class MediaSourcePlayerTest : public testing::Test { EXPECT_EQ(audio_codec, kCodecAAC); configs.audio_sampling_rate = 48000; - uint8 aac_extra_data[] = { 0x13, 0x10 }; - configs.audio_extra_data = std::vector<uint8>( - aac_extra_data, - aac_extra_data + 2); + uint8_t aac_extra_data[] = {0x13, 0x10}; + configs.audio_extra_data = + std::vector<uint8_t>(aac_extra_data, aac_extra_data + 2); return configs; } @@ -375,13 +372,13 @@ class MediaSourcePlayerTest : public testing::Test { buffer = ReadTestDataFile( use_large_size_video ? "vp8-I-frame-640x240" : "vp8-I-frame-320x240"); } - unit.data = std::vector<uint8>( - buffer->data(), buffer->data() + buffer->data_size()); + unit.data = std::vector<uint8_t>(buffer->data(), + buffer->data() + buffer->data_size()); if (is_audio) { // Vorbis needs 4 extra bytes padding on Android to decode properly. Check // NuMediaExtractor.cpp in Android source code. - uint8 padding[4] = { 0xff , 0xff , 0xff , 0xff }; + uint8_t padding[4] = {0xff, 0xff, 0xff, 0xff}; unit.data.insert(unit.data.end(), padding, padding + 4); } @@ -872,7 +869,7 @@ TEST_F(MediaSourcePlayerTest, StartAudioDecoderWithInvalidConfig) { DemuxerConfigs configs = CreateAudioDemuxerConfigs(kCodecVorbis, false); // Replace with invalid |audio_extra_data| configs.audio_extra_data.clear(); - uint8 invalid_codec_data[] = { 0x00, 0xff, 0xff, 0xff, 0xff }; + uint8_t invalid_codec_data[] = {0x00, 0xff, 0xff, 0xff, 0xff}; configs.audio_extra_data.insert(configs.audio_extra_data.begin(), invalid_codec_data, invalid_codec_data + 4); Start(configs); diff --git a/media/base/android/media_url_interceptor.h b/media/base/android/media_url_interceptor.h index e1db623..4ecb0d8 100644 --- a/media/base/android/media_url_interceptor.h +++ b/media/base/android/media_url_interceptor.h @@ -27,8 +27,8 @@ class MEDIA_EXPORT MediaUrlInterceptor { // - |size|: size in bytes of the media element. virtual bool Intercept(const std::string& url, int* fd, - int64* offset, - int64* size) const = 0; + int64_t* offset, + int64_t* size) const = 0; }; } // namespace media diff --git a/media/base/android/sdk_media_codec_bridge.cc b/media/base/android/sdk_media_codec_bridge.cc index 0176424..7b9c9ab 100644 --- a/media/base/android/sdk_media_codec_bridge.cc +++ b/media/base/android/sdk_media_codec_bridge.cc @@ -11,7 +11,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_util.h" @@ -306,7 +305,7 @@ bool SdkMediaCodecBridge::CopyFromOutputBuffer(int index, src_capacity - offset < static_cast<size_t>(dst_size)) { return false; } - memcpy(dst, static_cast<uint8*>(src_data) + offset, dst_size); + memcpy(dst, static_cast<uint8_t*>(src_data) + offset, dst_size); return true; } @@ -317,7 +316,7 @@ int SdkMediaCodecBridge::GetOutputBufferAddress(int index, ScopedJavaLocalRef<jobject> j_buffer( Java_MediaCodecBridge_getOutputBuffer(env, j_media_codec_.obj(), index)); *addr = - reinterpret_cast<uint8*>(env->GetDirectBufferAddress(j_buffer.obj())) + + reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(j_buffer.obj())) + offset; return env->GetDirectBufferCapacity(j_buffer.obj()) - offset; } diff --git a/media/base/android/sdk_media_codec_bridge_unittest.cc b/media/base/android/sdk_media_codec_bridge_unittest.cc index 2f6274f..31fa690 100644 --- a/media/base/android/sdk_media_codec_bridge_unittest.cc +++ b/media/base/android/sdk_media_codec_bridge_unittest.cc @@ -4,7 +4,6 @@ #include <string> -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "media/base/android/media_codec_util.h" @@ -109,7 +108,7 @@ static inline const base::TimeDelta InfiniteTimeOut() { } void DecodeMediaFrame(VideoCodecBridge* media_codec, - const uint8* data, + const uint8_t* data, size_t data_size, const base::TimeDelta input_presentation_timestamp, const base::TimeDelta initial_timestamp_lower_bound) { @@ -166,7 +165,7 @@ TEST(SdkMediaCodecBridgeTest, DoNormal) { ASSERT_EQ(MEDIA_CODEC_OK, status); ASSERT_GE(input_buf_index, 0); - int64 input_pts = kPresentationTimeBase; + int64_t input_pts = kPresentationTimeBase; media_codec->QueueInputBuffer(input_buf_index, test_mp3, sizeof(test_mp3), base::TimeDelta::FromMicroseconds(++input_pts)); @@ -217,20 +216,20 @@ TEST(SdkMediaCodecBridgeTest, InvalidVorbisHeader) { media_codec.reset(AudioCodecBridge::Create(kCodecVorbis)); // The first byte of the header is not 0x02. - uint8 invalid_first_byte[] = {0x00, 0xff, 0xff, 0xff, 0xff}; + uint8_t invalid_first_byte[] = {0x00, 0xff, 0xff, 0xff, 0xff}; EXPECT_FALSE(media_codec->ConfigureAndStart( kCodecVorbis, 44100, 2, invalid_first_byte, sizeof(invalid_first_byte), 0, 0, false, nullptr)); // Size of the header does not match with the data we passed in. - uint8 invalid_size[] = {0x02, 0x01, 0xff, 0x01, 0xff}; + uint8_t invalid_size[] = {0x02, 0x01, 0xff, 0x01, 0xff}; EXPECT_FALSE(media_codec->ConfigureAndStart( kCodecVorbis, 44100, 2, invalid_size, sizeof(invalid_size), 0, 0, false, nullptr)); // Size of the header is too large. size_t large_size = 8 * 1024 * 1024 + 2; - uint8* very_large_header = new uint8[large_size]; + uint8_t* very_large_header = new uint8_t[large_size]; very_large_header[0] = 0x02; for (size_t i = 1; i < large_size - 1; ++i) very_large_header[i] = 0xff; @@ -246,7 +245,7 @@ TEST(SdkMediaCodecBridgeTest, InvalidOpusHeader) { scoped_ptr<media::AudioCodecBridge> media_codec; media_codec.reset(AudioCodecBridge::Create(kCodecOpus)); - uint8 dummy_extra_data[] = {0, 0}; + uint8_t dummy_extra_data[] = {0, 0}; // Extra Data is NULL. EXPECT_FALSE(media_codec->ConfigureAndStart(kCodecOpus, 48000, 2, nullptr, 0, @@ -274,8 +273,8 @@ TEST(SdkMediaCodecBridgeTest, PresentationTimestampsDoNotDecrease) { base::TimeDelta(), base::TimeDelta()); // Simulate a seek to 10 seconds, and each chunk has 2 I-frames. - std::vector<uint8> chunk(buffer->data(), - buffer->data() + buffer->data_size()); + std::vector<uint8_t> chunk(buffer->data(), + buffer->data() + buffer->data_size()); chunk.insert(chunk.end(), buffer->data(), buffer->data() + buffer->data_size()); media_codec->Reset(); diff --git a/media/base/android/test_data_factory.cc b/media/base/android/test_data_factory.cc index e9012d85..a6f3db8 100644 --- a/media/base/android/test_data_factory.cc +++ b/media/base/android/test_data_factory.cc @@ -26,7 +26,7 @@ DemuxerConfigs TestDataFactory::CreateAudioConfigs(AudioCodec audio_codec, configs.audio_sampling_rate = 44100; scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("vorbis-extradata"); - configs.audio_extra_data = std::vector<uint8>( + configs.audio_extra_data = std::vector<uint8_t>( buffer->data(), buffer->data() + buffer->data_size()); } break; @@ -156,8 +156,8 @@ void TestDataFactory::LoadPackets(const char* file_name_template) { for (int i = 0; i < 4; ++i) { scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(base::StringPrintf(file_name_template, i)); - packet_[i] = std::vector<uint8>(buffer->data(), - buffer->data() + buffer->data_size()); + packet_[i] = std::vector<uint8_t>(buffer->data(), + buffer->data() + buffer->data_size()); } } diff --git a/media/base/android/webaudio_media_codec_bridge.cc b/media/base/android/webaudio_media_codec_bridge.cc index 558e01f..5c60e11 100644 --- a/media/base/android/webaudio_media_codec_bridge.cc +++ b/media/base/android/webaudio_media_codec_bridge.cc @@ -16,14 +16,12 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" -#include "base/basictypes.h" #include "base/files/scoped_file.h" #include "base/logging.h" #include "base/posix/eintr_wrapper.h" #include "jni/WebAudioMediaCodecBridge_jni.h" #include "media/base/android/webaudio_media_codec_info.h" - using base::android::AttachCurrentThread; namespace media { diff --git a/media/base/audio_block_fifo.cc b/media/base/audio_block_fifo.cc index 000d1310..31aa3c9 100644 --- a/media/base/audio_block_fifo.cc +++ b/media/base/audio_block_fifo.cc @@ -31,7 +31,7 @@ void AudioBlockFifo::Push(const void* source, DCHECK_LT(available_blocks_, static_cast<int>(audio_blocks_.size())); CHECK_LE(frames, GetUnfilledFrames()); - const uint8* source_ptr = static_cast<const uint8*>(source); + const uint8_t* source_ptr = static_cast<const uint8_t*>(source); int frames_to_push = frames; while (frames_to_push) { // Get the current write block. diff --git a/media/base/audio_block_fifo_unittest.cc b/media/base/audio_block_fifo_unittest.cc index b46a139..81ddecc 100644 --- a/media/base/audio_block_fifo_unittest.cc +++ b/media/base/audio_block_fifo_unittest.cc @@ -30,7 +30,7 @@ class AudioBlockFifoTest : public testing::Test { DCHECK_LE(frames_to_push, fifo->GetUnfilledFrames()); const int bytes_per_sample = 2; const int data_byte_size = bytes_per_sample * channels * frames_to_push; - scoped_ptr<uint8[]> data(new uint8[data_byte_size]); + scoped_ptr<uint8_t[]> data(new uint8_t[data_byte_size]); memset(data.get(), 1, data_byte_size); fifo->Push(data.get(), frames_to_push, bytes_per_sample); } diff --git a/media/base/audio_buffer.cc b/media/base/audio_buffer.cc index 168d371..ac9c31a 100644 --- a/media/base/audio_buffer.cc +++ b/media/base/audio_buffer.cc @@ -25,7 +25,7 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format, int sample_rate, int frame_count, bool create_buffer, - const uint8* const* data, + const uint8_t* const* data, const base::TimeDelta timestamp) : sample_format_(sample_format), channel_layout_(channel_layout), @@ -63,8 +63,8 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format, // Allocate a contiguous buffer for all the channel data. data_size_ = channel_count_ * block_size_per_channel; - data_.reset( - static_cast<uint8*>(base::AlignedAlloc(data_size_, kChannelAlignment))); + data_.reset(static_cast<uint8_t*>( + base::AlignedAlloc(data_size_, kChannelAlignment))); channel_data_.reserve(channel_count_); // Copy each channel's data into the appropriate spot. @@ -82,7 +82,7 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format, // contain the data for all channels. data_size_ = data_size_per_channel * channel_count_; data_.reset( - static_cast<uint8*>(base::AlignedAlloc(data_size_, kChannelAlignment))); + static_cast<uint8_t*>(base::AlignedAlloc(data_size_, kChannelAlignment))); channel_data_.reserve(1); channel_data_.push_back(data_.get()); if (data) @@ -98,7 +98,7 @@ scoped_refptr<AudioBuffer> AudioBuffer::CopyFrom( int channel_count, int sample_rate, int frame_count, - const uint8* const* data, + const uint8_t* const* data, const base::TimeDelta timestamp) { // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. CHECK_GT(frame_count, 0); // Otherwise looks like an EOF buffer. @@ -165,47 +165,47 @@ scoped_refptr<AudioBuffer> AudioBuffer::CreateEOSBuffer() { template <typename Target, typename Dest> static inline Dest ConvertSample(Target value); -// Convert int16 values in the range [INT16_MIN, INT16_MAX] to [-1.0, 1.0]. +// Convert int16_t values in the range [INT16_MIN, INT16_MAX] to [-1.0, 1.0]. template <> -inline float ConvertSample<int16, float>(int16 value) { - return value * (value < 0 ? -1.0f / std::numeric_limits<int16>::min() - : 1.0f / std::numeric_limits<int16>::max()); +inline float ConvertSample<int16_t, float>(int16_t value) { + return value * (value < 0 ? -1.0f / std::numeric_limits<int16_t>::min() + : 1.0f / std::numeric_limits<int16_t>::max()); } -// Specializations for int32 +// Specializations for int32_t template <> -inline int32 ConvertSample<int16, int32>(int16 value) { - return static_cast<int32>(value) << 16; +inline int32_t ConvertSample<int16_t, int32_t>(int16_t value) { + return static_cast<int32_t>(value) << 16; } template <> -inline int32 ConvertSample<int32, int32>(int32 value) { +inline int32_t ConvertSample<int32_t, int32_t>(int32_t value) { return value; } template <> -inline int32 ConvertSample<float, int32>(float value) { - return static_cast<int32>(value < 0 - ? (-value) * std::numeric_limits<int32>::min() - : value * std::numeric_limits<int32>::max()); +inline int32_t ConvertSample<float, int32_t>(float value) { + return static_cast<int32_t>( + value < 0 ? (-value) * std::numeric_limits<int32_t>::min() + : value * std::numeric_limits<int32_t>::max()); } -// Specializations for int16 +// Specializations for int16_t template <> -inline int16 ConvertSample<int16, int16>(int16 sample) { +inline int16_t ConvertSample<int16_t, int16_t>(int16_t sample) { return sample; } template <> -inline int16 ConvertSample<int32, int16>(int32 sample) { +inline int16_t ConvertSample<int32_t, int16_t>(int32_t sample) { return sample >> 16; } template <> -inline int16 ConvertSample<float, int16>(float sample) { - return static_cast<int16>( - nearbyint(sample < 0 ? (-sample) * std::numeric_limits<int16>::min() - : sample * std::numeric_limits<int16>::max())); +inline int16_t ConvertSample<float, int16_t>(float sample) { + return static_cast<int16_t>( + nearbyint(sample < 0 ? (-sample) * std::numeric_limits<int16_t>::min() + : sample * std::numeric_limits<int16_t>::max())); } void AudioBuffer::ReadFrames(int frames_to_copy, @@ -248,12 +248,12 @@ void AudioBuffer::ReadFrames(int frames_to_copy, // Format is planar signed16. Convert each value into float and insert into // output channel data. for (int ch = 0; ch < channel_count_; ++ch) { - const int16* source_data = - reinterpret_cast<const int16*>(channel_data_[ch]) + + const int16_t* source_data = + reinterpret_cast<const int16_t*>(channel_data_[ch]) + source_frame_offset; float* dest_data = dest->channel(ch) + dest_frame_offset; for (int i = 0; i < frames_to_copy; ++i) { - dest_data[i] = ConvertSample<int16, float>(source_data[i]); + dest_data[i] = ConvertSample<int16_t, float>(source_data[i]); } } return; @@ -280,13 +280,13 @@ void AudioBuffer::ReadFrames(int frames_to_copy, sample_format_ == kSampleFormatS32); int bytes_per_channel = SampleFormatToBytesPerChannel(sample_format_); int frame_size = channel_count_ * bytes_per_channel; - const uint8* source_data = data_.get() + source_frame_offset * frame_size; + const uint8_t* source_data = data_.get() + source_frame_offset * frame_size; dest->FromInterleavedPartial( source_data, dest_frame_offset, frames_to_copy, bytes_per_channel); } template <class Target, typename Dest> -void InterleaveAndConvert(const std::vector<uint8*>& channel_data, +void InterleaveAndConvert(const std::vector<uint8_t*>& channel_data, size_t frames_to_copy, int trim_start, Dest* dest_data) { @@ -301,7 +301,7 @@ void InterleaveAndConvert(const std::vector<uint8*>& channel_data, } template <typename Dest> -void ReadFramesInterleaved(const std::vector<uint8*>& channel_data, +void ReadFramesInterleaved(const std::vector<uint8_t*>& channel_data, int channel_count, SampleFormat sample_format, int frames_to_copy, @@ -312,12 +312,12 @@ void ReadFramesInterleaved(const std::vector<uint8*>& channel_data, NOTREACHED(); break; case kSampleFormatS16: - InterleaveAndConvert<int16, Dest>( + InterleaveAndConvert<int16_t, Dest>( channel_data, frames_to_copy * channel_count, trim_start, dest_data); break; case kSampleFormatS24: case kSampleFormatS32: - InterleaveAndConvert<int32, Dest>( + InterleaveAndConvert<int32_t, Dest>( channel_data, frames_to_copy * channel_count, trim_start, dest_data); break; case kSampleFormatF32: @@ -325,16 +325,16 @@ void ReadFramesInterleaved(const std::vector<uint8*>& channel_data, channel_data, frames_to_copy * channel_count, trim_start, dest_data); break; case kSampleFormatPlanarS16: - InterleaveAndConvert<int16, Dest>(channel_data, frames_to_copy, - trim_start, dest_data); + InterleaveAndConvert<int16_t, Dest>(channel_data, frames_to_copy, + trim_start, dest_data); break; case kSampleFormatPlanarF32: InterleaveAndConvert<float, Dest>(channel_data, frames_to_copy, trim_start, dest_data); break; case kSampleFormatPlanarS32: - InterleaveAndConvert<int32, Dest>(channel_data, frames_to_copy, - trim_start, dest_data); + InterleaveAndConvert<int32_t, Dest>(channel_data, frames_to_copy, + trim_start, dest_data); break; case kUnknownSampleFormat: NOTREACHED(); @@ -343,17 +343,17 @@ void ReadFramesInterleaved(const std::vector<uint8*>& channel_data, } void AudioBuffer::ReadFramesInterleavedS32(int frames_to_copy, - int32* dest_data) { + int32_t* dest_data) { DCHECK_LE(frames_to_copy, adjusted_frame_count_); - ReadFramesInterleaved<int32>(channel_data_, channel_count_, sample_format_, - frames_to_copy, trim_start_, dest_data); + ReadFramesInterleaved<int32_t>(channel_data_, channel_count_, sample_format_, + frames_to_copy, trim_start_, dest_data); } void AudioBuffer::ReadFramesInterleavedS16(int frames_to_copy, - int16* dest_data) { + int16_t* dest_data) { DCHECK_LE(frames_to_copy, adjusted_frame_count_); - ReadFramesInterleaved<int16>(channel_data_, channel_count_, sample_format_, - frames_to_copy, trim_start_, dest_data); + ReadFramesInterleaved<int16_t>(channel_data_, channel_count_, sample_format_, + frames_to_copy, trim_start_, dest_data); } void AudioBuffer::TrimStart(int frames_to_trim) { diff --git a/media/base/audio_buffer.h b/media/base/audio_buffer.h index bf8e433..fb73c34 100644 --- a/media/base/audio_buffer.h +++ b/media/base/audio_buffer.h @@ -50,7 +50,7 @@ class MEDIA_EXPORT AudioBuffer int channel_count, int sample_rate, int frame_count, - const uint8* const* data, + const uint8_t* const* data, const base::TimeDelta timestamp); // Create an AudioBuffer with |frame_count| frames. Buffer is allocated, but @@ -86,13 +86,13 @@ class MEDIA_EXPORT AudioBuffer // Copy |frames_to_copy| frames into |dest|, |frames_to_copy| is the number of // frames to copy. The frames are converted from their source format into - // interleaved int32. - void ReadFramesInterleavedS32(int frames_to_copy, int32* dest); + // interleaved int32_t. + void ReadFramesInterleavedS32(int frames_to_copy, int32_t* dest); // Copy |frames_to_copy| frames into |dest|, |frames_to_copy| is the number of // frames to copy. The frames are converted from their source format into - // interleaved int16. - void ReadFramesInterleavedS16(int frames_to_copy, int16* dest); + // interleaved int16_t. + void ReadFramesInterleavedS16(int frames_to_copy, int16_t* dest); // Trim an AudioBuffer by removing |frames_to_trim| frames from the start. // Timestamp and duration are adjusted to reflect the fewer frames. @@ -129,7 +129,7 @@ class MEDIA_EXPORT AudioBuffer // Access to the raw buffer for ffmpeg to write directly to. Data for planar // data is grouped by channel. There is only 1 entry for interleaved formats. - const std::vector<uint8*>& channel_data() const { return channel_data_; } + const std::vector<uint8_t*>& channel_data() const { return channel_data_; } private: friend class base::RefCountedThreadSafe<AudioBuffer>; @@ -150,7 +150,7 @@ class MEDIA_EXPORT AudioBuffer int sample_rate, int frame_count, bool create_buffer, - const uint8* const* data, + const uint8_t* const* data, const base::TimeDelta timestamp); virtual ~AudioBuffer(); @@ -166,11 +166,11 @@ class MEDIA_EXPORT AudioBuffer base::TimeDelta duration_; // Contiguous block of channel data. - scoped_ptr<uint8, base::AlignedFreeDeleter> data_; + scoped_ptr<uint8_t, base::AlignedFreeDeleter> data_; size_t data_size_; // For planar data, points to each channels data. - std::vector<uint8*> channel_data_; + std::vector<uint8_t*> channel_data_; DISALLOW_IMPLICIT_CONSTRUCTORS(AudioBuffer); }; diff --git a/media/base/audio_buffer_converter_unittest.cc b/media/base/audio_buffer_converter_unittest.cc index b022523..d48e5f6 100644 --- a/media/base/audio_buffer_converter_unittest.cc +++ b/media/base/audio_buffer_converter_unittest.cc @@ -22,14 +22,9 @@ static scoped_refptr<AudioBuffer> MakeTestBuffer(int sample_rate, ChannelLayout channel_layout, int channel_count, int frames) { - return MakeAudioBuffer<uint8>(kSampleFormatU8, - channel_layout, - channel_count, - sample_rate, - 0, - 1, - frames, - base::TimeDelta::FromSeconds(0)); + return MakeAudioBuffer<uint8_t>(kSampleFormatU8, channel_layout, + channel_count, sample_rate, 0, 1, frames, + base::TimeDelta::FromSeconds(0)); } class AudioBufferConverterTest : public ::testing::Test { diff --git a/media/base/audio_buffer_queue.h b/media/base/audio_buffer_queue.h index b5e16e08..28cd5bc 100644 --- a/media/base/audio_buffer_queue.h +++ b/media/base/audio_buffer_queue.h @@ -7,7 +7,6 @@ #include <deque> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/audio_buffer.h" #include "media/base/media_export.h" diff --git a/media/base/audio_buffer_unittest.cc b/media/base/audio_buffer_unittest.cc index b3025e0..789a692 100644 --- a/media/base/audio_buffer_unittest.cc +++ b/media/base/audio_buffer_unittest.cc @@ -479,7 +479,7 @@ static void ReadFramesInterleavedS32Test(SampleFormat sample_format) { EXPECT_EQ(frames, buffer->frame_count()); EXPECT_EQ(duration, buffer->duration()); - int32* dest = new int32[frames * channels]; + int32_t* dest = new int32_t[frames * channels]; buffer->ReadFramesInterleavedS32(frames, dest); int count = 0; @@ -521,7 +521,7 @@ static void ReadFramesInterleavedS16Test(SampleFormat sample_format) { EXPECT_EQ(frames, buffer->frame_count()); EXPECT_EQ(duration, buffer->duration()); - int16* dest = new int16[frames * channels]; + int16_t* dest = new int16_t[frames * channels]; buffer->ReadFramesInterleavedS16(frames, dest); int count = 0; diff --git a/media/base/audio_bus.h b/media/base/audio_bus.h index cf598c2..25e34e3 100644 --- a/media/base/audio_bus.h +++ b/media/base/audio_bus.h @@ -58,7 +58,8 @@ class MEDIA_EXPORT AudioBus { // data. Expects interleaving to be [ch0, ch1, ..., chN, ch0, ch1, ...] with // |bytes_per_sample| per value. Values are scaled and bias corrected during // conversion. ToInterleaved() will also clip values to format range. - // Handles uint8, int16, and int32 currently. FromInterleaved() will zero out + // Handles uint8_t, int16_t, and int32_t currently. FromInterleaved() will + // zero out // any unfilled frames when |frames| is less than frames(). void FromInterleaved(const void* source, int frames, int bytes_per_sample); void ToInterleaved(int frames, int bytes_per_sample, void* dest) const; diff --git a/media/base/audio_bus_perftest.cc b/media/base/audio_bus_perftest.cc index c126d99..80e089e 100644 --- a/media/base/audio_bus_perftest.cc +++ b/media/base/audio_bus_perftest.cc @@ -45,9 +45,9 @@ TEST(AudioBusPerfTest, Interleave) { FakeAudioRenderCallback callback(0.2); callback.Render(bus.get(), 0, 0); - RunInterleaveBench<int8>(bus.get(), "int8"); - RunInterleaveBench<int16>(bus.get(), "int16"); - RunInterleaveBench<int32>(bus.get(), "int32"); + RunInterleaveBench<int8_t>(bus.get(), "int8_t"); + RunInterleaveBench<int16_t>(bus.get(), "int16_t"); + RunInterleaveBench<int32_t>(bus.get(), "int32_t"); } } // namespace media diff --git a/media/base/audio_bus_unittest.cc b/media/base/audio_bus_unittest.cc index 3a3185a..83abe3f 100644 --- a/media/base/audio_bus_unittest.cc +++ b/media/base/audio_bus_unittest.cc @@ -280,7 +280,7 @@ TEST_F(AudioBusTest, FromInterleaved) { kTestVectorFrames * sizeof(*expected->channel(ch))); } { - SCOPED_TRACE("uint8"); + SCOPED_TRACE("uint8_t"); bus->Zero(); bus->FromInterleaved( kTestVectorUint8, kTestVectorFrames, sizeof(*kTestVectorUint8)); @@ -290,7 +290,7 @@ TEST_F(AudioBusTest, FromInterleaved) { 1.0f / (std::numeric_limits<uint8_t>::max() - 1)); } { - SCOPED_TRACE("int16"); + SCOPED_TRACE("int16_t"); bus->Zero(); bus->FromInterleaved( kTestVectorInt16, kTestVectorFrames, sizeof(*kTestVectorInt16)); @@ -298,7 +298,7 @@ TEST_F(AudioBusTest, FromInterleaved) { 1.0f / (std::numeric_limits<uint16_t>::max() + 1.0f)); } { - SCOPED_TRACE("int32"); + SCOPED_TRACE("int32_t"); bus->Zero(); bus->FromInterleaved( kTestVectorInt32, kTestVectorFrames, sizeof(*kTestVectorInt32)); @@ -342,21 +342,21 @@ TEST_F(AudioBusTest, ToInterleaved) { kTestVectorFrames * sizeof(*bus->channel(ch))); } { - SCOPED_TRACE("uint8"); + SCOPED_TRACE("uint8_t"); uint8_t test_array[arraysize(kTestVectorUint8)]; bus->ToInterleaved(bus->frames(), sizeof(*kTestVectorUint8), test_array); ASSERT_EQ(memcmp( test_array, kTestVectorUint8, sizeof(kTestVectorUint8)), 0); } { - SCOPED_TRACE("int16"); + SCOPED_TRACE("int16_t"); int16_t test_array[arraysize(kTestVectorInt16)]; bus->ToInterleaved(bus->frames(), sizeof(*kTestVectorInt16), test_array); ASSERT_EQ(memcmp( test_array, kTestVectorInt16, sizeof(kTestVectorInt16)), 0); } { - SCOPED_TRACE("int32"); + SCOPED_TRACE("int32_t"); int32_t test_array[arraysize(kTestVectorInt32)]; bus->ToInterleaved(bus->frames(), sizeof(*kTestVectorInt32), test_array); diff --git a/media/base/audio_capturer_source.h b/media/base/audio_capturer_source.h index ae60f91..31b39bb 100644 --- a/media/base/audio_capturer_source.h +++ b/media/base/audio_capturer_source.h @@ -7,7 +7,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/audio/audio_parameters.h" #include "media/base/audio_bus.h" diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h index ae72383..4607fa8 100644 --- a/media/base/audio_decoder_config.h +++ b/media/base/audio_decoder_config.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/time/time.h" #include "media/base/channel_layout.h" #include "media/base/media_export.h" @@ -70,7 +69,7 @@ class MEDIA_EXPORT AudioDecoderConfig { SampleFormat sample_format, ChannelLayout channel_layout, int samples_per_second, - const std::vector<uint8>& extra_data, + const std::vector<uint8_t>& extra_data, bool is_encrypted, base::TimeDelta seek_preroll, int codec_delay); diff --git a/media/base/audio_hash.cc b/media/base/audio_hash.cc index 7d70582..bc75288 100644 --- a/media/base/audio_hash.cc +++ b/media/base/audio_hash.cc @@ -21,12 +21,13 @@ AudioHash::AudioHash() AudioHash::~AudioHash() {} void AudioHash::Update(const AudioBus* audio_bus, int frames) { - // Use uint32 to ensure overflow is a defined operation. - for (uint32 ch = 0; ch < static_cast<uint32>(audio_bus->channels()); ++ch) { + // Use uint32_t to ensure overflow is a defined operation. + for (uint32_t ch = 0; ch < static_cast<uint32_t>(audio_bus->channels()); + ++ch) { const float* channel = audio_bus->channel(ch); - for (uint32 i = 0; i < static_cast<uint32>(frames); ++i) { - const uint32 kSampleIndex = sample_count_ + i; - const uint32 kHashIndex = + for (uint32_t i = 0; i < static_cast<uint32_t>(frames); ++i) { + const uint32_t kSampleIndex = sample_count_ + i; + const uint32_t kHashIndex = (kSampleIndex * (ch + 1)) % arraysize(audio_hash_); // Mix in a sine wave with the result so we ensure that sequences of empty @@ -40,7 +41,7 @@ void AudioHash::Update(const AudioBus* audio_bus, int frames) { } } - sample_count_ += static_cast<uint32>(frames); + sample_count_ += static_cast<uint32_t>(frames); } std::string AudioHash::ToString() const { diff --git a/media/base/audio_hash.h b/media/base/audio_hash.h index ec73383..4f47d97 100644 --- a/media/base/audio_hash.h +++ b/media/base/audio_hash.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/strings/string_piece.h" #include "media/base/media_export.h" @@ -46,9 +45,9 @@ class MEDIA_EXPORT AudioHash { // positives related to incorrect sample position. Value chosen by dice roll. float audio_hash_[6]; - // The total number of samples processed per channel. Uses a uint32 instead + // The total number of samples processed per channel. Uses a uint32_t instead // of size_t so overflows on 64-bit and 32-bit machines are equivalent. - uint32 sample_count_; + uint32_t sample_count_; DISALLOW_COPY_AND_ASSIGN(AudioHash); }; diff --git a/media/base/audio_renderer_sink.h b/media/base/audio_renderer_sink.h index b45c0fc..066ff1f 100644 --- a/media/base/audio_renderer_sink.h +++ b/media/base/audio_renderer_sink.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/logging.h" #include "base/memory/ref_counted.h" diff --git a/media/base/audio_splicer.cc b/media/base/audio_splicer.cc index 0eb9b14..4178cee 100644 --- a/media/base/audio_splicer.cc +++ b/media/base/audio_splicer.cc @@ -70,7 +70,7 @@ class AudioStreamSanitizer { // Similar to Reset(), but initializes the timestamp helper with the given // parameters. - void ResetTimestampState(int64 frame_count, base::TimeDelta base_timestamp); + void ResetTimestampState(int64_t frame_count, base::TimeDelta base_timestamp); // Adds a new buffer full of samples or end of stream buffer to the splicer. // Returns true if the buffer was accepted. False is returned if an error @@ -124,7 +124,7 @@ void AudioStreamSanitizer::Reset() { ResetTimestampState(0, kNoTimestamp()); } -void AudioStreamSanitizer::ResetTimestampState(int64 frame_count, +void AudioStreamSanitizer::ResetTimestampState(int64_t frame_count, base::TimeDelta base_timestamp) { output_buffers_.clear(); received_end_of_stream_ = false; diff --git a/media/base/audio_timestamp_helper.cc b/media/base/audio_timestamp_helper.cc index ef387ff..dd0892b 100644 --- a/media/base/audio_timestamp_helper.cc +++ b/media/base/audio_timestamp_helper.cc @@ -42,11 +42,11 @@ base::TimeDelta AudioTimestampHelper::GetFrameDuration(int frame_count) const { return end_timestamp - GetTimestamp(); } -int64 AudioTimestampHelper::GetFramesToTarget(base::TimeDelta target) const { +int64_t AudioTimestampHelper::GetFramesToTarget(base::TimeDelta target) const { DCHECK(base_timestamp_ != kNoTimestamp()); DCHECK(target >= base_timestamp_); - int64 delta_in_us = (target - GetTimestamp()).InMicroseconds(); + int64_t delta_in_us = (target - GetTimestamp()).InMicroseconds(); if (delta_in_us == 0) return 0; @@ -59,13 +59,13 @@ int64 AudioTimestampHelper::GetFramesToTarget(base::TimeDelta target) const { // Compute frame count for the time delta. This computation rounds to // the nearest whole number of frames. double threshold = microseconds_per_frame_ / 2; - int64 target_frame_count = + int64_t target_frame_count = (delta_from_base.InMicroseconds() + threshold) / microseconds_per_frame_; return target_frame_count - frame_count_; } base::TimeDelta AudioTimestampHelper::ComputeTimestamp( - int64 frame_count) const { + int64_t frame_count) const { DCHECK_GE(frame_count, 0); DCHECK(base_timestamp_ != kNoTimestamp()); double frames_us = microseconds_per_frame_ * frame_count; diff --git a/media/base/audio_timestamp_helper.h b/media/base/audio_timestamp_helper.h index 1da8b4a..6862209 100644 --- a/media/base/audio_timestamp_helper.h +++ b/media/base/audio_timestamp_helper.h @@ -33,7 +33,7 @@ class MEDIA_EXPORT AudioTimestampHelper { void SetBaseTimestamp(base::TimeDelta base_timestamp); base::TimeDelta base_timestamp() const; - int64 frame_count() const { return frame_count_; } + int64_t frame_count() const { return frame_count_; } // Adds |frame_count| to the frame counter. // Note: SetBaseTimestamp() must be called with a value other than @@ -52,17 +52,17 @@ class MEDIA_EXPORT AudioTimestampHelper { // Returns the number of frames needed to reach the target timestamp. // Note: |target| must be >= |base_timestamp_|. - int64 GetFramesToTarget(base::TimeDelta target) const; + int64_t GetFramesToTarget(base::TimeDelta target) const; private: - base::TimeDelta ComputeTimestamp(int64 frame_count) const; + base::TimeDelta ComputeTimestamp(int64_t frame_count) const; double microseconds_per_frame_; base::TimeDelta base_timestamp_; // Number of frames accumulated by AddFrames() calls. - int64 frame_count_; + int64_t frame_count_; DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTimestampHelper); }; diff --git a/media/base/audio_timestamp_helper_unittest.cc b/media/base/audio_timestamp_helper_unittest.cc index e61ae4a..a17ff2c 100644 --- a/media/base/audio_timestamp_helper_unittest.cc +++ b/media/base/audio_timestamp_helper_unittest.cc @@ -18,12 +18,12 @@ class AudioTimestampHelperTest : public ::testing::Test { // Adds frames to the helper and returns the current timestamp in // microseconds. - int64 AddFrames(int frames) { + int64_t AddFrames(int frames) { helper_.AddFrames(frames); return helper_.GetTimestamp().InMicroseconds(); } - int64 FramesToTarget(int target_in_microseconds) { + int64_t FramesToTarget(int target_in_microseconds) { return helper_.GetFramesToTarget( base::TimeDelta::FromMicroseconds(target_in_microseconds)); } @@ -73,7 +73,7 @@ TEST_F(AudioTimestampHelperTest, GetDuration) { helper_.SetBaseTimestamp(base::TimeDelta::FromMicroseconds(100)); int frame_count = 5; - int64 expected_durations[] = { 113, 113, 114, 113, 113, 114 }; + int64_t expected_durations[] = {113, 113, 114, 113, 113, 114}; for (size_t i = 0; i < arraysize(expected_durations); ++i) { base::TimeDelta duration = helper_.GetFrameDuration(frame_count); EXPECT_EQ(expected_durations[i], duration.InMicroseconds()); diff --git a/media/base/audio_video_metadata_extractor.h b/media/base/audio_video_metadata_extractor.h index 953ece0..97f7a5b 100644 --- a/media/base/audio_video_metadata_extractor.h +++ b/media/base/audio_video_metadata_extractor.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" struct AVDictionary; diff --git a/media/base/bit_reader.cc b/media/base/bit_reader.cc index c0d30d6..83ca40e 100644 --- a/media/base/bit_reader.cc +++ b/media/base/bit_reader.cc @@ -6,7 +6,7 @@ namespace media { -BitReader::BitReader(const uint8* data, int size) +BitReader::BitReader(const uint8_t* data, int size) : initial_size_(size), data_(data), bytes_left_(size), @@ -17,7 +17,7 @@ BitReader::BitReader(const uint8* data, int size) BitReader::~BitReader() {} -int BitReader::GetBytes(int max_nbytes, const uint8** out) { +int BitReader::GetBytes(int max_nbytes, const uint8_t** out) { DCHECK_GE(max_nbytes, 0); DCHECK(out); diff --git a/media/base/bit_reader.h b/media/base/bit_reader.h index fda8541..0dcd895 100644 --- a/media/base/bit_reader.h +++ b/media/base/bit_reader.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_BIT_READER_H_ #define MEDIA_BASE_BIT_READER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "media/base/bit_reader_core.h" @@ -18,7 +17,7 @@ class MEDIA_EXPORT BitReader public: // Initialize the reader to start reading at |data|, |size| being size // of |data| in bytes. - BitReader(const uint8* data, int size); + BitReader(const uint8_t* data, int size); ~BitReader() override; template<typename T> bool ReadBits(int num_bits, T* out) { @@ -43,13 +42,13 @@ class MEDIA_EXPORT BitReader private: // BitReaderCore::ByteStreamProvider implementation. - int GetBytes(int max_n, const uint8** out) override; + int GetBytes(int max_n, const uint8_t** out) override; // Total number of bytes that was initially passed to BitReader. const int initial_size_; // Pointer to the next unread byte in the stream. - const uint8* data_; + const uint8_t* data_; // Bytes left in the stream. int bytes_left_; diff --git a/media/base/bit_reader_core.cc b/media/base/bit_reader_core.cc index 042e73c..32d2d53 100644 --- a/media/base/bit_reader_core.cc +++ b/media/base/bit_reader_core.cc @@ -9,7 +9,7 @@ #include "base/sys_byteorder.h" namespace { -const int kRegWidthInBits = sizeof(uint64) * 8; +const int kRegWidthInBits = sizeof(uint64_t) * 8; } namespace media { @@ -43,7 +43,7 @@ bool BitReaderCore::ReadFlag(bool* flag) { return true; } -int BitReaderCore::PeekBitsMsbAligned(int num_bits, uint64* out) { +int BitReaderCore::PeekBitsMsbAligned(int num_bits, uint64_t* out) { // Try to have at least |num_bits| in the bit register. if (nbits_ < num_bits) Refill(num_bits); @@ -54,7 +54,7 @@ int BitReaderCore::PeekBitsMsbAligned(int num_bits, uint64* out) { bool BitReaderCore::SkipBitsSmall(int num_bits) { DCHECK_GE(num_bits, 0); - uint64 dummy; + uint64_t dummy; while (num_bits >= kRegWidthInBits) { if (!ReadBitsInternal(kRegWidthInBits, &dummy)) return false; @@ -81,7 +81,7 @@ bool BitReaderCore::SkipBits(int num_bits) { // Next, skip an integer number of bytes. const int nbytes = num_bits / 8; if (nbytes > 0) { - const uint8* byte_stream_window; + const uint8_t* byte_stream_window; const int window_size = byte_stream_provider_->GetBytes(nbytes, &byte_stream_window); DCHECK_GE(window_size, 0); @@ -100,7 +100,7 @@ int BitReaderCore::bits_read() const { return bits_read_; } -bool BitReaderCore::ReadBitsInternal(int num_bits, uint64* out) { +bool BitReaderCore::ReadBitsInternal(int num_bits, uint64_t* out) { DCHECK_GE(num_bits, 0); if (num_bits == 0) { @@ -147,7 +147,7 @@ bool BitReaderCore::Refill(int min_nbits) { int max_nbytes = sizeof(reg_next_); // Refill. - const uint8* byte_stream_window; + const uint8_t* byte_stream_window; int window_size = byte_stream_provider_->GetBytes(max_nbytes, &byte_stream_window); DCHECK_GE(window_size, 0); diff --git a/media/base/bit_reader_core.h b/media/base/bit_reader_core.h index 525d619..587d71d 100644 --- a/media/base/bit_reader_core.h +++ b/media/base/bit_reader_core.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_BIT_READER_CORE_H_ #define MEDIA_BASE_BIT_READER_CORE_H_ -#include "base/basictypes.h" #include "base/logging.h" #include "media/base/media_export.h" @@ -23,7 +22,7 @@ class MEDIA_EXPORT BitReaderCore { // Set |*array| to point to a memory buffer containing those n bytes. // Note: |*array| must be valid until the next call to GetBytes // but there is no guarantee it is valid after. - virtual int GetBytes(int max_n, const uint8** array) = 0; + virtual int GetBytes(int max_n, const uint8_t** array) = 0; }; // Lifetime of |byte_stream_provider| must be longer than BitReaderCore. @@ -54,7 +53,7 @@ class MEDIA_EXPORT BitReaderCore { // integer type. template<typename T> bool ReadBits(int num_bits, T* out) { DCHECK_LE(num_bits, static_cast<int>(sizeof(T) * 8)); - uint64 temp; + uint64_t temp; bool ret = ReadBitsInternal(num_bits, &temp); *out = static_cast<T>(temp); return ret; @@ -72,7 +71,7 @@ class MEDIA_EXPORT BitReaderCore { // - The number of bits returned can be more than |num_bits|. // - However, it will be strictly less than |num_bits| // if and only if there are not enough bits left in the stream. - int PeekBitsMsbAligned(int num_bits, uint64* out); + int PeekBitsMsbAligned(int num_bits, uint64_t* out); // Skip |num_bits| next bits from stream. Return false if the given number of // bits cannot be skipped (not enough bits in the stream), true otherwise. @@ -91,7 +90,7 @@ class MEDIA_EXPORT BitReaderCore { bool SkipBitsSmall(int num_bits); // Help function used by ReadBits to avoid inlining the bit reading logic. - bool ReadBitsInternal(int num_bits, uint64* out); + bool ReadBitsInternal(int num_bits, uint64_t* out); // Refill bit registers to have at least |min_nbits| bits available. // Return true if the mininimum bit count condition is met after the refill. @@ -108,12 +107,12 @@ class MEDIA_EXPORT BitReaderCore { // Number of bits in |reg_| that have not been consumed yet. // Note: bits are consumed from MSB to LSB. int nbits_; - uint64 reg_; + uint64_t reg_; // Number of bits in |reg_next_| that have not been consumed yet. // Note: bits are consumed from MSB to LSB. int nbits_next_; - uint64 reg_next_; + uint64_t reg_next_; DISALLOW_COPY_AND_ASSIGN(BitReaderCore); }; diff --git a/media/base/bit_reader_unittest.cc b/media/base/bit_reader_unittest.cc index 88431ef..1f5d0a7 100644 --- a/media/base/bit_reader_unittest.cc +++ b/media/base/bit_reader_unittest.cc @@ -8,7 +8,7 @@ namespace media { -static void SetBit(uint8* buf, size_t size, size_t bit_pos) { +static void SetBit(uint8_t* buf, size_t size, size_t bit_pos) { size_t byte_pos = bit_pos / 8; bit_pos -= byte_pos * 8; DCHECK_LT(byte_pos, size); @@ -16,10 +16,10 @@ static void SetBit(uint8* buf, size_t size, size_t bit_pos) { } TEST(BitReaderTest, NormalOperationTest) { - uint8 value8; - uint64 value64; + uint8_t value8; + uint64_t value64; // 0101 0101 1001 1001 repeats 4 times - uint8 buffer[] = {0x55, 0x99, 0x55, 0x99, 0x55, 0x99, 0x55, 0x99}; + uint8_t buffer[] = {0x55, 0x99, 0x55, 0x99, 0x55, 0x99, 0x55, 0x99}; BitReader reader1(buffer, 6); // Initialize with 6 bytes only EXPECT_TRUE(reader1.ReadBits(1, &value8)); @@ -42,8 +42,8 @@ TEST(BitReaderTest, NormalOperationTest) { } TEST(BitReaderTest, ReadBeyondEndTest) { - uint8 value8; - uint8 buffer[] = {0x12}; + uint8_t value8; + uint8_t buffer[] = {0x12}; BitReader reader1(buffer, sizeof(buffer)); EXPECT_TRUE(reader1.ReadBits(4, &value8)); @@ -53,8 +53,8 @@ TEST(BitReaderTest, ReadBeyondEndTest) { } TEST(BitReaderTest, SkipBitsTest) { - uint8 value8; - uint8 buffer[] = { 0x0a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + uint8_t value8; + uint8_t buffer[] = {0x0a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; BitReader reader1(buffer, sizeof(buffer)); EXPECT_TRUE(reader1.SkipBits(2)); @@ -72,7 +72,7 @@ TEST(BitReaderTest, SkipBitsTest) { } TEST(BitReaderTest, VariableSkipBitsTest) { - uint8 buffer[256] = {0}; + uint8_t buffer[256] = {0}; // The test alternates between ReadBits and SkipBits. // The first number is the number of bits to read, the second one is the @@ -120,7 +120,7 @@ TEST(BitReaderTest, VariableSkipBitsTest) { TEST(BitReaderTest, BitsReadTest) { int value; bool flag; - uint8 buffer[] = { 0x0a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + uint8_t buffer[] = {0x0a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; BitReader reader1(buffer, sizeof(buffer)); EXPECT_EQ(reader1.bits_available(), 120); diff --git a/media/base/bitstream_buffer.cc b/media/base/bitstream_buffer.cc index 5491bcb..49caf5b 100644 --- a/media/base/bitstream_buffer.cc +++ b/media/base/bitstream_buffer.cc @@ -6,7 +6,7 @@ namespace media { -BitstreamBuffer::BitstreamBuffer(int32 id, +BitstreamBuffer::BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size) : id_(id), @@ -14,7 +14,7 @@ BitstreamBuffer::BitstreamBuffer(int32 id, size_(size), presentation_timestamp_(kNoTimestamp()) {} -BitstreamBuffer::BitstreamBuffer(int32 id, +BitstreamBuffer::BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size, base::TimeDelta presentation_timestamp) diff --git a/media/base/bitstream_buffer.h b/media/base/bitstream_buffer.h index 6ff1c05..c3a4a0b 100644 --- a/media/base/bitstream_buffer.h +++ b/media/base/bitstream_buffer.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_BITSTREAM_BUFFER_H_ #define MEDIA_BASE_BITSTREAM_BUFFER_H_ -#include "base/basictypes.h" #include "base/memory/shared_memory.h" #include "base/time/time.h" #include "media/base/decrypt_config.h" @@ -18,9 +17,9 @@ namespace media { // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. class MEDIA_EXPORT BitstreamBuffer { public: - BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size); + BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size); - BitstreamBuffer(int32 id, + BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size, base::TimeDelta presentation_timestamp); @@ -29,7 +28,7 @@ class MEDIA_EXPORT BitstreamBuffer { void SetDecryptConfig(const DecryptConfig& decrypt_config); - int32 id() const { return id_; } + int32_t id() const { return id_; } base::SharedMemoryHandle handle() const { return handle_; } size_t size() const { return size_; } @@ -45,7 +44,7 @@ class MEDIA_EXPORT BitstreamBuffer { const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } private: - int32 id_; + int32_t id_; base::SharedMemoryHandle handle_; size_t size_; diff --git a/media/base/byte_queue.cc b/media/base/byte_queue.cc index 534b552..263f82a 100644 --- a/media/base/byte_queue.cc +++ b/media/base/byte_queue.cc @@ -12,11 +12,10 @@ namespace media { enum { kDefaultQueueSize = 1024 }; ByteQueue::ByteQueue() - : buffer_(new uint8[kDefaultQueueSize]), + : buffer_(new uint8_t[kDefaultQueueSize]), size_(kDefaultQueueSize), offset_(0), - used_(0) { -} + used_(0) {} ByteQueue::~ByteQueue() {} @@ -25,7 +24,7 @@ void ByteQueue::Reset() { used_ = 0; } -void ByteQueue::Push(const uint8* data, int size) { +void ByteQueue::Push(const uint8_t* data, int size) { DCHECK(data); DCHECK_GT(size, 0); @@ -40,7 +39,7 @@ void ByteQueue::Push(const uint8* data, int size) { // Sanity check to make sure we didn't overflow. CHECK_GT(new_size, size_); - scoped_ptr<uint8[]> new_buffer(new uint8[new_size]); + scoped_ptr<uint8_t[]> new_buffer(new uint8_t[new_size]); // Copy the data from the old buffer to the start of the new one. if (used_ > 0) @@ -59,7 +58,7 @@ void ByteQueue::Push(const uint8* data, int size) { used_ += size; } -void ByteQueue::Peek(const uint8** data, int* size) const { +void ByteQueue::Peek(const uint8_t** data, int* size) const { DCHECK(data); DCHECK(size); *data = front(); @@ -79,6 +78,8 @@ void ByteQueue::Pop(int count) { } } -uint8* ByteQueue::front() const { return buffer_.get() + offset_; } +uint8_t* ByteQueue::front() const { + return buffer_.get() + offset_; +} } // namespace media diff --git a/media/base/byte_queue.h b/media/base/byte_queue.h index f25328d..1533adb 100644 --- a/media/base/byte_queue.h +++ b/media/base/byte_queue.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_BYTE_QUEUE_H_ #define MEDIA_BASE_BYTE_QUEUE_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" @@ -25,21 +24,21 @@ class MEDIA_EXPORT ByteQueue { void Reset(); // Appends new bytes onto the end of the queue. - void Push(const uint8* data, int size); + void Push(const uint8_t* data, int size); // Get a pointer to the front of the queue and the queue size. // These values are only valid until the next Push() or // Pop() call. - void Peek(const uint8** data, int* size) const; + void Peek(const uint8_t** data, int* size) const; // Remove |count| bytes from the front of the queue. void Pop(int count); private: // Returns a pointer to the front of the queue. - uint8* front() const; + uint8_t* front() const; - scoped_ptr<uint8[]> buffer_; + scoped_ptr<uint8_t[]> buffer_; // Size of |buffer_|. size_t size_; diff --git a/media/base/cdm_callback_promise.cc b/media/base/cdm_callback_promise.cc index a198f45..496ad1a 100644 --- a/media/base/cdm_callback_promise.cc +++ b/media/base/cdm_callback_promise.cc @@ -29,7 +29,7 @@ void CdmCallbackPromise<T...>::resolve(const T&... result) { template <typename... T> void CdmCallbackPromise<T...>::reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { MarkPromiseSettled(); reject_cb_.Run(exception_code, system_code, error_message); diff --git a/media/base/cdm_callback_promise.h b/media/base/cdm_callback_promise.h index 8685c17..e4b5849 100644 --- a/media/base/cdm_callback_promise.h +++ b/media/base/cdm_callback_promise.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/callback.h" #include "media/base/cdm_promise.h" #include "media/base/media_export.h" @@ -16,7 +15,7 @@ namespace media { typedef base::Callback<void(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message)> PromiseRejectedCB; @@ -30,7 +29,7 @@ class MEDIA_EXPORT CdmCallbackPromise : public CdmPromiseTemplate<T...> { // CdmPromiseTemplate<T> implementation. virtual void resolve(const T&... result) override; virtual void reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) override; private: diff --git a/media/base/cdm_initialized_promise.cc b/media/base/cdm_initialized_promise.cc index d15d514e..0b7dbb0 100644 --- a/media/base/cdm_initialized_promise.cc +++ b/media/base/cdm_initialized_promise.cc @@ -20,7 +20,7 @@ void CdmInitializedPromise::resolve() { } void CdmInitializedPromise::reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { MarkPromiseSettled(); cdm_created_cb_.Run(nullptr, error_message); diff --git a/media/base/cdm_initialized_promise.h b/media/base/cdm_initialized_promise.h index f0ca012..567fb92 100644 --- a/media/base/cdm_initialized_promise.h +++ b/media/base/cdm_initialized_promise.h @@ -25,7 +25,7 @@ class MEDIA_EXPORT CdmInitializedPromise : public SimpleCdmPromise { // SimpleCdmPromise implementation. void resolve() override; void reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) override; private: diff --git a/media/base/cdm_key_information.cc b/media/base/cdm_key_information.cc index e6c4e01..70d4464 100644 --- a/media/base/cdm_key_information.cc +++ b/media/base/cdm_key_information.cc @@ -11,23 +11,23 @@ CdmKeyInformation::CdmKeyInformation() : status(INTERNAL_ERROR), system_code(0) { } -CdmKeyInformation::CdmKeyInformation(const std::vector<uint8>& key_id, +CdmKeyInformation::CdmKeyInformation(const std::vector<uint8_t>& key_id, KeyStatus status, - uint32 system_code) + uint32_t system_code) : key_id(key_id), status(status), system_code(system_code) {} CdmKeyInformation::CdmKeyInformation(const std::string& key_id, KeyStatus status, - uint32 system_code) - : CdmKeyInformation(reinterpret_cast<const uint8*>(key_id.data()), + uint32_t system_code) + : CdmKeyInformation(reinterpret_cast<const uint8_t*>(key_id.data()), key_id.size(), status, system_code) {} -CdmKeyInformation::CdmKeyInformation(const uint8* key_id_data, +CdmKeyInformation::CdmKeyInformation(const uint8_t* key_id_data, size_t key_id_length, KeyStatus status, - uint32 system_code) + uint32_t system_code) : key_id(key_id_data, key_id_data + key_id_length), status(status), system_code(system_code) {} diff --git a/media/base/cdm_key_information.h b/media/base/cdm_key_information.h index a93cf5c..108786d 100644 --- a/media/base/cdm_key_information.h +++ b/media/base/cdm_key_information.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" namespace media { @@ -28,21 +27,21 @@ struct MEDIA_EXPORT CdmKeyInformation { // Default constructor needed for passing this type through IPC. Regular // code should use one of the other constructors. CdmKeyInformation(); - CdmKeyInformation(const std::vector<uint8>& key_id, + CdmKeyInformation(const std::vector<uint8_t>& key_id, KeyStatus status, - uint32 system_code); + uint32_t system_code); CdmKeyInformation(const std::string& key_id, KeyStatus status, - uint32 system_code); - CdmKeyInformation(const uint8* key_id_data, + uint32_t system_code); + CdmKeyInformation(const uint8_t* key_id_data, size_t key_id_length, KeyStatus status, - uint32 system_code); + uint32_t system_code); ~CdmKeyInformation(); - std::vector<uint8> key_id; + std::vector<uint8_t> key_id; KeyStatus status; - uint32 system_code; + uint32_t system_code; }; } // namespace media diff --git a/media/base/cdm_promise.h b/media/base/cdm_promise.h index c0563bc..fa15cb9 100644 --- a/media/base/cdm_promise.h +++ b/media/base/cdm_promise.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/logging.h" #include "media/base/media_export.h" #include "media/base/media_keys.h" @@ -45,7 +44,7 @@ class MEDIA_EXPORT CdmPromise { // that occurred, or 0 if there is no associated status code or such status // codes are not supported by the Key System. |error_message| is optional. virtual void reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) = 0; // Used to determine the template type of CdmPromiseTemplate<T> so that @@ -89,7 +88,7 @@ class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise { // CdmPromise implementation. virtual void reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) = 0; ResolveParameterType GetResolveParameterType() const override { diff --git a/media/base/cdm_promise_adapter.cc b/media/base/cdm_promise_adapter.cc index aed2830..3fd2498 100644 --- a/media/base/cdm_promise_adapter.cc +++ b/media/base/cdm_promise_adapter.cc @@ -46,7 +46,7 @@ void CdmPromiseAdapter::ResolvePromise(uint32_t promise_id, void CdmPromiseAdapter::RejectPromise(uint32_t promise_id, MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { scoped_ptr<CdmPromise> promise = TakePromise(promise_id); if (!promise) { diff --git a/media/base/cdm_promise_adapter.h b/media/base/cdm_promise_adapter.h index b6d5a89..0e7006d 100644 --- a/media/base/cdm_promise_adapter.h +++ b/media/base/cdm_promise_adapter.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ #define MEDIA_BASE_CDM_PROMISE_ADAPTER_H_ -#include "base/basictypes.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -35,7 +34,7 @@ class MEDIA_EXPORT CdmPromiseAdapter { // |system_code| and |error_message|. void RejectPromise(uint32_t promise_id, MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message); // Rejects and clears all |promises_|. diff --git a/media/base/channel_layout.cc b/media/base/channel_layout.cc index 12a6015..237c414 100644 --- a/media/base/channel_layout.cc +++ b/media/base/channel_layout.cc @@ -4,7 +4,6 @@ #include "media/base/channel_layout.h" -#include "base/basictypes.h" #include "base/logging.h" namespace media { diff --git a/media/base/container_names.cc b/media/base/container_names.cc index 48523d1..1573e86 100644 --- a/media/base/container_names.cc +++ b/media/base/container_names.cc @@ -14,11 +14,11 @@ namespace media { namespace container_names { -#define TAG(a, b, c, d) \ - ((static_cast<uint32>(static_cast<uint8>(a)) << 24) | \ - (static_cast<uint32>(static_cast<uint8>(b)) << 16) | \ - (static_cast<uint32>(static_cast<uint8>(c)) << 8) | \ - (static_cast<uint32>(static_cast<uint8>(d)))) +#define TAG(a, b, c, d) \ + ((static_cast<uint32_t>(static_cast<uint8_t>(a)) << 24) | \ + (static_cast<uint32_t>(static_cast<uint8_t>(b)) << 16) | \ + (static_cast<uint32_t>(static_cast<uint8_t>(c)) << 8) | \ + (static_cast<uint32_t>(static_cast<uint8_t>(d)))) #define RCHECK(x) \ do { \ @@ -29,28 +29,28 @@ namespace container_names { #define UTF8_BYTE_ORDER_MARK "\xef\xbb\xbf" // Helper function to read 2 bytes (16 bits, big endian) from a buffer. -static int Read16(const uint8* p) { +static int Read16(const uint8_t* p) { return p[0] << 8 | p[1]; } // Helper function to read 3 bytes (24 bits, big endian) from a buffer. -static uint32 Read24(const uint8* p) { +static uint32_t Read24(const uint8_t* p) { return p[0] << 16 | p[1] << 8 | p[2]; } // Helper function to read 4 bytes (32 bits, big endian) from a buffer. -static uint32 Read32(const uint8* p) { +static uint32_t Read32(const uint8_t* p) { return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; } // Helper function to read 4 bytes (32 bits, little endian) from a buffer. -static uint32 Read32LE(const uint8* p) { +static uint32_t Read32LE(const uint8_t* p) { return p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0]; } // Helper function to do buffer comparisons with a string without going off the // end of the buffer. -static bool StartsWith(const uint8* buffer, +static bool StartsWith(const uint8_t* buffer, size_t buffer_size, const char* prefix) { size_t prefix_size = strlen(prefix); @@ -60,19 +60,19 @@ static bool StartsWith(const uint8* buffer, // Helper function to do buffer comparisons with another buffer (to allow for // embedded \0 in the comparison) without going off the end of the buffer. -static bool StartsWith(const uint8* buffer, +static bool StartsWith(const uint8_t* buffer, size_t buffer_size, - const uint8* prefix, + const uint8_t* prefix, size_t prefix_size) { return (prefix_size <= buffer_size && memcmp(buffer, prefix, prefix_size) == 0); } // Helper function to read up to 64 bits from a bit stream. -static uint64 ReadBits(BitReader* reader, int num_bits) { +static uint64_t ReadBits(BitReader* reader, int num_bits) { DCHECK_GE(reader->bits_available(), num_bits); DCHECK((num_bits > 0) && (num_bits <= 64)); - uint64 value; + uint64_t value; reader->ReadBits(num_bits, &value); return value; } @@ -92,7 +92,7 @@ const int kAc3FrameSizeTable[38][3] = { }; // Checks for an ADTS AAC container. -static bool CheckAac(const uint8* buffer, int buffer_size) { +static bool CheckAac(const uint8_t* buffer, int buffer_size) { // Audio Data Transport Stream (ADTS) header is 7 or 9 bytes // (from http://wiki.multimedia.cx/index.php?title=ADTS) RCHECK(buffer_size > 6); @@ -128,10 +128,10 @@ static bool CheckAac(const uint8* buffer, int buffer_size) { return true; } -const uint16 kAc3SyncWord = 0x0b77; +const uint16_t kAc3SyncWord = 0x0b77; // Checks for an AC3 container. -static bool CheckAc3(const uint8* buffer, int buffer_size) { +static bool CheckAc3(const uint8_t* buffer, int buffer_size) { // Reference: ATSC Standard: Digital Audio Compression (AC-3, E-AC-3) // Doc. A/52:2012 // (http://www.atsc.org/cms/standards/A52-2012(12-17).pdf) @@ -166,7 +166,7 @@ static bool CheckAc3(const uint8* buffer, int buffer_size) { } // Checks for an EAC3 container (very similar to AC3) -static bool CheckEac3(const uint8* buffer, int buffer_size) { +static bool CheckEac3(const uint8_t* buffer, int buffer_size) { // Reference: ATSC Standard: Digital Audio Compression (AC-3, E-AC-3) // Doc. A/52:2012 // (http://www.atsc.org/cms/standards/A52-2012(12-17).pdf) @@ -204,7 +204,7 @@ static bool CheckEac3(const uint8* buffer, int buffer_size) { } // Additional checks for a BINK container. -static bool CheckBink(const uint8* buffer, int buffer_size) { +static bool CheckBink(const uint8_t* buffer, int buffer_size) { // Reference: http://wiki.multimedia.cx/index.php?title=Bink_Container RCHECK(buffer_size >= 44); @@ -230,7 +230,7 @@ static bool CheckBink(const uint8* buffer, int buffer_size) { } // Additional checks for a CAF container. -static bool CheckCaf(const uint8* buffer, int buffer_size) { +static bool CheckCaf(const uint8_t* buffer, int buffer_size) { // Reference: Apple Core Audio Format Specification 1.0 // (https://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html) RCHECK(buffer_size >= 52); @@ -271,7 +271,7 @@ static bool kExtAudioIdValid[8] = { true, false, true, false, false, false, true, false }; // Additional checks for a DTS container. -static bool CheckDts(const uint8* buffer, int buffer_size) { +static bool CheckDts(const uint8_t* buffer, int buffer_size) { // Reference: ETSI TS 102 114 V1.3.1 (2011-08) // (http://www.etsi.org/deliver/etsi_ts/102100_102199/102114/01.03.01_60/ts_102114v010301p.pdf) RCHECK(buffer_size > 11); @@ -326,7 +326,7 @@ static bool CheckDts(const uint8* buffer, int buffer_size) { } // Checks for a DV container. -static bool CheckDV(const uint8* buffer, int buffer_size) { +static bool CheckDV(const uint8_t* buffer, int buffer_size) { // Reference: SMPTE 314M (Annex A has differences with IEC 61834). // (http://standards.smpte.org/content/978-1-61482-454-1/st-314-2005/SEC1.body.pdf) RCHECK(buffer_size > 11); @@ -389,7 +389,7 @@ static bool CheckDV(const uint8* buffer, int buffer_size) { // Checks for a GSM container. -static bool CheckGsm(const uint8* buffer, int buffer_size) { +static bool CheckGsm(const uint8_t* buffer, int buffer_size) { // Reference: ETSI EN 300 961 V8.1.1 // (http://www.etsi.org/deliver/etsi_en/300900_300999/300961/08.01.01_60/en_300961v080101p.pdf) // also http://tools.ietf.org/html/rfc3551#page-24 @@ -410,20 +410,20 @@ static bool CheckGsm(const uint8* buffer, int buffer_size) { // number of bytes that must remain in the buffer when |start_code| is found. // Returns true if start_code found (and enough space in the buffer after it), // false otherwise. -static bool AdvanceToStartCode(const uint8* buffer, +static bool AdvanceToStartCode(const uint8_t* buffer, int buffer_size, int* offset, int bytes_needed, int num_bits, - uint32 start_code) { + uint32_t start_code) { DCHECK_GE(bytes_needed, 3); DCHECK_LE(num_bits, 24); // Only supports up to 24 bits. // Create a mask to isolate |num_bits| bits, once shifted over. - uint32 bits_to_shift = 24 - num_bits; - uint32 mask = (1 << num_bits) - 1; + uint32_t bits_to_shift = 24 - num_bits; + uint32_t mask = (1 << num_bits) - 1; while (*offset + bytes_needed < buffer_size) { - uint32 next = Read24(buffer + *offset); + uint32_t next = Read24(buffer + *offset); if (((next >> bits_to_shift) & mask) == start_code) return true; ++(*offset); @@ -432,7 +432,7 @@ static bool AdvanceToStartCode(const uint8* buffer, } // Checks for an H.261 container. -static bool CheckH261(const uint8* buffer, int buffer_size) { +static bool CheckH261(const uint8_t* buffer, int buffer_size) { // Reference: ITU-T Recommendation H.261 (03/1993) // (http://www.itu.int/rec/T-REC-H.261-199303-I/en) RCHECK(buffer_size > 16); @@ -480,7 +480,7 @@ static bool CheckH261(const uint8* buffer, int buffer_size) { } // Checks for an H.263 container. -static bool CheckH263(const uint8* buffer, int buffer_size) { +static bool CheckH263(const uint8_t* buffer, int buffer_size) { // Reference: ITU-T Recommendation H.263 (01/2005) // (http://www.itu.int/rec/T-REC-H.263-200501-I/en) // header is PSC(22b) + TR(8b) + PTYPE(8+b). @@ -548,7 +548,7 @@ static bool CheckH263(const uint8* buffer, int buffer_size) { } // Checks for an H.264 container. -static bool CheckH264(const uint8* buffer, int buffer_size) { +static bool CheckH264(const uint8_t* buffer, int buffer_size) { // Reference: ITU-T Recommendation H.264 (01/2012) // (http://www.itu.int/rec/T-REC-H.264) // Section B.1: Byte stream NAL unit syntax and semantics. @@ -604,7 +604,7 @@ static const char kHls2[] = "#EXT-X-TARGETDURATION:"; static const char kHls3[] = "#EXT-X-MEDIA-SEQUENCE:"; // Additional checks for a HLS container. -static bool CheckHls(const uint8* buffer, int buffer_size) { +static bool CheckHls(const uint8_t* buffer, int buffer_size) { // HLS is simply a play list used for Apple HTTP Live Streaming. // Reference: Apple HTTP Live Streaming Overview // (http://goo.gl/MIwxj) @@ -630,7 +630,7 @@ static bool CheckHls(const uint8* buffer, int buffer_size) { } // Checks for a MJPEG stream. -static bool CheckMJpeg(const uint8* buffer, int buffer_size) { +static bool CheckMJpeg(const uint8_t* buffer, int buffer_size) { // Reference: ISO/IEC 10918-1 : 1993(E), Annex B // (http://www.w3.org/Graphics/JPEG/itu-t81.pdf) RCHECK(buffer_size >= 16); @@ -641,7 +641,7 @@ static bool CheckMJpeg(const uint8* buffer, int buffer_size) { while (offset + 5 < buffer_size) { // Marker codes are always a two byte code with the first byte xFF. RCHECK(buffer[offset] == 0xff); - uint8 code = buffer[offset + 1]; + uint8_t code = buffer[offset + 1]; RCHECK(code >= 0xc0 || code == 1); // Skip sequences of xFF. @@ -699,7 +699,7 @@ enum Mpeg2StartCodes { }; // Checks for a MPEG2 Program Stream. -static bool CheckMpeg2ProgramStream(const uint8* buffer, int buffer_size) { +static bool CheckMpeg2ProgramStream(const uint8_t* buffer, int buffer_size) { // Reference: ISO/IEC 13818-1 : 2000 (E) / ITU-T Rec. H.222.0 (2000 E). RCHECK(buffer_size > 14); @@ -794,10 +794,10 @@ static bool CheckMpeg2ProgramStream(const uint8* buffer, int buffer_size) { return true; } -const uint8 kMpeg2SyncWord = 0x47; +const uint8_t kMpeg2SyncWord = 0x47; // Checks for a MPEG2 Transport Stream. -static bool CheckMpeg2TransportStream(const uint8* buffer, int buffer_size) { +static bool CheckMpeg2TransportStream(const uint8_t* buffer, int buffer_size) { // Spec: ISO/IEC 13818-1 : 2000 (E) / ITU-T Rec. H.222.0 (2000 E). // Normal packet size is 188 bytes. However, some systems add various error // correction data at the end, resulting in packet of length 192/204/208 @@ -870,7 +870,7 @@ enum Mpeg4StartCodes { }; // Checks for a raw MPEG4 bitstream container. -static bool CheckMpeg4BitStream(const uint8* buffer, int buffer_size) { +static bool CheckMpeg4BitStream(const uint8_t* buffer, int buffer_size) { // Defined in ISO/IEC 14496-2:2001. // However, no length ... simply scan for start code values. // Note tags are very similar to H.264. @@ -946,15 +946,15 @@ static bool CheckMpeg4BitStream(const uint8* buffer, int buffer_size) { } // Additional checks for a MOV/QuickTime/MPEG4 container. -static bool CheckMov(const uint8* buffer, int buffer_size) { +static bool CheckMov(const uint8_t* buffer, int buffer_size) { // Reference: ISO/IEC 14496-12:2005(E). // (http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip) RCHECK(buffer_size > 8); int offset = 0; while (offset + 8 < buffer_size) { - uint32 atomsize = Read32(buffer + offset); - uint32 atomtype = Read32(buffer + offset + 4); + uint32_t atomsize = Read32(buffer + offset); + uint32_t atomtype = Read32(buffer + offset + 4); // Only need to check for ones that are valid at the top level. switch (atomtype) { case TAG('f','t','y','p'): @@ -1021,7 +1021,7 @@ static int kBitRateTableV2L1[16] = { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, static int kBitRateTableV2L23[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }; -static bool ValidMpegAudioFrameHeader(const uint8* header, +static bool ValidMpegAudioFrameHeader(const uint8_t* header, int header_size, int* framesize) { // Reference: http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm. @@ -1081,7 +1081,7 @@ static bool ValidMpegAudioFrameHeader(const uint8* header, } // Extract a size encoded the MP3 way. -static int GetMp3HeaderSize(const uint8* buffer, int buffer_size) { +static int GetMp3HeaderSize(const uint8_t* buffer, int buffer_size) { DCHECK_GE(buffer_size, 9); int size = ((buffer[6] & 0x7f) << 21) + ((buffer[7] & 0x7f) << 14) + ((buffer[8] & 0x7f) << 7) + (buffer[9] & 0x7f) + 10; @@ -1091,7 +1091,7 @@ static int GetMp3HeaderSize(const uint8* buffer, int buffer_size) { } // Additional checks for a MP3 container. -static bool CheckMp3(const uint8* buffer, int buffer_size, bool seenHeader) { +static bool CheckMp3(const uint8_t* buffer, int buffer_size, bool seenHeader) { RCHECK(buffer_size >= 10); // Must be enough to read the initial header. int framesize; @@ -1122,7 +1122,7 @@ static bool CheckMp3(const uint8* buffer, int buffer_size, bool seenHeader) { // accepted is optional whitespace followed by 1 or more digits. |max_digits| // specifies the maximum number of digits to process. Returns true if a valid // number is found, false otherwise. -static bool VerifyNumber(const uint8* buffer, +static bool VerifyNumber(const uint8_t* buffer, int buffer_size, int* offset, int max_digits) { @@ -1150,7 +1150,7 @@ static bool VerifyNumber(const uint8* buffer, // Check that the next character in |buffer| is one of |c1| or |c2|. |c2| is // optional. Returns true if there is a match, false if no match or out of // space. -static inline bool VerifyCharacters(const uint8* buffer, +static inline bool VerifyCharacters(const uint8_t* buffer, int buffer_size, int* offset, char c1, @@ -1161,7 +1161,7 @@ static inline bool VerifyCharacters(const uint8* buffer, } // Checks for a SRT container. -static bool CheckSrt(const uint8* buffer, int buffer_size) { +static bool CheckSrt(const uint8_t* buffer, int buffer_size) { // Reference: http://en.wikipedia.org/wiki/SubRip RCHECK(buffer_size > 20); @@ -1222,7 +1222,7 @@ static int GetElementId(BitReader* reader) { } // Read a Matroska Unsigned Integer (VINT). -static uint64 GetVint(BitReader* reader) { +static uint64_t GetVint(BitReader* reader) { // Values are coded with the leading zero bits (max 7) determining size. // If it is an invalid coding or the end of the buffer is reached, // return something that will go off the end of the buffer. @@ -1244,7 +1244,7 @@ static uint64 GetVint(BitReader* reader) { } // Additional checks for a WEBM container. -static bool CheckWebm(const uint8* buffer, int buffer_size) { +static bool CheckWebm(const uint8_t* buffer, int buffer_size) { // Reference: http://www.matroska.org/technical/specs/index.html RCHECK(buffer_size > 12); @@ -1297,7 +1297,7 @@ enum VC1StartCodes { }; // Checks for a VC1 bitstream container. -static bool CheckVC1(const uint8* buffer, int buffer_size) { +static bool CheckVC1(const uint8_t* buffer, int buffer_size) { // Reference: SMPTE 421M // (http://standards.smpte.org/content/978-1-61482-555-5/st-421-2006/SEC1.body.pdf) // However, no length ... simply scan for start code values. @@ -1405,27 +1405,27 @@ static bool CheckVC1(const uint8* buffer, int buffer_size) { // For some formats the signature is a bunch of characters. They are defined // below. Note that the first 4 characters of the string may be used as a TAG // in LookupContainerByFirst4. For signatures that contain embedded \0, use -// uint8[]. +// uint8_t[]. static const char kAmrSignature[] = "#!AMR"; -static const uint8 kAsfSignature[] = { 0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, - 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, - 0xce, 0x6c }; +static const uint8_t kAsfSignature[] = {0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, + 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, + 0x00, 0x62, 0xce, 0x6c}; static const char kAssSignature[] = "[Script Info]"; static const char kAssBomSignature[] = UTF8_BYTE_ORDER_MARK "[Script Info]"; -static const uint8 kWtvSignature[] = { 0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, 0xda, - 0x11, 0xa6, 0x4e, 0x00, 0x07, 0xe9, 0x5e, - 0xad, 0x8d }; +static const uint8_t kWtvSignature[] = {0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, + 0xda, 0x11, 0xa6, 0x4e, 0x00, 0x07, + 0xe9, 0x5e, 0xad, 0x8d}; // Attempt to determine the container type from the buffer provided. This is // a simple pass, that uses the first 4 bytes of the buffer as an index to get // a rough idea of the container format. -static MediaContainerName LookupContainerByFirst4(const uint8* buffer, +static MediaContainerName LookupContainerByFirst4(const uint8_t* buffer, int buffer_size) { // Minimum size that the code expects to exist without checking size. if (buffer_size < 12) return CONTAINER_UNKNOWN; - uint32 first4 = Read32(buffer); + uint32_t first4 = Read32(buffer); switch (first4) { case 0x1a45dfa3: if (CheckWebm(buffer, buffer_size)) @@ -1578,7 +1578,7 @@ static MediaContainerName LookupContainerByFirst4(const uint8* buffer, // Now try a few different ones that look at something other // than the first 4 bytes. - uint32 first3 = first4 & 0xffffff00; + uint32_t first3 = first4 & 0xffffff00; switch (first3) { case TAG('C','W','S',0): case TAG('F','W','S',0): @@ -1591,7 +1591,7 @@ static MediaContainerName LookupContainerByFirst4(const uint8* buffer, } // Maybe the first 2 characters are something we can use. - uint32 first2 = Read16(buffer); + uint32_t first2 = Read16(buffer); switch (first2) { case kAc3SyncWord: if (CheckAc3(buffer, buffer_size)) @@ -1617,7 +1617,7 @@ static MediaContainerName LookupContainerByFirst4(const uint8* buffer, } // Attempt to determine the container name from the buffer provided. -MediaContainerName DetermineContainer(const uint8* buffer, int buffer_size) { +MediaContainerName DetermineContainer(const uint8_t* buffer, int buffer_size) { DCHECK(buffer); // Since MOV/QuickTime/MPEG4 streams are common, check for them first. diff --git a/media/base/container_names.h b/media/base/container_names.h index af1214f..e3885ae 100644 --- a/media/base/container_names.h +++ b/media/base/container_names.h @@ -5,7 +5,8 @@ #ifndef MEDIA_BASE_CONTAINER_NAMES_H_ #define MEDIA_BASE_CONTAINER_NAMES_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/base/media_export.h" namespace media { @@ -62,7 +63,7 @@ enum MediaContainerName { }; // Determine the container type. -MEDIA_EXPORT MediaContainerName DetermineContainer(const uint8* buffer, +MEDIA_EXPORT MediaContainerName DetermineContainer(const uint8_t* buffer, int buffer_size); } // namespace container_names diff --git a/media/base/container_names_unittest.cc b/media/base/container_names_unittest.cc index f49327e..d758bf1 100644 --- a/media/base/container_names_unittest.cc +++ b/media/base/container_names_unittest.cc @@ -14,10 +14,9 @@ namespace container_names { // Using a macros to simplify tests. Since EXPECT_EQ outputs the second argument // as a string when it fails, this lets the output identify what item actually // failed. -#define VERIFY(buffer, name) \ - EXPECT_EQ(name, \ - DetermineContainer(reinterpret_cast<const uint8*>(buffer), \ - sizeof(buffer))) +#define VERIFY(buffer, name) \ + EXPECT_EQ(name, DetermineContainer(reinterpret_cast<const uint8_t*>(buffer), \ + sizeof(buffer))) // Test that small buffers are handled correctly. TEST(ContainerNamesTest, CheckSmallBuffer) { @@ -57,30 +56,30 @@ TEST(ContainerNamesTest, CheckSmallBuffer) { // Note that the comparisons need at least 12 bytes, so make sure the buffer is // at least that size. const char kAmrBuffer[12] = "#!AMR"; -uint8 kAsfBuffer[] = { 0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, 0xa6, - 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }; +uint8_t kAsfBuffer[] = {0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, + 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}; const char kAss1Buffer[] = "[Script Info]"; const char kAss2Buffer[] = BYTE_ORDER_MARK "[Script Info]"; -uint8 kCafBuffer[] = { 'c', 'a', 'f', 'f', 0, 1, 0, 0, 'd', 'e', 's', 'c', 0, 0, - 0, 0, 0, 0, 0, 32, 64, 229, 136, 128, 0, 0, 0, 0, 'a', - 'a', 'c', ' ', 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 0, 2, 0, 0, 0, 0 }; +uint8_t kCafBuffer[] = { + 'c', 'a', 'f', 'f', 0, 1, 0, 0, 'd', 'e', 's', 'c', 0, 0, 0, 0, 0, 0, 0, + 32, 64, 229, 136, 128, 0, 0, 0, 0, 'a', 'a', 'c', ' ', 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 4, 0, 0, 0, 0, 2, 0, 0, 0, 0}; const char kDtshdBuffer[12] = "DTSHDHDR"; const char kDxaBuffer[16] = "DEXA"; const char kFlacBuffer[12] = "fLaC"; -uint8 kFlvBuffer[12] = { 'F', 'L', 'V', 0, 0, 0, 0, 1, 0, 0, 0, 0 }; -uint8 kIrcamBuffer[] = { 0x64, 0xa3, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; +uint8_t kFlvBuffer[12] = {'F', 'L', 'V', 0, 0, 0, 0, 1, 0, 0, 0, 0}; +uint8_t kIrcamBuffer[] = {0x64, 0xa3, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1}; const char kRm1Buffer[12] = ".RMF\0\0"; const char kRm2Buffer[12] = ".ra\xfd"; -uint8 kWtvBuffer[] = { 0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, 0xda, 0x11, 0xa6, - 0x4e, 0x00, 0x07, 0xe9, 0x5e, 0xad, 0x8d }; -uint8 kBug263073Buffer[] = { - 0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x6d, 0x70, 0x34, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x69, 0x73, 0x6f, 0x6d, 0x6d, 0x70, 0x34, 0x32, - 0x00, 0x00, 0x00, 0x01, 0x6d, 0x64, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, - 0xaa, 0x2e, 0x22, 0xcf, 0x00, 0x00, 0x00, 0x37, 0x67, 0x64, 0x00, 0x28, - 0xac, 0x2c, 0xa4, 0x01, 0xe0, 0x08, 0x9f, 0x97, 0x01, 0x52, 0x02, 0x02, - 0x02, 0x80, 0x00, 0x01}; +uint8_t kWtvBuffer[] = {0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, 0xda, 0x11, + 0xa6, 0x4e, 0x00, 0x07, 0xe9, 0x5e, 0xad, 0x8d}; +uint8_t kBug263073Buffer[] = { + 0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x6d, 0x70, 0x34, + 0x32, 0x00, 0x00, 0x00, 0x00, 0x69, 0x73, 0x6f, 0x6d, 0x6d, 0x70, + 0x34, 0x32, 0x00, 0x00, 0x00, 0x01, 0x6d, 0x64, 0x61, 0x74, 0x00, + 0x00, 0x00, 0x00, 0xaa, 0x2e, 0x22, 0xcf, 0x00, 0x00, 0x00, 0x37, + 0x67, 0x64, 0x00, 0x28, 0xac, 0x2c, 0xa4, 0x01, 0xe0, 0x08, 0x9f, + 0x97, 0x01, 0x52, 0x02, 0x02, 0x02, 0x80, 0x00, 0x01}; // Test that containers that start with fixed strings are handled correctly. // This is to verify that the TAG matches the first 4 characters of the string. @@ -108,14 +107,14 @@ void TestFile(MediaContainerName expected, const base::FilePath& filename) { // Windows implementation of ReadFile fails if file smaller than desired size, // so use file length if file less than 8192 bytes (http://crbug.com/243885). int read_size = sizeof(buffer); - int64 actual_size; + int64_t actual_size; if (base::GetFileSize(filename, &actual_size) && actual_size < read_size) read_size = actual_size; int read = base::ReadFile(filename, buffer, read_size); // Now verify the type. EXPECT_EQ(expected, - DetermineContainer(reinterpret_cast<const uint8*>(buffer), read)) + DetermineContainer(reinterpret_cast<const uint8_t*>(buffer), read)) << "Failure with file " << filename.value(); } diff --git a/media/base/data_buffer.cc b/media/base/data_buffer.cc index 9d6afaf..3879969 100644 --- a/media/base/data_buffer.cc +++ b/media/base/data_buffer.cc @@ -4,41 +4,37 @@ #include "media/base/data_buffer.h" - namespace media { DataBuffer::DataBuffer(int buffer_size) : buffer_size_(buffer_size), data_size_(0) { CHECK_GE(buffer_size, 0); - data_.reset(new uint8[buffer_size_]); + data_.reset(new uint8_t[buffer_size_]); } -DataBuffer::DataBuffer(scoped_ptr<uint8[]> buffer, int buffer_size) - : data_(buffer.Pass()), - buffer_size_(buffer_size), - data_size_(buffer_size) { +DataBuffer::DataBuffer(scoped_ptr<uint8_t[]> buffer, int buffer_size) + : data_(buffer.Pass()), buffer_size_(buffer_size), data_size_(buffer_size) { CHECK(data_.get()); CHECK_GE(buffer_size, 0); } -DataBuffer::DataBuffer(const uint8* data, int data_size) - : buffer_size_(data_size), - data_size_(data_size) { +DataBuffer::DataBuffer(const uint8_t* data, int data_size) + : buffer_size_(data_size), data_size_(data_size) { if (!data) { CHECK_EQ(data_size, 0); return; } CHECK_GE(data_size, 0); - data_.reset(new uint8[buffer_size_]); + data_.reset(new uint8_t[buffer_size_]); memcpy(data_.get(), data, data_size_); } DataBuffer::~DataBuffer() {} // static -scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8* data, int size) { +scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8_t* data, int size) { // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. CHECK(data); return make_scoped_refptr(new DataBuffer(data, size)); diff --git a/media/base/data_buffer.h b/media/base/data_buffer.h index 2e88faf..bb81921 100644 --- a/media/base/data_buffer.h +++ b/media/base/data_buffer.h @@ -17,7 +17,7 @@ namespace media { // as necessary. // // Unlike DecoderBuffer, allocations are assumed to be allocated with the -// default memory allocator (i.e., new uint8[]). +// default memory allocator (i.e., new uint8_t[]). // // NOTE: It is illegal to call any method when end_of_stream() is true. class MEDIA_EXPORT DataBuffer : public base::RefCountedThreadSafe<DataBuffer> { @@ -26,12 +26,12 @@ class MEDIA_EXPORT DataBuffer : public base::RefCountedThreadSafe<DataBuffer> { explicit DataBuffer(int buffer_size); // Assumes valid data of size |buffer_size|. - DataBuffer(scoped_ptr<uint8[]> buffer, int buffer_size); + DataBuffer(scoped_ptr<uint8_t[]> buffer, int buffer_size); // Create a DataBuffer whose |data_| is copied from |data|. // // |data| must not be null and |size| must be >= 0. - static scoped_refptr<DataBuffer> CopyFrom(const uint8* data, int size); + static scoped_refptr<DataBuffer> CopyFrom(const uint8_t* data, int size); // Create a DataBuffer indicating we've reached end of stream. // @@ -59,12 +59,12 @@ class MEDIA_EXPORT DataBuffer : public base::RefCountedThreadSafe<DataBuffer> { duration_ = duration; } - const uint8* data() const { + const uint8_t* data() const { DCHECK(!end_of_stream()); return data_.get(); } - uint8* writable_data() { + uint8_t* writable_data() { DCHECK(!end_of_stream()); return data_.get(); } @@ -93,7 +93,7 @@ class MEDIA_EXPORT DataBuffer : public base::RefCountedThreadSafe<DataBuffer> { // the allocated buffer and sets data size to |data_size|. // // If |data| is null an end of stream buffer is created. - DataBuffer(const uint8* data, int data_size); + DataBuffer(const uint8_t* data, int data_size); virtual ~DataBuffer(); @@ -101,7 +101,7 @@ class MEDIA_EXPORT DataBuffer : public base::RefCountedThreadSafe<DataBuffer> { base::TimeDelta timestamp_; base::TimeDelta duration_; - scoped_ptr<uint8[]> data_; + scoped_ptr<uint8_t[]> data_; int buffer_size_; int data_size_; diff --git a/media/base/data_buffer_unittest.cc b/media/base/data_buffer_unittest.cc index a97ba7d..55bc496 100644 --- a/media/base/data_buffer_unittest.cc +++ b/media/base/data_buffer_unittest.cc @@ -30,8 +30,8 @@ TEST(DataBufferTest, Constructor_NonZeroSize) { TEST(DataBufferTest, Constructor_ScopedArray) { // Data should be passed and both data and buffer size should be set. const int kSize = 8; - scoped_ptr<uint8[]> data(new uint8[kSize]); - const uint8* kData = data.get(); + scoped_ptr<uint8_t[]> data(new uint8_t[kSize]); + const uint8_t* kData = data.get(); scoped_refptr<DataBuffer> buffer = new DataBuffer(data.Pass(), kSize); EXPECT_TRUE(buffer->data()); @@ -42,7 +42,7 @@ TEST(DataBufferTest, Constructor_ScopedArray) { } TEST(DataBufferTest, CopyFrom) { - const uint8 kTestData[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; + const uint8_t kTestData[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77}; const int kTestDataSize = arraysize(kTestData); scoped_refptr<DataBuffer> buffer = @@ -101,11 +101,11 @@ TEST(DataBufferTest, ReadingWriting) { scoped_refptr<DataBuffer> buffer(new DataBuffer(kDataSize)); ASSERT_TRUE(buffer.get()); - uint8* data = buffer->writable_data(); + uint8_t* data = buffer->writable_data(); ASSERT_TRUE(data); memcpy(data, kData, kDataSize); buffer->set_data_size(kDataSize); - const uint8* read_only_data = buffer->data(); + const uint8_t* read_only_data = buffer->data(); ASSERT_EQ(data, read_only_data); ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize)); EXPECT_FALSE(buffer->end_of_stream()); diff --git a/media/base/data_source.h b/media/base/data_source.h index 42566a9..8a63d6b 100644 --- a/media/base/data_source.h +++ b/media/base/data_source.h @@ -13,7 +13,7 @@ namespace media { class MEDIA_EXPORT DataSource { public: - typedef base::Callback<void(int64, int64)> StatusCallback; + typedef base::Callback<void(int64_t, int64_t)> StatusCallback; typedef base::Callback<void(int)> ReadCB; enum { kReadError = -1 }; @@ -24,7 +24,9 @@ class MEDIA_EXPORT DataSource { // Reads |size| bytes from |position| into |data|. And when the read is done // or failed, |read_cb| is called with the number of bytes read or // kReadError in case of error. - virtual void Read(int64 position, int size, uint8* data, + virtual void Read(int64_t position, + int size, + uint8_t* data, const DataSource::ReadCB& read_cb) = 0; // Stops the DataSource. Once this is called all future Read() calls will @@ -33,7 +35,7 @@ class MEDIA_EXPORT DataSource { // Returns true and the file size, false if the file size could not be // retrieved. - virtual bool GetSize(int64* size_out) = 0; + virtual bool GetSize(int64_t* size_out) = 0; // Returns true if we are performing streaming. In this case seeking is // not possible. diff --git a/media/base/decoder_buffer.cc b/media/base/decoder_buffer.cc index ce02937..613e094 100644 --- a/media/base/decoder_buffer.cc +++ b/media/base/decoder_buffer.cc @@ -4,13 +4,12 @@ #include "media/base/decoder_buffer.h" - namespace media { // Allocates a block of memory which is padded for use with the SIMD // optimizations used by FFmpeg. -static uint8* AllocateFFmpegSafeBlock(int size) { - uint8* const block = reinterpret_cast<uint8*>(base::AlignedAlloc( +static uint8_t* AllocateFFmpegSafeBlock(int size) { + uint8_t* const block = reinterpret_cast<uint8_t*>(base::AlignedAlloc( size + DecoderBuffer::kPaddingSize, DecoderBuffer::kAlignmentSize)); memset(block + size, 0, DecoderBuffer::kPaddingSize); return block; @@ -23,13 +22,11 @@ DecoderBuffer::DecoderBuffer(int size) Initialize(); } -DecoderBuffer::DecoderBuffer(const uint8* data, +DecoderBuffer::DecoderBuffer(const uint8_t* data, int size, - const uint8* side_data, + const uint8_t* side_data, int side_data_size) - : size_(size), - side_data_size_(side_data_size), - is_key_frame_(false) { + : size_(size), side_data_size_(side_data_size), is_key_frame_(false) { if (!data) { CHECK_EQ(size_, 0); CHECK(!side_data); @@ -61,7 +58,7 @@ void DecoderBuffer::Initialize() { } // static -scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8* data, +scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8_t* data, int data_size) { // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. CHECK(data); @@ -69,9 +66,9 @@ scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8* data, } // static -scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8* data, +scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8_t* data, int data_size, - const uint8* side_data, + const uint8_t* side_data, int side_data_size) { // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. CHECK(data); @@ -111,7 +108,7 @@ void DecoderBuffer::set_timestamp(base::TimeDelta timestamp) { timestamp_ = timestamp; } -void DecoderBuffer::CopySideDataFrom(const uint8* side_data, +void DecoderBuffer::CopySideDataFrom(const uint8_t* side_data, int side_data_size) { if (side_data_size > 0) { side_data_size_ = side_data_size; diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h index 8503696..3e57f29 100644 --- a/media/base/decoder_buffer.h +++ b/media/base/decoder_buffer.h @@ -48,14 +48,15 @@ class MEDIA_EXPORT DecoderBuffer // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. // The buffer's |is_key_frame_| will default to false. - static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); + static scoped_refptr<DecoderBuffer> CopyFrom(const uint8_t* data, int size); // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_| // is copied from |side_data|. Buffers will be padded and aligned as necessary // Data pointers must not be NULL and sizes must be >= 0. The buffer's // |is_key_frame_| will default to false. - static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size, - const uint8* side_data, + static scoped_refptr<DecoderBuffer> CopyFrom(const uint8_t* data, + int size, + const uint8_t* side_data, int side_data_size); // Create a DecoderBuffer indicating we've reached end of stream. @@ -86,12 +87,12 @@ class MEDIA_EXPORT DecoderBuffer duration_ = duration; } - const uint8* data() const { + const uint8_t* data() const { DCHECK(!end_of_stream()); return data_.get(); } - uint8* writable_data() const { + uint8_t* writable_data() const { DCHECK(!end_of_stream()); return data_.get(); } @@ -102,7 +103,7 @@ class MEDIA_EXPORT DecoderBuffer return size_; } - const uint8* side_data() const { + const uint8_t* side_data() const { DCHECK(!end_of_stream()); return side_data_.get(); } @@ -172,7 +173,7 @@ class MEDIA_EXPORT DecoderBuffer std::string AsHumanReadableString(); // Replaces any existing side data with data copied from |side_data|. - void CopySideDataFrom(const uint8* side_data, int side_data_size); + void CopySideDataFrom(const uint8_t* side_data, int side_data_size); protected: friend class base::RefCountedThreadSafe<DecoderBuffer>; @@ -181,8 +182,10 @@ class MEDIA_EXPORT DecoderBuffer // will be padded and aligned as necessary. If |data| is NULL then |data_| is // set to NULL and |buffer_size_| to 0. |is_key_frame_| will default to // false. - DecoderBuffer(const uint8* data, int size, - const uint8* side_data, int side_data_size); + DecoderBuffer(const uint8_t* data, + int size, + const uint8_t* side_data, + int side_data_size); virtual ~DecoderBuffer(); private: @@ -191,9 +194,9 @@ class MEDIA_EXPORT DecoderBuffer // TODO(servolk): Consider changing size_/side_data_size_ types to size_t. int size_; - scoped_ptr<uint8, base::AlignedFreeDeleter> data_; + scoped_ptr<uint8_t, base::AlignedFreeDeleter> data_; int side_data_size_; - scoped_ptr<uint8, base::AlignedFreeDeleter> side_data_; + scoped_ptr<uint8_t, base::AlignedFreeDeleter> side_data_; scoped_ptr<DecryptConfig> decrypt_config_; DiscardPadding discard_padding_; base::TimeDelta splice_timestamp_; diff --git a/media/base/decoder_buffer_unittest.cc b/media/base/decoder_buffer_unittest.cc index c868a36..f3d8216 100644 --- a/media/base/decoder_buffer_unittest.cc +++ b/media/base/decoder_buffer_unittest.cc @@ -27,11 +27,11 @@ TEST(DecoderBufferTest, CreateEOSBuffer) { } TEST(DecoderBufferTest, CopyFrom) { - const uint8 kData[] = "hello"; + const uint8_t kData[] = "hello"; const int kDataSize = arraysize(kData); scoped_refptr<DecoderBuffer> buffer2(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize)); ASSERT_TRUE(buffer2.get()); EXPECT_NE(kData, buffer2->data()); EXPECT_EQ(buffer2->data_size(), kDataSize); @@ -40,8 +40,8 @@ TEST(DecoderBufferTest, CopyFrom) { EXPECT_FALSE(buffer2->is_key_frame()); scoped_refptr<DecoderBuffer> buffer3(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize, - reinterpret_cast<const uint8*>(&kData), kDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize, + reinterpret_cast<const uint8_t*>(&kData), kDataSize)); ASSERT_TRUE(buffer3.get()); EXPECT_NE(kData, buffer3->data()); EXPECT_EQ(buffer3->data_size(), kDataSize); @@ -55,10 +55,10 @@ TEST(DecoderBufferTest, CopyFrom) { #if !defined(OS_ANDROID) TEST(DecoderBufferTest, PaddingAlignment) { - const uint8 kData[] = "hello"; + const uint8_t kData[] = "hello"; const int kDataSize = arraysize(kData); scoped_refptr<DecoderBuffer> buffer2(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize)); ASSERT_TRUE(buffer2.get()); // Padding data should always be zeroed. @@ -68,7 +68,7 @@ TEST(DecoderBufferTest, PaddingAlignment) { // If the data is padded correctly we should be able to read and write past // the end of the data by DecoderBuffer::kPaddingSize bytes without crashing // or Valgrind/ASAN throwing errors. - const uint8 kFillChar = 0xFF; + const uint8_t kFillChar = 0xFF; memset( buffer2->writable_data() + kDataSize, kFillChar, DecoderBuffer::kPaddingSize); @@ -89,11 +89,11 @@ TEST(DecoderBufferTest, ReadingWriting) { scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(kDataSize)); ASSERT_TRUE(buffer.get()); - uint8* data = buffer->writable_data(); + uint8_t* data = buffer->writable_data(); ASSERT_TRUE(data); ASSERT_EQ(kDataSize, buffer->data_size()); memcpy(data, kData, kDataSize); - const uint8* read_only_data = buffer->data(); + const uint8_t* read_only_data = buffer->data(); ASSERT_EQ(data, read_only_data); ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize)); EXPECT_FALSE(buffer->end_of_stream()); diff --git a/media/base/decrypt_config.h b/media/base/decrypt_config.h index fe50b9f..c9e2373 100644 --- a/media/base/decrypt_config.h +++ b/media/base/decrypt_config.h @@ -9,7 +9,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" @@ -26,10 +25,10 @@ namespace media { // position of the corresponding encrypted byte. struct SubsampleEntry { SubsampleEntry() : clear_bytes(0), cypher_bytes(0) {} - SubsampleEntry(uint32 clear_bytes, uint32 cypher_bytes) + SubsampleEntry(uint32_t clear_bytes, uint32_t cypher_bytes) : clear_bytes(clear_bytes), cypher_bytes(cypher_bytes) {} - uint32 clear_bytes; - uint32 cypher_bytes; + uint32_t clear_bytes; + uint32_t cypher_bytes; }; // Contains all information that a decryptor needs to decrypt a media sample. diff --git a/media/base/decryptor.h b/media/base/decryptor.h index f0d8be8..04435f2 100644 --- a/media/base/decryptor.h +++ b/media/base/decryptor.h @@ -7,7 +7,6 @@ #include <list> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "media/base/audio_buffer.h" diff --git a/media/base/demuxer.h b/media/base/demuxer.h index 1f136a0..5e3fc4a 100644 --- a/media/base/demuxer.h +++ b/media/base/demuxer.h @@ -50,7 +50,7 @@ class MEDIA_EXPORT Demuxer : public DemuxerStreamProvider { // First parameter - The type of initialization data. // Second parameter - The initialization data associated with the stream. typedef base::Callback<void(EmeInitDataType type, - const std::vector<uint8>& init_data)> + const std::vector<uint8_t>& init_data)> EncryptedMediaInitDataCB; Demuxer(); diff --git a/media/base/demuxer_perftest.cc b/media/base/demuxer_perftest.cc index 4f740de..dbdd4f9 100644 --- a/media/base/demuxer_perftest.cc +++ b/media/base/demuxer_perftest.cc @@ -45,7 +45,7 @@ static void QuitLoopWithStatus(base::MessageLoop* message_loop, } static void OnEncryptedMediaInitData(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data) { + const std::vector<uint8_t>& init_data) { VLOG(0) << "File is encrypted."; } diff --git a/media/base/djb2.cc b/media/base/djb2.cc index 8d47ed2..b4b440e 100644 --- a/media/base/djb2.cc +++ b/media/base/djb2.cc @@ -4,9 +4,9 @@ #include "media/base/djb2.h" -uint32 DJB2Hash(const void* buf, size_t len, uint32 seed) { - const uint8* src = reinterpret_cast<const uint8*>(buf); - uint32 hash = seed; +uint32_t DJB2Hash(const void* buf, size_t len, uint32_t seed) { + const uint8_t* src = reinterpret_cast<const uint8_t*>(buf); + uint32_t hash = seed; for (size_t i = 0; i < len; ++i) { hash = hash * 33 + src[i]; } diff --git a/media/base/djb2.h b/media/base/djb2.h index 598f9d1..cb592b7 100644 --- a/media/base/djb2.h +++ b/media/base/djb2.h @@ -5,7 +5,9 @@ #ifndef MEDIA_BASE_DJB2_H_ #define MEDIA_BASE_DJB2_H_ -#include "base/basictypes.h" +#include <stddef.h> +#include <stdint.h> + #include "media/base/media_export.h" // DJB2 is a hash algorithm with excellent distribution and speed @@ -19,15 +21,15 @@ // See Also: // http://www.cse.yorku.ca/~oz/hash.html -static const uint32 kDJB2HashSeed = 5381u; +static const uint32_t kDJB2HashSeed = 5381u; // These functions perform DJB2 hash. The simplest call is DJB2Hash() to // generate the DJB2 hash of the given data: -// uint32 hash = DJB2Hash(data1, length1, kDJB2HashSeed); +// uint32_t hash = DJB2Hash(data1, length1, kDJB2HashSeed); // // You can also compute the DJB2 hash of data incrementally by making multiple // calls to DJB2Hash(): -// uint32 hash_value = kDJB2HashSeed; // Initial seed for DJB2. +// uint32_t hash_value = kDJB2HashSeed; // Initial seed for DJB2. // for (size_t i = 0; i < copy_lines; ++i) { // hash_value = DJB2Hash(source, bytes_per_line, hash_value); // source += source_stride; @@ -35,7 +37,7 @@ static const uint32 kDJB2HashSeed = 5381u; // For the given buffer of data, compute the DJB2 hash of // the data. You can call this any number of times during the computation. -MEDIA_EXPORT uint32 DJB2Hash(const void* buf, size_t len, uint32 seed); +MEDIA_EXPORT uint32_t DJB2Hash(const void* buf, size_t len, uint32_t seed); #endif // MEDIA_BASE_DJB2_H_ diff --git a/media/base/djb2_unittest.cc b/media/base/djb2_unittest.cc index f7898aaf..f95d747 100644 --- a/media/base/djb2_unittest.cc +++ b/media/base/djb2_unittest.cc @@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" -uint8 kTestData[] = { 1, 2, 3 }; +uint8_t kTestData[] = {1, 2, 3}; TEST(DJB2HashTest, HashTest) { EXPECT_EQ(DJB2Hash(NULL, 0, 0u), 0u); diff --git a/media/base/fake_demuxer_stream.cc b/media/base/fake_demuxer_stream.cc index fab0396..e384e09 100644 --- a/media/base/fake_demuxer_stream.cc +++ b/media/base/fake_demuxer_stream.cc @@ -29,11 +29,9 @@ const int kStartWidth = 320; const int kStartHeight = 240; const int kWidthDelta = 4; const int kHeightDelta = 3; -const uint8 kKeyId[] = { 0x00, 0x01, 0x02, 0x03 }; -const uint8 kIv[] = { - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; +const uint8_t kKeyId[] = {0x00, 0x01, 0x02, 0x03}; +const uint8_t kIv[] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; FakeDemuxerStream::FakeDemuxerStream(int num_configs, int num_buffers_in_one_config, diff --git a/media/base/fake_demuxer_stream.h b/media/base/fake_demuxer_stream.h index ddb8a46..ef2af06 100644 --- a/media/base/fake_demuxer_stream.h +++ b/media/base/fake_demuxer_stream.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_FAKE_DEMUXER_STREAM_H_ #define MEDIA_BASE_FAKE_DEMUXER_STREAM_H_ -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/base/audio_decoder_config.h" #include "media/base/demuxer_stream.h" diff --git a/media/base/fake_demuxer_stream_unittest.cc b/media/base/fake_demuxer_stream_unittest.cc index ea5ec78..3ab750f 100644 --- a/media/base/fake_demuxer_stream_unittest.cc +++ b/media/base/fake_demuxer_stream_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" diff --git a/media/base/fake_text_track_stream.cc b/media/base/fake_text_track_stream.cc index 214eec4..a9c6df8 100644 --- a/media/base/fake_text_track_stream.cc +++ b/media/base/fake_text_track_stream.cc @@ -52,15 +52,16 @@ void FakeTextTrackStream::SatisfyPendingRead( const std::string& settings) { DCHECK(!read_cb_.is_null()); - const uint8* const data_buf = reinterpret_cast<const uint8*>(content.data()); + const uint8_t* const data_buf = + reinterpret_cast<const uint8_t*>(content.data()); const int data_len = static_cast<int>(content.size()); - std::vector<uint8> side_data; + std::vector<uint8_t> side_data; MakeSideData(id.begin(), id.end(), settings.begin(), settings.end(), &side_data); - const uint8* const sd_buf = &side_data[0]; + const uint8_t* const sd_buf = &side_data[0]; const int sd_len = static_cast<int>(side_data.size()); scoped_refptr<DecoderBuffer> buffer; diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc index b2f482d..dde35d0 100644 --- a/media/base/key_systems.cc +++ b/media/base/key_systems.cc @@ -4,7 +4,6 @@ #include "media/base/key_systems.h" - #include "base/containers/hash_tables.h" #include "base/lazy_instance.h" #include "base/logging.h" @@ -188,11 +187,10 @@ class KeySystemsImpl : public KeySystems { std::string GetPepperType(const std::string& concrete_key_system) const; #endif - void AddContainerMask(const std::string& container, uint32 mask); - void AddCodecMask( - EmeMediaType media_type, - const std::string& codec, - uint32 mask); + void AddContainerMask(const std::string& container, uint32_t mask); + void AddCodecMask(EmeMediaType media_type, + const std::string& codec, + uint32_t mask); // Implementation of KeySystems interface. bool IsSupportedKeySystem(const std::string& key_system) const override; @@ -636,18 +634,16 @@ std::string KeySystemsImpl::GetPepperType( } #endif -void KeySystemsImpl::AddContainerMask( - const std::string& container, - uint32 mask) { +void KeySystemsImpl::AddContainerMask(const std::string& container, + uint32_t mask) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!container_to_codec_mask_map_.count(container)); container_to_codec_mask_map_[container] = static_cast<EmeCodec>(mask); } -void KeySystemsImpl::AddCodecMask( - EmeMediaType media_type, - const std::string& codec, - uint32 mask) { +void KeySystemsImpl::AddCodecMask(EmeMediaType media_type, + const std::string& codec, + uint32_t mask) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!codec_string_map_.count(codec)); codec_string_map_[codec] = static_cast<EmeCodec>(mask); @@ -925,14 +921,14 @@ std::string GetPepperType(const std::string& concrete_key_system) { // "media" where "UNIT_TEST" is not defined. So we need to specify // "MEDIA_EXPORT" here again so that they are visible to tests. -MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { +MEDIA_EXPORT void AddContainerMask(const std::string& container, + uint32_t mask) { KeySystemsImpl::GetInstance()->AddContainerMask(container, mask); } -MEDIA_EXPORT void AddCodecMask( - EmeMediaType media_type, - const std::string& codec, - uint32 mask) { +MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, + const std::string& codec, + uint32_t mask) { KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); } diff --git a/media/base/key_systems.h b/media/base/key_systems.h index 92a4b63..1c9c4da 100644 --- a/media/base/key_systems.h +++ b/media/base/key_systems.h @@ -117,11 +117,10 @@ MEDIA_EXPORT std::string GetPepperType( #if defined(UNIT_TEST) // Helper functions to add container/codec types for testing purposes. -MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask); -MEDIA_EXPORT void AddCodecMask( - EmeMediaType media_type, - const std::string& codec, - uint32 mask); +MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32_t mask); +MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, + const std::string& codec, + uint32_t mask); #endif // defined(UNIT_TEST) } // namespace media diff --git a/media/base/key_systems_support_uma.cc b/media/base/key_systems_support_uma.cc index 6007026..7ac7a14 100644 --- a/media/base/key_systems_support_uma.cc +++ b/media/base/key_systems_support_uma.cc @@ -4,7 +4,6 @@ #include "media/base/key_systems_support_uma.h" - #include "base/metrics/histogram.h" #include "media/base/key_systems.h" diff --git a/media/base/limits.h b/media/base/limits.h index c3cd677..34f5066 100644 --- a/media/base/limits.h +++ b/media/base/limits.h @@ -7,8 +7,6 @@ #ifndef MEDIA_BASE_LIMITS_H_ #define MEDIA_BASE_LIMITS_H_ -#include "base/basictypes.h" - namespace media { namespace limits { diff --git a/media/base/mac/avfoundation_glue.h b/media/base/mac/avfoundation_glue.h index df54ae0..0bfa334 100644 --- a/media/base/mac/avfoundation_glue.h +++ b/media/base/mac/avfoundation_glue.h @@ -16,7 +16,7 @@ #import <Foundation/Foundation.h> #endif // defined(__OBJC__) -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/mac/coremedia_glue.h" #include "media/base/media_export.h" diff --git a/media/base/mac/coremedia_glue.h b/media/base/mac/coremedia_glue.h index 3a6ca07..fc05f35 100644 --- a/media/base/mac/coremedia_glue.h +++ b/media/base/mac/coremedia_glue.h @@ -6,8 +6,9 @@ #define MEDIA_BASE_MAC_COREMEDIA_GLUE_H_ #include <CoreVideo/CoreVideo.h> +#include <stdint.h> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" // CoreMedia API is only introduced in Mac OS X > 10.6, the (potential) linking diff --git a/media/base/mac/corevideo_glue.h b/media/base/mac/corevideo_glue.h index 27b4d10..ca40047 100644 --- a/media/base/mac/corevideo_glue.h +++ b/media/base/mac/corevideo_glue.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_MAC_COREVIDEO_GLUE_H_ #define MEDIA_BASE_MAC_COREVIDEO_GLUE_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" // Although CoreVideo exists in 10.6, not all of its types and functions were diff --git a/media/base/mac/video_frame_mac.cc b/media/base/mac/video_frame_mac.cc index 409077f1..b2b6485 100644 --- a/media/base/mac/video_frame_mac.cc +++ b/media/base/mac/video_frame_mac.cc @@ -72,7 +72,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { size_t plane_heights[kMaxPlanes]; size_t plane_bytes_per_row[kMaxPlanes]; for (int plane_i = 0; plane_i < num_planes; ++plane_i) { - plane_ptrs[plane_i] = const_cast<uint8*>(frame.data(plane_i)); + plane_ptrs[plane_i] = const_cast<uint8_t*>(frame.data(plane_i)); gfx::Size plane_size = VideoFrame::PlaneSize(video_frame_format, plane_i, coded_size); plane_widths[plane_i] = plane_size.width(); diff --git a/media/base/mac/videotoolbox_glue.h b/media/base/mac/videotoolbox_glue.h index 69dfd6a..8acb8ca 100644 --- a/media/base/mac/videotoolbox_glue.h +++ b/media/base/mac/videotoolbox_glue.h @@ -5,7 +5,7 @@ #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ #define MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/mac/coremedia_glue.h" #include "media/base/media_export.h" diff --git a/media/base/media_file_checker.cc b/media/base/media_file_checker.cc index 0ecdbf4..7426d10 100644 --- a/media/base/media_file_checker.cc +++ b/media/base/media_file_checker.cc @@ -15,7 +15,7 @@ namespace media { -static const int64 kMaxCheckTimeInSeconds = 5; +static const int64_t kMaxCheckTimeInSeconds = 5; static void OnError(bool* called) { *called = false; diff --git a/media/base/media_file_checker.h b/media/base/media_file_checker.h index 8ed191a..03be321 100644 --- a/media/base/media_file_checker.h +++ b/media/base/media_file_checker.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_MEDIA_FILE_CHECKER_H_ #define MEDIA_BASE_MEDIA_FILE_CHECKER_H_ -#include "base/basictypes.h" #include "base/files/file.h" #include "media/base/media_export.h" diff --git a/media/base/media_keys.h b/media/base/media_keys.h index 71d73e4..37b3019 100644 --- a/media/base/media_keys.h +++ b/media/base/media_keys.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/base/media_log.cc b/media/base/media_log.cc index 754a5f9..d0890c2 100644 --- a/media/base/media_log.cc +++ b/media/base/media_log.cc @@ -216,10 +216,12 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( } scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( - int64 start, int64 current, int64 end) { + int64_t start, + int64_t current, + int64_t end) { scoped_ptr<MediaLogEvent> event( CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); - // These values are headed to JS where there is no int64 so we use a double + // These values are headed to JS where there is no int64_t so we use a double // and accept loss of precision above 2^53 bytes (8 Exabytes). event->params.SetDouble("buffer_start", start); event->params.SetDouble("buffer_current", current); diff --git a/media/base/media_log.h b/media/base/media_log.h index 1e4b946..24fabb2 100644 --- a/media/base/media_log.h +++ b/media/base/media_log.h @@ -57,8 +57,9 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( size_t width, size_t height); - scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( - int64 start, int64 current, int64 end); + scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent(int64_t start, + int64_t current, + int64_t end); // Report a log message at the specified log level. void AddLogEvent(MediaLogLevel level, const std::string& message); @@ -76,7 +77,7 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { private: // A unique (to this process) id for this MediaLog. - int32 id_; + int32_t id_; DISALLOW_COPY_AND_ASSIGN(MediaLog); }; diff --git a/media/base/media_log_event.h b/media/base/media_log_event.h index 66aa5f7..44aab67 100644 --- a/media/base/media_log_event.h +++ b/media/base/media_log_event.h @@ -95,7 +95,7 @@ struct MediaLogEvent { TYPE_LAST = PROPERTY_CHANGE }; - int32 id; + int32_t id; Type type; base::DictionaryValue params; base::TimeTicks time; diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc index bb85b91..7debd6c 100644 --- a/media/base/mime_util.cc +++ b/media/base/mime_util.cc @@ -323,7 +323,7 @@ std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) { // And <level> is H.264 level multiplied by 10, also encoded as decimal number // E.g. <level> 31 corresponds to H.264 level 3.1 // See, for example, http://qtdevseed.apple.com/qadrift/testcases/tc-0133.php - uint32 level_start = 0; + uint32_t level_start = 0; std::string result; if (base::StartsWith(codec_id, "avc1.66.", base::CompareCase::SENSITIVE)) { level_start = 8; @@ -338,7 +338,7 @@ std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) { result = "avc1.6400"; } - uint32 level = 0; + uint32_t level = 0; if (level_start > 0 && base::StringToUint(codec_id.substr(level_start), &level) && level < 256) { // This is a valid legacy avc1 codec id - return the codec id translated @@ -496,7 +496,7 @@ void MimeUtil::RemoveProprietaryMediaTypesAndCodecsForTests() { } static bool IsValidH264Level(const std::string& level_str) { - uint32 level; + uint32_t level; if (level_str.size() != 2 || !base::HexStringToUInt(level_str, &level)) return false; diff --git a/media/base/mime_util_unittest.cc b/media/base/mime_util_unittest.cc index 616727d..3592b02 100644 --- a/media/base/mime_util_unittest.cc +++ b/media/base/mime_util_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/strings/string_split.h" #include "build/build_config.h" #include "media/base/mime_util.h" diff --git a/media/base/pipeline_status.h b/media/base/pipeline_status.h index b59219c..858d5a6 100644 --- a/media/base/pipeline_status.h +++ b/media/base/pipeline_status.h @@ -39,10 +39,10 @@ enum PipelineStatus { typedef base::Callback<void(PipelineStatus)> PipelineStatusCB; struct PipelineStatistics { - uint64_t audio_bytes_decoded = 0; // Should be uint64? - uint32 video_bytes_decoded = 0; // Should be uint64? - uint32 video_frames_decoded = 0; - uint32 video_frames_dropped = 0; + uint64_t audio_bytes_decoded = 0; // Should be uint64_t? + uint32_t video_bytes_decoded = 0; // Should be uint64_t? + uint32_t video_frames_decoded = 0; + uint32_t video_frames_dropped = 0; int64_t audio_memory_usage = 0; int64_t video_memory_usage = 0; }; diff --git a/media/base/player_tracker.h b/media/base/player_tracker.h index ff41c0a..aba01b3 100644 --- a/media/base/player_tracker.h +++ b/media/base/player_tracker.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_PLAYER_TRACKER_H_ #define MEDIA_BASE_PLAYER_TRACKER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "media/base/media_export.h" diff --git a/media/base/ranges.h b/media/base/ranges.h index e350a49..958df5c 100644 --- a/media/base/ranges.h +++ b/media/base/ranges.h @@ -9,7 +9,6 @@ #include <ostream> #include <vector> -#include "base/basictypes.h" #include "base/logging.h" #include "base/time/time.h" #include "media/base/media_export.h" @@ -19,7 +18,7 @@ namespace media { // Ranges allows holding an ordered list of ranges of [start,end) intervals. // The canonical example use-case is holding the list of ranges of buffered // bytes or times in a <video> tag. -template<class T> // Endpoint type; typically a base::TimeDelta or an int64. +template <class T> // Endpoint type; typically a base::TimeDelta or an int64_t. class Ranges { public: // Allow copy & assign. diff --git a/media/base/seekable_buffer.cc b/media/base/seekable_buffer.cc index 60edb59..1494559 100644 --- a/media/base/seekable_buffer.cc +++ b/media/base/seekable_buffer.cc @@ -34,17 +34,17 @@ void SeekableBuffer::Clear() { current_time_ = kNoTimestamp(); } -int SeekableBuffer::Read(uint8* data, int size) { +int SeekableBuffer::Read(uint8_t* data, int size) { DCHECK(data); return InternalRead(data, size, true, 0); } -int SeekableBuffer::Peek(uint8* data, int size, int forward_offset) { +int SeekableBuffer::Peek(uint8_t* data, int size, int forward_offset) { DCHECK(data); return InternalRead(data, size, false, forward_offset); } -bool SeekableBuffer::GetCurrentChunk(const uint8** data, int* size) const { +bool SeekableBuffer::GetCurrentChunk(const uint8_t** data, int* size) const { BufferQueue::iterator current_buffer = current_buffer_; int current_buffer_offset = current_buffer_offset_; // Advance position if we are in the end of the current buffer. @@ -87,7 +87,7 @@ bool SeekableBuffer::Append(const scoped_refptr<DataBuffer>& buffer_in) { return true; } -bool SeekableBuffer::Append(const uint8* data, int size) { +bool SeekableBuffer::Append(const uint8_t* data, int size) { if (size > 0) { scoped_refptr<DataBuffer> data_buffer = DataBuffer::CopyFrom(data, size); return Append(data_buffer); @@ -97,7 +97,7 @@ bool SeekableBuffer::Append(const uint8* data, int size) { } } -bool SeekableBuffer::Seek(int32 offset) { +bool SeekableBuffer::Seek(int32_t offset) { if (offset > 0) return SeekForward(offset); else if (offset < 0) @@ -180,7 +180,8 @@ void SeekableBuffer::EvictBackwardBuffers() { } } -int SeekableBuffer::InternalRead(uint8* data, int size, +int SeekableBuffer::InternalRead(uint8_t* data, + int size, bool advance_position, int forward_offset) { // Counts how many bytes are actually read from the buffer queue. @@ -267,8 +268,8 @@ void SeekableBuffer::UpdateCurrentTime(BufferQueue::iterator buffer, // Garbage values are unavoidable, so this check will remain. if (buffer != buffers_.end() && (*buffer)->timestamp() != kNoTimestamp()) { - int64 time_offset = ((*buffer)->duration().InMicroseconds() * offset) / - (*buffer)->data_size(); + int64_t time_offset = ((*buffer)->duration().InMicroseconds() * offset) / + (*buffer)->data_size(); current_time_ = (*buffer)->timestamp() + base::TimeDelta::FromMicroseconds(time_offset); diff --git a/media/base/seekable_buffer.h b/media/base/seekable_buffer.h index 889c669..42c3abc 100644 --- a/media/base/seekable_buffer.h +++ b/media/base/seekable_buffer.h @@ -35,7 +35,6 @@ #include <list> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" #include "media/base/media_export.h" @@ -60,20 +59,20 @@ class MEDIA_EXPORT SeekableBuffer { // The current read position will advance by the amount of bytes read. If // reading caused backward_bytes() to exceed backward_capacity(), an eviction // of the backward buffer will be done internally. - int Read(uint8* data, int size); + int Read(uint8_t* data, int size); // Copies up to |size| bytes from current position to |data|. Returns // number of bytes copied. Doesn't advance current position. Optionally // starts at a |forward_offset| from current position. - int Peek(uint8* data, int size) { return Peek(data, size, 0); } - int Peek(uint8* data, int size, int forward_offset); + int Peek(uint8_t* data, int size) { return Peek(data, size, 0); } + int Peek(uint8_t* data, int size, int forward_offset); // Returns pointer to the current chunk of data that is being consumed. // If there is no data left in the buffer false is returned, otherwise // true is returned and |data| and |size| are updated. The returned // |data| value becomes invalid when Read(), Append() or Seek() // are called. - bool GetCurrentChunk(const uint8** data, int* size) const; + bool GetCurrentChunk(const uint8_t** data, int* size) const; // Appends |buffer_in| to this buffer. Returns false if forward_bytes() is // greater than or equals to forward_capacity(), true otherwise. The data @@ -82,7 +81,7 @@ class MEDIA_EXPORT SeekableBuffer { // Appends |size| bytes of |data| to the buffer. Result is the same // as for Append(Buffer*). - bool Append(const uint8* data, int size); + bool Append(const uint8_t* data, int size); // Moves the read position by |offset| bytes. If |offset| is positive, the // current read position is moved forward. If negative, the current read @@ -94,7 +93,7 @@ class MEDIA_EXPORT SeekableBuffer { // If the seek operation fails, the current read position will not be updated. // If a forward seeking caused backward_bytes() to exceed backward_capacity(), // this method call will cause an eviction of the backward buffer. - bool Seek(int32 offset); + bool Seek(int32_t offset); // Returns the number of bytes buffered beyond the current read position. int forward_bytes() const { return forward_bytes_; } @@ -142,8 +141,10 @@ class MEDIA_EXPORT SeekableBuffer { // of bytes read. The current read position will be moved forward by the // number of bytes read. If |data| is NULL, only the current read position // will advance but no data will be copied. - int InternalRead( - uint8* data, int size, bool advance_position, int forward_offset); + int InternalRead(uint8_t* data, + int size, + bool advance_position, + int forward_offset); // A helper method that moves the current read position forward by |size| // bytes. diff --git a/media/base/seekable_buffer_unittest.cc b/media/base/seekable_buffer_unittest.cc index cd79e54..7532a8e 100644 --- a/media/base/seekable_buffer_unittest.cc +++ b/media/base/seekable_buffer_unittest.cc @@ -41,8 +41,8 @@ class SeekableBufferTest : public testing::Test { } SeekableBuffer buffer_; - uint8 data_[kDataSize]; - uint8 write_buffer_[kDataSize]; + uint8_t data_[kDataSize]; + uint8_t write_buffer_[kDataSize]; }; TEST_F(SeekableBufferTest, RandomReadWrite) { @@ -119,7 +119,7 @@ TEST_F(SeekableBufferTest, ReadWriteSeek) { read_position += kReadSize; // Seek backward. - EXPECT_TRUE(buffer_.Seek(-3 * static_cast<int32>(kReadSize))); + EXPECT_TRUE(buffer_.Seek(-3 * static_cast<int32_t>(kReadSize))); forward_bytes += 3 * kReadSize; read_position -= 3 * kReadSize; EXPECT_EQ(forward_bytes, buffer_.forward_bytes()); @@ -216,7 +216,7 @@ TEST_F(SeekableBufferTest, SeekBackward) { } // Seek backward. - EXPECT_TRUE(buffer_.Seek(-static_cast<int32>(kBufferSize))); + EXPECT_TRUE(buffer_.Seek(-static_cast<int32_t>(kBufferSize))); EXPECT_FALSE(buffer_.Seek(-1)); // Read again. @@ -231,7 +231,7 @@ TEST_F(SeekableBufferTest, GetCurrentChunk) { scoped_refptr<DataBuffer> buffer = DataBuffer::CopyFrom(data_, kWriteSize); - const uint8* data; + const uint8_t* data; int size; EXPECT_FALSE(buffer_.GetCurrentChunk(&data, &size)); @@ -292,12 +292,12 @@ TEST_F(SeekableBufferTest, AllMethods) { } TEST_F(SeekableBufferTest, GetTime) { - const int64 kNoTS = kNoTimestamp().ToInternalValue(); + const int64_t kNoTS = kNoTimestamp().ToInternalValue(); const struct { - int64 first_time_useconds; - int64 duration_useconds; + int64_t first_time_useconds; + int64_t duration_useconds; int consume_bytes; - int64 expected_time; + int64_t expected_time; } tests[] = { { kNoTS, 1000000, 0, kNoTS }, { kNoTS, 4000000, 0, kNoTS }, @@ -342,7 +342,7 @@ TEST_F(SeekableBufferTest, GetTime) { buffer_.Append(buffer.get()); EXPECT_TRUE(buffer_.Seek(tests[i].consume_bytes)); - int64 actual = buffer_.current_time().ToInternalValue(); + int64_t actual = buffer_.current_time().ToInternalValue(); EXPECT_EQ(tests[i].expected_time, actual) << "With test = { start:" << tests[i].first_time_useconds << ", duration:" diff --git a/media/base/simd/convert_rgb_to_yuv.h b/media/base/simd/convert_rgb_to_yuv.h index d3bb4ca..0634540 100644 --- a/media/base/simd/convert_rgb_to_yuv.h +++ b/media/base/simd/convert_rgb_to_yuv.h @@ -5,7 +5,8 @@ #ifndef MEDIA_BASE_SIMD_CONVERT_RGB_TO_YUV_H_ #define MEDIA_BASE_SIMD_CONVERT_RGB_TO_YUV_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/base/yuv_convert.h" namespace media { @@ -13,60 +14,60 @@ namespace media { // These methods are exported for testing purposes only. Library users should // only call the methods listed in yuv_convert.h. -MEDIA_EXPORT void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB32ToYUV_SSSE3(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB24ToYUV_SSSE3(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2_Reference(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2_Reference(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB32ToYUV_C(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB32ToYUV_C(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB24ToYUV_C(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB24ToYUV_C(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, diff --git a/media/base/simd/convert_rgb_to_yuv_c.cc b/media/base/simd/convert_rgb_to_yuv_c.cc index 4917d37..7444a6e 100644 --- a/media/base/simd/convert_rgb_to_yuv_c.cc +++ b/media/base/simd/convert_rgb_to_yuv_c.cc @@ -15,10 +15,10 @@ static int clip_byte(int x) { return x; } -void ConvertRGB32ToYUV_C(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB32ToYUV_C(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -37,7 +37,7 @@ void ConvertRGB32ToYUV_C(const uint8* rgbframe, for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { // Since the input pixel format is RGB32, there are 4 bytes per pixel. - const uint8* pixel = rgbframe + 4 * j; + const uint8_t* pixel = rgbframe + 4 * j; yplane[j] = clip_byte(((pixel[r] * 66 + pixel[g] * 129 + pixel[b] * 25 + 128) >> 8) + 16); if (i % 2 == 0 && j % 2 == 0) { @@ -56,10 +56,10 @@ void ConvertRGB32ToYUV_C(const uint8* rgbframe, } } -void ConvertRGB24ToYUV_C(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB24ToYUV_C(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -68,7 +68,7 @@ void ConvertRGB24ToYUV_C(const uint8* rgbframe, for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { // Since the input pixel format is RGB24, there are 3 bytes per pixel. - const uint8* pixel = rgbframe + 3 * j; + const uint8_t* pixel = rgbframe + 3 * j; yplane[j] = clip_byte(((pixel[2] * 66 + pixel[1] * 129 + pixel[0] * 25 + 128) >> 8) + 16); if (i % 2 == 0 && j % 2 == 0) { diff --git a/media/base/simd/convert_rgb_to_yuv_sse2.cc b/media/base/simd/convert_rgb_to_yuv_sse2.cc index 1b07598e..bdef602 100644 --- a/media/base/simd/convert_rgb_to_yuv_sse2.cc +++ b/media/base/simd/convert_rgb_to_yuv_sse2.cc @@ -24,27 +24,27 @@ namespace media { #define FIX(x) ((x) * (1 << FIX_SHIFT)) // Define a convenient macro to do static cast. -#define INT16_FIX(x) static_cast<int16>(FIX(x)) +#define INT16_FIX(x) static_cast<int16_t>(FIX(x)) // Android's pixel layout is RGBA, while other platforms // are BGRA. #if defined(OS_ANDROID) -SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = { - INT16_FIX(0.257), INT16_FIX(0.504), INT16_FIX(0.098), 0, - INT16_FIX(0.257), INT16_FIX(0.504), INT16_FIX(0.098), 0, - -INT16_FIX(0.148), -INT16_FIX(0.291), INT16_FIX(0.439), 0, - -INT16_FIX(0.148), -INT16_FIX(0.291), INT16_FIX(0.439), 0, - INT16_FIX(0.439), -INT16_FIX(0.368), -INT16_FIX(0.071), 0, - INT16_FIX(0.439), -INT16_FIX(0.368), -INT16_FIX(0.071), 0, +SIMD_ALIGNED(const int16_t ConvertRGBAToYUV_kTable[8 * 3]) = { + INT16_FIX(0.257), INT16_FIX(0.504), INT16_FIX(0.098), 0, + INT16_FIX(0.257), INT16_FIX(0.504), INT16_FIX(0.098), 0, + -INT16_FIX(0.148), -INT16_FIX(0.291), INT16_FIX(0.439), 0, + -INT16_FIX(0.148), -INT16_FIX(0.291), INT16_FIX(0.439), 0, + INT16_FIX(0.439), -INT16_FIX(0.368), -INT16_FIX(0.071), 0, + INT16_FIX(0.439), -INT16_FIX(0.368), -INT16_FIX(0.071), 0, }; #else -SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = { - INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0, - INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0, - INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0, - INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0, - -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0, - -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0, +SIMD_ALIGNED(const int16_t ConvertRGBAToYUV_kTable[8 * 3]) = { + INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0, + INT16_FIX(0.098), INT16_FIX(0.504), INT16_FIX(0.257), 0, + INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0, + INT16_FIX(0.439), -INT16_FIX(0.291), -INT16_FIX(0.148), 0, + -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0, + -INT16_FIX(0.071), -INT16_FIX(0.368), INT16_FIX(0.439), 0, }; #endif @@ -53,17 +53,17 @@ SIMD_ALIGNED(const int16 ConvertRGBAToYUV_kTable[8 * 3]) = { // This is the final offset for the conversion from signed yuv values to // unsigned values. It is arranged so that offset of 16 is applied to Y // components and 128 is added to UV components for 2 pixels. -SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16}; +SIMD_ALIGNED(const int32_t kYOffset[4]) = {16, 16, 16, 16}; -static inline uint8 Clamp(int value) { +static inline uint8_t Clamp(int value) { if (value < 0) return 0; if (value > 255) return 255; - return static_cast<uint8>(value); + return static_cast<uint8_t>(value); } -static inline uint8 RGBToY(int r, int g, int b) { +static inline uint8_t RGBToY(int r, int g, int b) { int y = ConvertRGBAToYUV_kTable[0] * b + ConvertRGBAToYUV_kTable[1] * g + ConvertRGBAToYUV_kTable[2] * r; @@ -71,7 +71,7 @@ static inline uint8 RGBToY(int r, int g, int b) { return Clamp(y + 16); } -static inline uint8 RGBToU(int r, int g, int b, int shift) { +static inline uint8_t RGBToU(int r, int g, int b, int shift) { int u = ConvertRGBAToYUV_kTable[8] * b + ConvertRGBAToYUV_kTable[9] * g + ConvertRGBAToYUV_kTable[10] * r; @@ -79,7 +79,7 @@ static inline uint8 RGBToU(int r, int g, int b, int shift) { return Clamp(u + 128); } -static inline uint8 RGBToV(int r, int g, int b, int shift) { +static inline uint8_t RGBToV(int r, int g, int b, int shift) { int v = ConvertRGBAToYUV_kTable[16] * b + ConvertRGBAToYUV_kTable[17] * g + ConvertRGBAToYUV_kTable[18] * r; @@ -97,12 +97,12 @@ static inline uint8 RGBToV(int r, int g, int b, int shift) { sum_r += r; \ *y_buf++ = RGBToY(r, g, b); -static inline void ConvertRGBToYUV_V2H2(const uint8* rgb_buf_1, - const uint8* rgb_buf_2, - uint8* y_buf_1, - uint8* y_buf_2, - uint8* u_buf, - uint8* v_buf) { +static inline void ConvertRGBToYUV_V2H2(const uint8_t* rgb_buf_1, + const uint8_t* rgb_buf_2, + uint8_t* y_buf_1, + uint8_t* y_buf_2, + uint8_t* u_buf, + uint8_t* v_buf) { int sum_b = 0; int sum_g = 0; int sum_r = 0; @@ -118,12 +118,12 @@ static inline void ConvertRGBToYUV_V2H2(const uint8* rgb_buf_1, *v_buf++ = RGBToV(sum_r, sum_g, sum_b, 2); } -static inline void ConvertRGBToYUV_V2H1(const uint8* rgb_buf_1, - const uint8* rgb_buf_2, - uint8* y_buf_1, - uint8* y_buf_2, - uint8* u_buf, - uint8* v_buf) { +static inline void ConvertRGBToYUV_V2H1(const uint8_t* rgb_buf_1, + const uint8_t* rgb_buf_2, + uint8_t* y_buf_1, + uint8_t* y_buf_2, + uint8_t* u_buf, + uint8_t* v_buf) { int sum_b = 0; int sum_g = 0; int sum_r = 0; @@ -135,10 +135,10 @@ static inline void ConvertRGBToYUV_V2H1(const uint8* rgb_buf_1, *v_buf++ = RGBToV(sum_r, sum_g, sum_b, 1); } -static inline void ConvertRGBToYUV_V1H2(const uint8* rgb_buf, - uint8* y_buf, - uint8* u_buf, - uint8* v_buf) { +static inline void ConvertRGBToYUV_V1H2(const uint8_t* rgb_buf, + uint8_t* y_buf, + uint8_t* u_buf, + uint8_t* v_buf) { int sum_b = 0; int sum_g = 0; int sum_r = 0; @@ -150,10 +150,10 @@ static inline void ConvertRGBToYUV_V1H2(const uint8* rgb_buf, *v_buf++ = RGBToV(sum_r, sum_g, sum_b, 1); } -static inline void ConvertRGBToYUV_V1H1(const uint8* rgb_buf, - uint8* y_buf, - uint8* u_buf, - uint8* v_buf) { +static inline void ConvertRGBToYUV_V1H1(const uint8_t* rgb_buf, + uint8_t* y_buf, + uint8_t* u_buf, + uint8_t* v_buf) { int sum_b = 0; int sum_g = 0; int sum_r = 0; @@ -164,12 +164,12 @@ static inline void ConvertRGBToYUV_V1H1(const uint8* rgb_buf, *v_buf++ = RGBToV(r, g, b, 0); } -static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, - const uint8* rgb_buf_2, - uint8* y_buf_1, - uint8* y_buf_2, - uint8* u_buf, - uint8* v_buf, +static void ConvertRGB32ToYUVRow_SSE2(const uint8_t* rgb_buf_1, + const uint8_t* rgb_buf_2, + uint8_t* y_buf_1, + uint8_t* y_buf_2, + uint8_t* u_buf, + uint8_t* v_buf, int width) { while (width >= 4) { // Name for the Y pixels: @@ -213,7 +213,7 @@ static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, y_abcd = _mm_add_epi32(y_abcd, y_offset); y_abcd = _mm_packs_epi32(y_abcd, y_abcd); y_abcd = _mm_packus_epi16(y_abcd, y_abcd); - *reinterpret_cast<uint32*>(y_buf_1) = _mm_cvtsi128_si32(y_abcd); + *reinterpret_cast<uint32_t*>(y_buf_1) = _mm_cvtsi128_si32(y_abcd); y_buf_1 += 4; // Second row 4 pixels. @@ -246,7 +246,7 @@ static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, y_efgh = _mm_add_epi32(y_efgh, y_offset); y_efgh = _mm_packs_epi32(y_efgh, y_efgh); y_efgh = _mm_packus_epi16(y_efgh, y_efgh); - *reinterpret_cast<uint32*>(y_buf_2) = _mm_cvtsi128_si32(y_efgh); + *reinterpret_cast<uint32_t*>(y_buf_2) = _mm_cvtsi128_si32(y_efgh); y_buf_2 += 4; __m128i rgb_ae_cg = _mm_castps_si128( @@ -274,8 +274,8 @@ static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, u_a_b = _mm_add_epi32(u_a_b, uv_offset); u_a_b = _mm_packs_epi32(u_a_b, u_a_b); u_a_b = _mm_packus_epi16(u_a_b, u_a_b); - *reinterpret_cast<uint16*>(u_buf) = - static_cast<uint16>(_mm_extract_epi16(u_a_b, 0)); + *reinterpret_cast<uint16_t*>(u_buf) = + static_cast<uint16_t>(_mm_extract_epi16(u_a_b, 0)); u_buf += 2; __m128i v_a_b = _mm_madd_epi16( @@ -288,8 +288,8 @@ static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, v_a_b = _mm_add_epi32(v_a_b, uv_offset); v_a_b = _mm_packs_epi32(v_a_b, v_a_b); v_a_b = _mm_packus_epi16(v_a_b, v_a_b); - *reinterpret_cast<uint16*>(v_buf) = - static_cast<uint16>(_mm_extract_epi16(v_a_b, 0)); + *reinterpret_cast<uint16_t*>(v_buf) = + static_cast<uint16_t>(_mm_extract_epi16(v_a_b, 0)); v_buf += 2; rgb_buf_1 += 16; @@ -315,10 +315,10 @@ static void ConvertRGB32ToYUVRow_SSE2(const uint8* rgb_buf_1, ConvertRGBToYUV_V2H1(rgb_buf_1, rgb_buf_2, y_buf_1, y_buf_2, u_buf, v_buf); } -extern void ConvertRGB32ToYUV_SSE2(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +extern void ConvertRGB32ToYUV_SSE2(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -356,10 +356,10 @@ extern void ConvertRGB32ToYUV_SSE2(const uint8* rgbframe, ConvertRGBToYUV_V1H1(rgbframe, yplane, uplane, vplane); } -void ConvertRGB32ToYUV_SSE2_Reference(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB32ToYUV_SSE2_Reference(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, diff --git a/media/base/simd/convert_rgb_to_yuv_ssse3.cc b/media/base/simd/convert_rgb_to_yuv_ssse3.cc index e956926..2ab2b98 100644 --- a/media/base/simd/convert_rgb_to_yuv_ssse3.cc +++ b/media/base/simd/convert_rgb_to_yuv_ssse3.cc @@ -9,10 +9,10 @@ namespace media { -void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB32ToYUV_SSSE3(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -35,10 +35,10 @@ void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe, ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width); } -void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB24ToYUV_SSSE3(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, diff --git a/media/base/simd/convert_rgb_to_yuv_ssse3.h b/media/base/simd/convert_rgb_to_yuv_ssse3.h index 92144c9..19ece73 100644 --- a/media/base/simd/convert_rgb_to_yuv_ssse3.h +++ b/media/base/simd/convert_rgb_to_yuv_ssse3.h @@ -5,6 +5,9 @@ #ifndef MEDIA_BASE_SIMD_CONVERT_RGB_TO_YUV_SSSE3_H_ #define MEDIA_BASE_SIMD_CONVERT_RGB_TO_YUV_SSSE3_H_ +#include <stddef.h> +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif @@ -20,17 +23,17 @@ extern "C" { // issue on at least Win64. // Convert a row of 24-bit RGB pixels to YV12 pixels. -void ConvertRGBToYUVRow_SSSE3(const uint8* rgb, - uint8* y, - uint8* u, - uint8* v, +void ConvertRGBToYUVRow_SSSE3(const uint8_t* rgb, + uint8_t* y, + uint8_t* u, + uint8_t* v, ptrdiff_t width); // Convert a row of 32-bit RGB pixels to YV12 pixels. -void ConvertARGBToYUVRow_SSSE3(const uint8* argb, - uint8* y, - uint8* u, - uint8* v, +void ConvertARGBToYUVRow_SSSE3(const uint8_t* argb, + uint8_t* y, + uint8_t* u, + uint8_t* v, ptrdiff_t width); #ifdef __cplusplus diff --git a/media/base/simd/convert_rgb_to_yuv_unittest.cc b/media/base/simd/convert_rgb_to_yuv_unittest.cc index fc88795..bba00af 100644 --- a/media/base/simd/convert_rgb_to_yuv_unittest.cc +++ b/media/base/simd/convert_rgb_to_yuv_unittest.cc @@ -10,19 +10,19 @@ namespace { // Reference code that converts RGB pixels to YUV pixels. -int ConvertRGBToY(const uint8* rgb) { +int ConvertRGBToY(const uint8_t* rgb) { int y = 25 * rgb[0] + 129 * rgb[1] + 66 * rgb[2]; y = ((y + 128) >> 8) + 16; return std::max(0, std::min(255, y)); } -int ConvertRGBToU(const uint8* rgb, int size) { +int ConvertRGBToU(const uint8_t* rgb, int size) { int u = 112 * rgb[0] - 74 * rgb[1] - 38 * rgb[2]; u = ((u + 128) >> 8) + 128; return std::max(0, std::min(255, u)); } -int ConvertRGBToV(const uint8* rgb, int size) { +int ConvertRGBToV(const uint8_t* rgb, int size) { int v = -18 * rgb[0] - 94 * rgb[1] + 112 * rgb[2]; v = ((v + 128) >> 8) + 128; return std::max(0, std::min(255, v)); @@ -56,14 +56,14 @@ TEST(YUVConvertTest, MAYBE_SideBySideRGB) { for (int size = 3; size <= 4; ++size) { // Create the output buffers. - scoped_ptr<uint8[]> rgb(new uint8[kWidth * size]); - scoped_ptr<uint8[]> y(new uint8[kWidth]); - scoped_ptr<uint8[]> u(new uint8[kWidth / 2]); - scoped_ptr<uint8[]> v(new uint8[kWidth / 2]); + scoped_ptr<uint8_t[]> rgb(new uint8_t[kWidth * size]); + scoped_ptr<uint8_t[]> y(new uint8_t[kWidth]); + scoped_ptr<uint8_t[]> u(new uint8_t[kWidth / 2]); + scoped_ptr<uint8_t[]> v(new uint8_t[kWidth / 2]); // Choose the function that converts from RGB pixels to YUV ones. - void (*convert)(const uint8*, uint8*, uint8*, uint8*, - int, int, int, int, int) = NULL; + void (*convert)(const uint8_t*, uint8_t*, uint8_t*, uint8_t*, int, int, int, + int, int) = NULL; if (size == 3) convert = media::ConvertRGB24ToYUV_SSSE3; else @@ -88,21 +88,21 @@ TEST(YUVConvertTest, MAYBE_SideBySideRGB) { // Check the output Y pixels. for (int i = 0; i < kWidth; ++i) { - const uint8* p = &rgb[i * size]; + const uint8_t* p = &rgb[i * size]; int error = ConvertRGBToY(p) - y[i]; total_error += error > 0 ? error : -error; } // Check the output U pixels. for (int i = 0; i < kWidth / 2; ++i) { - const uint8* p = &rgb[i * 2 * size]; + const uint8_t* p = &rgb[i * 2 * size]; int error = ConvertRGBToU(p, size) - u[i]; total_error += error > 0 ? error : -error; } // Check the output V pixels. for (int i = 0; i < kWidth / 2; ++i) { - const uint8* p = &rgb[i * 2 * size]; + const uint8_t* p = &rgb[i * 2 * size]; int error = ConvertRGBToV(p, size) - v[i]; total_error += error > 0 ? error : -error; } diff --git a/media/base/simd/convert_yuv_to_rgb.h b/media/base/simd/convert_yuv_to_rgb.h index 7feb007..a421ff5 100644 --- a/media/base/simd/convert_yuv_to_rgb.h +++ b/media/base/simd/convert_yuv_to_rgb.h @@ -5,7 +5,9 @@ #ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ -#include "base/basictypes.h" +#include <stddef.h> +#include <stdint.h> + #include "media/base/yuv_convert.h" namespace media { @@ -13,10 +15,10 @@ namespace media { // These methods are exported for testing purposes only. Library users should // only call the methods listed in yuv_convert.h. -MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -24,18 +26,18 @@ MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane, int rgbstride, YUVType yuv_type); -MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, ptrdiff_t width, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -44,18 +46,18 @@ MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, int rgbstride, YUVType yuv_type); -MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, ptrdiff_t width, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -63,11 +65,11 @@ MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, int rgbstride, YUVType yuv_type); -MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -76,31 +78,31 @@ MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane, int rgbstride, YUVType yuv_type); -MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table); + const int16_t* convert_table); MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C( - const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, + const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int dest_width, int source_x, int source_dx, - const int16* convert_table); + const int16_t* convert_table); } // namespace media @@ -114,52 +116,53 @@ extern "C" { // issue on at least Win64. The C-equivalent RowProc versions' prototypes // include the same change to ptrdiff_t to reuse the typedefs. -MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, ptrdiff_t width, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, ptrdiff_t width, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table); + const int16_t* convert_table); -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table); - -MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - ptrdiff_t width, - ptrdiff_t source_dx, - const int16* convert_table); + const int16_t* convert_table); + +MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64( + const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, + ptrdiff_t width, + ptrdiff_t source_dx, + const int16_t* convert_table); } // extern "C" diff --git a/media/base/simd/convert_yuv_to_rgb_c.cc b/media/base/simd/convert_yuv_to_rgb_c.cc index 370f80e..790e431 100644 --- a/media/base/simd/convert_yuv_to_rgb_c.cc +++ b/media/base/simd/convert_yuv_to_rgb_c.cc @@ -34,11 +34,11 @@ namespace media { #define A_INDEX 3 #endif -static inline void ConvertYUVToRGB32_C(uint8 y, - uint8 u, - uint8 v, - uint8* rgb_buf, - const int16* convert_table) { +static inline void ConvertYUVToRGB32_C(uint8_t y, + uint8_t u, + uint8_t v, + uint8_t* rgb_buf, + const int16_t* convert_table) { int b = convert_table[4 * (256 + u) + B_INDEX]; int g = convert_table[4 * (256 + u) + G_INDEX]; int r = convert_table[4 * (256 + u) + R_INDEX]; @@ -59,18 +59,17 @@ static inline void ConvertYUVToRGB32_C(uint8 y, r >>= 6; a >>= 6; - *reinterpret_cast<uint32*>(rgb_buf) = (packuswb(b) << SK_B32_SHIFT) | - (packuswb(g) << SK_G32_SHIFT) | - (packuswb(r) << SK_R32_SHIFT) | - (packuswb(a) << SK_A32_SHIFT); + *reinterpret_cast<uint32_t*>(rgb_buf) = + (packuswb(b) << SK_B32_SHIFT) | (packuswb(g) << SK_G32_SHIFT) | + (packuswb(r) << SK_R32_SHIFT) | (packuswb(a) << SK_A32_SHIFT); } -static inline void ConvertYUVAToARGB_C(uint8 y, - uint8 u, - uint8 v, - uint8 a, - uint8* rgb_buf, - const int16* convert_table) { +static inline void ConvertYUVAToARGB_C(uint8_t y, + uint8_t u, + uint8_t v, + uint8_t a, + uint8_t* rgb_buf, + const int16_t* convert_table) { int b = convert_table[4 * (256 + u) + 0]; int g = convert_table[4 * (256 + u) + 1]; int r = convert_table[4 * (256 + u) + 2]; @@ -91,47 +90,46 @@ static inline void ConvertYUVAToARGB_C(uint8 y, g = packuswb(g) * a >> 8; r = packuswb(r) * a >> 8; - *reinterpret_cast<uint32*>(rgb_buf) = (b << SK_B32_SHIFT) | - (g << SK_G32_SHIFT) | - (r << SK_R32_SHIFT) | - (a << SK_A32_SHIFT); + *reinterpret_cast<uint32_t*>(rgb_buf) = + (b << SK_B32_SHIFT) | (g << SK_G32_SHIFT) | (r << SK_R32_SHIFT) | + (a << SK_A32_SHIFT); } -void ConvertYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, - const int16* convert_table) { + const int16_t* convert_table) { for (int x = 0; x < width; x += 2) { - uint8 u = u_buf[x >> 1]; - uint8 v = v_buf[x >> 1]; - uint8 y0 = y_buf[x]; + uint8_t u = u_buf[x >> 1]; + uint8_t v = v_buf[x >> 1]; + uint8_t y0 = y_buf[x]; ConvertYUVToRGB32_C(y0, u, v, rgb_buf, convert_table); if ((x + 1) < width) { - uint8 y1 = y_buf[x + 1]; + uint8_t y1 = y_buf[x + 1]; ConvertYUVToRGB32_C(y1, u, v, rgb_buf + 4, convert_table); } rgb_buf += 8; // Advance 2 pixels. } } -void ConvertYUVAToARGBRow_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - const uint8* a_buf, - uint8* rgba_buf, +void ConvertYUVAToARGBRow_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + const uint8_t* a_buf, + uint8_t* rgba_buf, ptrdiff_t width, - const int16* convert_table) { + const int16_t* convert_table) { for (int x = 0; x < width; x += 2) { - uint8 u = u_buf[x >> 1]; - uint8 v = v_buf[x >> 1]; - uint8 y0 = y_buf[x]; - uint8 a0 = a_buf[x]; + uint8_t u = u_buf[x >> 1]; + uint8_t v = v_buf[x >> 1]; + uint8_t y0 = y_buf[x]; + uint8_t a0 = a_buf[x]; ConvertYUVAToARGB_C(y0, u, v, a0, rgba_buf, convert_table); if ((x + 1) < width) { - uint8 y1 = y_buf[x + 1]; - uint8 a1 = a_buf[x + 1]; + uint8_t y1 = y_buf[x + 1]; + uint8_t a1 = a_buf[x + 1]; ConvertYUVAToARGB_C(y1, u, v, a1, rgba_buf + 4, convert_table); } rgba_buf += 8; // Advance 2 pixels. @@ -142,13 +140,13 @@ void ConvertYUVAToARGBRow_C(const uint8* y_buf, // A shift by 17 is used to further subsample the chrominence channels. // & 0xffff isolates the fixed point fraction. >> 2 to get the upper 2 bits, // for 1/65536 pixel accurate interpolation. -void ScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table) { + const int16_t* convert_table) { int x = 0; for (int i = 0; i < width; i += 2) { int y = y_buf[x >> 16]; @@ -165,13 +163,13 @@ void ScaleYUVToRGB32Row_C(const uint8* y_buf, } } -void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, ptrdiff_t width, ptrdiff_t source_dx, - const int16* convert_table) { + const int16_t* convert_table) { // Avoid point-sampling for down-scaling by > 2:1. int source_x = 0; if (source_dx >= 0x20000) @@ -180,14 +178,14 @@ void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, source_x, source_dx, convert_table); } -void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32RowWithRange_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int dest_width, int x, int source_dx, - const int16* convert_table) { + const int16_t* convert_table) { for (int i = 0; i < dest_width; i += 2) { int y0 = y_buf[x >> 16]; int y1 = y_buf[(x >> 16) + 1]; @@ -214,10 +212,10 @@ void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, } } -void ConvertYUVToRGB32_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYUVToRGB32_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -225,12 +223,12 @@ void ConvertYUVToRGB32_C(const uint8* yplane, int rgbstride, YUVType yuv_type) { unsigned int y_shift = GetVerticalShift(yuv_type); - const int16* lookup_table = GetLookupTable(yuv_type); + const int16_t* lookup_table = GetLookupTable(yuv_type); for (int y = 0; y < height; ++y) { - uint8* rgb_row = rgbframe + y * rgbstride; - const uint8* y_ptr = yplane + y * ystride; - const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; - const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; + uint8_t* rgb_row = rgbframe + y * rgbstride; + const uint8_t* y_ptr = yplane + y * ystride; + const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; + const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; ConvertYUVToRGB32Row_C(y_ptr, u_ptr, @@ -241,11 +239,11 @@ void ConvertYUVToRGB32_C(const uint8* yplane, } } -void ConvertYUVAToARGB_C(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbaframe, +void ConvertYUVAToARGB_C(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbaframe, int width, int height, int ystride, @@ -254,13 +252,13 @@ void ConvertYUVAToARGB_C(const uint8* yplane, int rgbastride, YUVType yuv_type) { unsigned int y_shift = GetVerticalShift(yuv_type); - const int16* lookup_table = GetLookupTable(yuv_type); + const int16_t* lookup_table = GetLookupTable(yuv_type); for (int y = 0; y < height; y++) { - uint8* rgba_row = rgbaframe + y * rgbastride; - const uint8* y_ptr = yplane + y * ystride; - const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; - const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; - const uint8* a_ptr = aplane + y * astride; + uint8_t* rgba_row = rgbaframe + y * rgbastride; + const uint8_t* y_ptr = yplane + y * ystride; + const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; + const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; + const uint8_t* a_ptr = aplane + y * astride; ConvertYUVAToARGBRow_C(y_ptr, u_ptr, diff --git a/media/base/simd/convert_yuv_to_rgb_x86.cc b/media/base/simd/convert_yuv_to_rgb_x86.cc index 043170a..e8f8966 100644 --- a/media/base/simd/convert_yuv_to_rgb_x86.cc +++ b/media/base/simd/convert_yuv_to_rgb_x86.cc @@ -13,11 +13,11 @@ namespace media { -void ConvertYUVAToARGB_MMX(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +void ConvertYUVAToARGB_MMX(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -27,11 +27,11 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, YUVType yuv_type) { unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { - uint8* rgb_row = rgbframe + y * rgbstride; - const uint8* y_ptr = yplane + y * ystride; - const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; - const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; - const uint8* a_ptr = aplane + y * astride; + uint8_t* rgb_row = rgbframe + y * rgbstride; + const uint8_t* y_ptr = yplane + y * ystride; + const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; + const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; + const uint8_t* a_ptr = aplane + y * astride; ConvertYUVAToARGBRow_MMX(y_ptr, u_ptr, @@ -45,10 +45,10 @@ void ConvertYUVAToARGB_MMX(const uint8* yplane, EmptyRegisterState(); } -void ConvertYUVToRGB32_SSE(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYUVToRGB32_SSE(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -57,10 +57,10 @@ void ConvertYUVToRGB32_SSE(const uint8* yplane, YUVType yuv_type) { unsigned int y_shift = GetVerticalShift(yuv_type); for (int y = 0; y < height; ++y) { - uint8* rgb_row = rgbframe + y * rgbstride; - const uint8* y_ptr = yplane + y * ystride; - const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; - const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; + uint8_t* rgb_row = rgbframe + y * rgbstride; + const uint8_t* y_ptr = yplane + y * ystride; + const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; + const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; ConvertYUVToRGB32Row_SSE(y_ptr, u_ptr, diff --git a/media/base/simd/filter_yuv.h b/media/base/simd/filter_yuv.h index 41851bc..af30bd1 100644 --- a/media/base/simd/filter_yuv.h +++ b/media/base/simd/filter_yuv.h @@ -5,7 +5,8 @@ #ifndef MEDIA_BASE_SIMD_FILTER_YUV_H_ #define MEDIA_BASE_SIMD_FILTER_YUV_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/base/media_export.h" namespace media { @@ -13,17 +14,17 @@ namespace media { // These methods are exported for testing purposes only. Library users should // only call the methods listed in yuv_convert.h. -MEDIA_EXPORT void FilterYUVRows_C(uint8* ybuf, - const uint8* y0_ptr, - const uint8* y1_ptr, +MEDIA_EXPORT void FilterYUVRows_C(uint8_t* ybuf, + const uint8_t* y0_ptr, + const uint8_t* y1_ptr, int source_width, - uint8 source_y_fraction); + uint8_t source_y_fraction); -MEDIA_EXPORT void FilterYUVRows_SSE2(uint8* ybuf, - const uint8* y0_ptr, - const uint8* y1_ptr, +MEDIA_EXPORT void FilterYUVRows_SSE2(uint8_t* ybuf, + const uint8_t* y0_ptr, + const uint8_t* y1_ptr, int source_width, - uint8 source_y_fraction); + uint8_t source_y_fraction); } // namespace media diff --git a/media/base/simd/filter_yuv_c.cc b/media/base/simd/filter_yuv_c.cc index 3411208..2a19a68 100644 --- a/media/base/simd/filter_yuv_c.cc +++ b/media/base/simd/filter_yuv_c.cc @@ -6,12 +6,15 @@ namespace media { -void FilterYUVRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, - int source_width, uint8 source_y_fraction) { - uint8 y1_fraction = source_y_fraction; - uint16 y0_fraction = 256 - y1_fraction; - uint8* end = ybuf + source_width; - uint8* rounded_end = ybuf + (source_width & ~7); +void FilterYUVRows_C(uint8_t* ybuf, + const uint8_t* y0_ptr, + const uint8_t* y1_ptr, + int source_width, + uint8_t source_y_fraction) { + uint8_t y1_fraction = source_y_fraction; + uint16_t y0_fraction = 256 - y1_fraction; + uint8_t* end = ybuf + source_width; + uint8_t* rounded_end = ybuf + (source_width & ~7); while (ybuf < rounded_end) { ybuf[0] = (y0_ptr[0] * y0_fraction + y1_ptr[0] * y1_fraction) >> 8; diff --git a/media/base/simd/filter_yuv_sse2.cc b/media/base/simd/filter_yuv_sse2.cc index b30f8d7..36842c6 100644 --- a/media/base/simd/filter_yuv_sse2.cc +++ b/media/base/simd/filter_yuv_sse2.cc @@ -13,11 +13,11 @@ namespace media { -void FilterYUVRows_SSE2(uint8* dest, - const uint8* src0, - const uint8* src1, +void FilterYUVRows_SSE2(uint8_t* dest, + const uint8_t* src0, + const uint8_t* src1, int width, - uint8 fraction) { + uint8_t fraction) { int pixel = 0; // Process the unaligned bytes first. diff --git a/media/base/stream_parser.h b/media/base/stream_parser.h index b072e73..0554d29 100644 --- a/media/base/stream_parser.h +++ b/media/base/stream_parser.h @@ -106,7 +106,7 @@ class MEDIA_EXPORT StreamParser { // First parameter - The type of the initialization data associated with the // stream. // Second parameter - The initialization data associated with the stream. - typedef base::Callback<void(EmeInitDataType, const std::vector<uint8>&)> + typedef base::Callback<void(EmeInitDataType, const std::vector<uint8_t>&)> EncryptedMediaInitDataCB; StreamParser(); @@ -135,7 +135,7 @@ class MEDIA_EXPORT StreamParser { // Called when there is new data to parse. // // Returns true if the parse succeeds. - virtual bool Parse(const uint8* buf, int size) = 0; + virtual bool Parse(const uint8_t* buf, int size) = 0; private: DISALLOW_COPY_AND_ASSIGN(StreamParser); diff --git a/media/base/stream_parser_buffer.cc b/media/base/stream_parser_buffer.cc index a9bb775..9577821 100644 --- a/media/base/stream_parser_buffer.cc +++ b/media/base/stream_parser_buffer.cc @@ -46,7 +46,10 @@ scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { } scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( - const uint8* data, int data_size, bool is_key_frame, Type type, + const uint8_t* data, + int data_size, + bool is_key_frame, + Type type, TrackId track_id) { return make_scoped_refptr( new StreamParserBuffer(data, data_size, NULL, 0, is_key_frame, type, @@ -54,9 +57,13 @@ scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( } scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( - const uint8* data, int data_size, - const uint8* side_data, int side_data_size, - bool is_key_frame, Type type, TrackId track_id) { + const uint8_t* data, + int data_size, + const uint8_t* side_data, + int side_data_size, + bool is_key_frame, + Type type, + TrackId track_id) { return make_scoped_refptr( new StreamParserBuffer(data, data_size, side_data, side_data_size, is_key_frame, type, track_id)); @@ -74,9 +81,9 @@ void StreamParserBuffer::SetDecodeTimestamp(DecodeTimestamp timestamp) { preroll_buffer_->SetDecodeTimestamp(timestamp); } -StreamParserBuffer::StreamParserBuffer(const uint8* data, +StreamParserBuffer::StreamParserBuffer(const uint8_t* data, int data_size, - const uint8* side_data, + const uint8_t* side_data, int side_data_size, bool is_key_frame, Type type, diff --git a/media/base/stream_parser_buffer.h b/media/base/stream_parser_buffer.h index 38460f4..06b0c0d 100644 --- a/media/base/stream_parser_buffer.h +++ b/media/base/stream_parser_buffer.h @@ -60,19 +60,17 @@ class DecodeTimestamp { return DecodeTimestamp(ts_ - rhs); } - int64 operator/(const base::TimeDelta& rhs) const { - return ts_ / rhs; - } + int64_t operator/(const base::TimeDelta& rhs) const { return ts_ / rhs; } static DecodeTimestamp FromSecondsD(double seconds) { return DecodeTimestamp(base::TimeDelta::FromSecondsD(seconds)); } - static DecodeTimestamp FromMilliseconds(int64 milliseconds) { + static DecodeTimestamp FromMilliseconds(int64_t milliseconds) { return DecodeTimestamp(base::TimeDelta::FromMilliseconds(milliseconds)); } - static DecodeTimestamp FromMicroseconds(int64 microseconds) { + static DecodeTimestamp FromMicroseconds(int64_t microseconds) { return DecodeTimestamp(base::TimeDelta::FromMicroseconds(microseconds)); } @@ -83,8 +81,8 @@ class DecodeTimestamp { } double InSecondsF() const { return ts_.InSecondsF(); } - int64 InMilliseconds() const { return ts_.InMilliseconds(); } - int64 InMicroseconds() const { return ts_.InMicroseconds(); } + int64_t InMilliseconds() const { return ts_.InMilliseconds(); } + int64_t InMicroseconds() const { return ts_.InMicroseconds(); } // TODO(acolwell): Remove once all the hacks are gone. This method is called // by hacks where a decode time is being used as a presentation time. @@ -110,13 +108,18 @@ class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { static scoped_refptr<StreamParserBuffer> CreateEOSBuffer(); - static scoped_refptr<StreamParserBuffer> CopyFrom( - const uint8* data, int data_size, bool is_key_frame, Type type, - TrackId track_id); - static scoped_refptr<StreamParserBuffer> CopyFrom( - const uint8* data, int data_size, - const uint8* side_data, int side_data_size, bool is_key_frame, Type type, - TrackId track_id); + static scoped_refptr<StreamParserBuffer> CopyFrom(const uint8_t* data, + int data_size, + bool is_key_frame, + Type type, + TrackId track_id); + static scoped_refptr<StreamParserBuffer> CopyFrom(const uint8_t* data, + int data_size, + const uint8_t* side_data, + int side_data_size, + bool is_key_frame, + Type type, + TrackId track_id); // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the // value will be taken from the normal timestamp. @@ -179,9 +182,12 @@ class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { } private: - StreamParserBuffer(const uint8* data, int data_size, - const uint8* side_data, int side_data_size, - bool is_key_frame, Type type, + StreamParserBuffer(const uint8_t* data, + int data_size, + const uint8_t* side_data, + int side_data_size, + bool is_key_frame, + Type type, TrackId track_id); ~StreamParserBuffer() override; diff --git a/media/base/stream_parser_unittest.cc b/media/base/stream_parser_unittest.cc index 2219dd1..927c60f 100644 --- a/media/base/stream_parser_unittest.cc +++ b/media/base/stream_parser_unittest.cc @@ -5,7 +5,6 @@ #include <algorithm> #include <sstream> -#include "base/basictypes.h" #include "media/base/stream_parser.h" #include "media/base/stream_parser_buffer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -17,7 +16,7 @@ typedef StreamParser::BufferQueue BufferQueue; typedef StreamParser::TextBufferQueueMap TextBufferQueueMap; const int kEnd = -1; -const uint8 kFakeData[] = { 0xFF }; +const uint8_t kFakeData[] = {0xFF}; const TrackId kAudioTrackId = 0; const TrackId kVideoTrackId = 1; const TrackId kTextTrackIdA = 2; diff --git a/media/base/test_data_util.cc b/media/base/test_data_util.cc index d775376..2278b81 100644 --- a/media/base/test_data_util.cc +++ b/media/base/test_data_util.cc @@ -39,7 +39,7 @@ std::string GetURLQueryString(const base::StringPairs& query_params) { scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) { base::FilePath file_path = GetTestDataFilePath(name); - int64 tmp = 0; + int64_t tmp = 0; CHECK(base::GetFileSize(file_path, &tmp)) << "Failed to get file size for '" << name << "'"; diff --git a/media/base/test_data_util.h b/media/base/test_data_util.h index d9f179e..a71e2a5 100644 --- a/media/base/test_data_util.h +++ b/media/base/test_data_util.h @@ -9,7 +9,6 @@ #include <utility> #include <vector> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/base/test_helpers.cc b/media/base/test_helpers.cc index 84074bf..c4964b1 100644 --- a/media/base/test_helpers.cc +++ b/media/base/test_helpers.cc @@ -216,9 +216,9 @@ scoped_refptr<AudioBuffer> MakeAudioBuffer(SampleFormat format, type increment, \ size_t frames, \ base::TimeDelta start_time) -DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(uint8); -DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int16); -DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int32); +DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(uint8_t); +DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int16_t); +DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(int32_t); DEFINE_MAKE_AUDIO_BUFFER_INSTANCE(float); static const char kFakeVideoBufferHeader[] = "FakeVideoBufferForTest"; @@ -232,9 +232,9 @@ scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( pickle.WriteInt(config.coded_size().height()); pickle.WriteInt64(timestamp.InMilliseconds()); - scoped_refptr<DecoderBuffer> buffer = DecoderBuffer::CopyFrom( - static_cast<const uint8*>(pickle.data()), - static_cast<int>(pickle.size())); + scoped_refptr<DecoderBuffer> buffer = + DecoderBuffer::CopyFrom(static_cast<const uint8_t*>(pickle.data()), + static_cast<int>(pickle.size())); buffer->set_timestamp(timestamp); buffer->set_duration(duration); buffer->set_is_key_frame(true); diff --git a/media/base/test_helpers.h b/media/base/test_helpers.h index f9df1bd..ff89c59a 100644 --- a/media/base/test_helpers.h +++ b/media/base/test_helpers.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_TEST_HELPERS_H_ #define MEDIA_BASE_TEST_HELPERS_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "media/base/channel_layout.h" #include "media/base/media_log.h" diff --git a/media/base/time_delta_interpolator.cc b/media/base/time_delta_interpolator.cc index b65bdbc..a361b35 100644 --- a/media/base/time_delta_interpolator.cc +++ b/media/base/time_delta_interpolator.cc @@ -65,8 +65,8 @@ base::TimeDelta TimeDeltaInterpolator::GetInterpolatedTime() { if (!interpolating_) return lower_bound_; - int64 now_us = (tick_clock_->NowTicks() - reference_).InMicroseconds(); - now_us = static_cast<int64>(now_us * playback_rate_); + int64_t now_us = (tick_clock_->NowTicks() - reference_).InMicroseconds(); + now_us = static_cast<int64_t>(now_us * playback_rate_); base::TimeDelta interpolated_time = lower_bound_ + base::TimeDelta::FromMicroseconds(now_us); diff --git a/media/base/time_delta_interpolator.h b/media/base/time_delta_interpolator.h index 7dbda69..f05a74c 100644 --- a/media/base/time_delta_interpolator.h +++ b/media/base/time_delta_interpolator.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ #define MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ -#include "base/basictypes.h" #include "base/time/time.h" #include "media/base/media_export.h" diff --git a/media/base/user_input_monitor_linux.cc b/media/base/user_input_monitor_linux.cc index 2be9b18..5fc0dc9 100644 --- a/media/base/user_input_monitor_linux.cc +++ b/media/base/user_input_monitor_linux.cc @@ -9,7 +9,6 @@ #define XK_MISCELLANY #include <X11/keysymdef.h> -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" diff --git a/media/base/user_input_monitor_unittest.cc b/media/base/user_input_monitor_unittest.cc index b172048..3f0ccd3 100644 --- a/media/base/user_input_monitor_unittest.cc +++ b/media/base/user_input_monitor_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" diff --git a/media/base/user_input_monitor_win.cc b/media/base/user_input_monitor_win.cc index 19d27b7..3cab46d 100644 --- a/media/base/user_input_monitor_win.cc +++ b/media/base/user_input_monitor_win.cc @@ -65,7 +65,7 @@ class UserInputMonitorWinCore // These members are only accessed on the UI thread. scoped_ptr<base::win::MessageWindow> window_; - uint8 events_monitored_; + uint8_t events_monitored_; KeyboardEventCounter counter_; DISALLOW_COPY_AND_ASSIGN(UserInputMonitorWinCore); @@ -187,7 +187,7 @@ LRESULT UserInputMonitorWinCore::OnInput(HRAWINPUT input_handle) { DCHECK_EQ(0u, result); // Retrieve the input record itself. - scoped_ptr<uint8[]> buffer(new uint8[size]); + scoped_ptr<uint8_t[]> buffer(new uint8_t[size]); RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get()); result = GetRawInputData( input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER)); diff --git a/media/base/video_decoder_config.h b/media/base/video_decoder_config.h index 3de0d2f..82ea665 100644 --- a/media/base/video_decoder_config.h +++ b/media/base/video_decoder_config.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/base/video_codecs.h" #include "media/base/video_types.h" diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index f58e4ab..c0e8996 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -279,7 +279,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalData( const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::TimeDelta timestamp) { return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size, @@ -293,7 +293,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalSharedMemory( const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::SharedMemoryHandle handle, size_t data_offset, @@ -309,12 +309,12 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvData( const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - int32 y_stride, - int32 u_stride, - int32 v_stride, - uint8* y_data, - uint8* u_data, - uint8* v_data, + int32_t y_stride, + int32_t u_stride, + int32_t v_stride, + uint8_t* y_data, + uint8_t* u_data, + uint8_t* v_data, base::TimeDelta timestamp) { const StorageType storage = STORAGE_UNOWNED_MEMORY; if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { @@ -341,12 +341,12 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvGpuMemoryBuffers( const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - int32 y_stride, - int32 u_stride, - int32 v_stride, - uint8* y_data, - uint8* u_data, - uint8* v_data, + int32_t y_stride, + int32_t u_stride, + int32_t v_stride, + uint8_t* y_data, + uint8_t* u_data, + uint8_t* v_data, const gfx::GpuMemoryBufferHandle& y_handle, const gfx::GpuMemoryBufferHandle& u_handle, const gfx::GpuMemoryBufferHandle& v_handle, @@ -510,7 +510,9 @@ scoped_refptr<VideoFrame> VideoFrame::CreateEOSFrame() { // static scoped_refptr<VideoFrame> VideoFrame::CreateColorFrame( const gfx::Size& size, - uint8 y, uint8 u, uint8 v, + uint8_t y, + uint8_t u, + uint8_t v, base::TimeDelta timestamp) { scoped_refptr<VideoFrame> frame = CreateFrame(PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, timestamp); @@ -520,8 +522,8 @@ scoped_refptr<VideoFrame> VideoFrame::CreateColorFrame( // static scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { - const uint8 kBlackY = 0x00; - const uint8 kBlackUV = 0x80; + const uint8_t kBlackY = 0x00; + const uint8_t kBlackUV = 0x80; const base::TimeDelta kZero; return CreateColorFrame(size, kBlackY, kBlackUV, kBlackUV, kZero); } @@ -529,9 +531,9 @@ scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { // static scoped_refptr<VideoFrame> VideoFrame::CreateTransparentFrame( const gfx::Size& size) { - const uint8 kBlackY = 0x00; - const uint8 kBlackUV = 0x00; - const uint8 kTransparentA = 0x00; + const uint8_t kBlackY = 0x00; + const uint8_t kBlackUV = 0x00; + const uint8_t kTransparentA = 0x00; const base::TimeDelta kZero; scoped_refptr<VideoFrame> frame = CreateFrame(PIXEL_FORMAT_YV12A, size, gfx::Rect(size), size, kZero); @@ -695,19 +697,19 @@ int VideoFrame::rows(size_t plane) const { return Rows(plane, format_, coded_size_.height()); } -const uint8* VideoFrame::data(size_t plane) const { +const uint8_t* VideoFrame::data(size_t plane) const { DCHECK(IsValidPlane(plane, format_)); DCHECK(IsMappable()); return data_[plane]; } -uint8* VideoFrame::data(size_t plane) { +uint8_t* VideoFrame::data(size_t plane) { DCHECK(IsValidPlane(plane, format_)); DCHECK(IsMappable()); return data_[plane]; } -const uint8* VideoFrame::visible_data(size_t plane) const { +const uint8_t* VideoFrame::visible_data(size_t plane) const { DCHECK(IsValidPlane(plane, format_)); DCHECK(IsMappable()); @@ -725,8 +727,8 @@ const uint8* VideoFrame::visible_data(size_t plane) const { (offset.x() / subsample.width()); } -uint8* VideoFrame::visible_data(size_t plane) { - return const_cast<uint8*>( +uint8_t* VideoFrame::visible_data(size_t plane) { + return const_cast<uint8_t*>( static_cast<const VideoFrame*>(this)->visible_data(plane)); } @@ -825,7 +827,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalStorage( const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::TimeDelta timestamp, base::SharedMemoryHandle handle, @@ -1006,7 +1008,7 @@ void VideoFrame::AllocateYUV(bool zero_initialize_memory) { DCHECK(IsValidPlane(kUPlane, format_)); data_size += strides_[kUPlane] + kFrameSizePadding; - uint8* data = reinterpret_cast<uint8*>( + uint8_t* data = reinterpret_cast<uint8_t*>( base::AlignedAlloc(data_size, kFrameAddressAlignment)); if (zero_initialize_memory) memset(data, 0, data_size); diff --git a/media/base/video_frame.h b/media/base/video_frame.h index a6ff33a..67f1417 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h @@ -152,7 +152,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::TimeDelta timestamp); @@ -162,7 +162,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::SharedMemoryHandle handle, size_t shared_memory_offset, @@ -175,12 +175,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - int32 y_stride, - int32 u_stride, - int32 v_stride, - uint8* y_data, - uint8* u_data, - uint8* v_data, + int32_t y_stride, + int32_t u_stride, + int32_t v_stride, + uint8_t* y_data, + uint8_t* u_data, + uint8_t* v_data, base::TimeDelta timestamp); // Wraps external YUV data with the given parameters with a VideoFrame. @@ -190,12 +190,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - int32 y_stride, - int32 u_stride, - int32 v_stride, - uint8* y_data, - uint8* u_data, - uint8* v_data, + int32_t y_stride, + int32_t u_stride, + int32_t v_stride, + uint8_t* y_data, + uint8_t* u_data, + uint8_t* v_data, const gfx::GpuMemoryBufferHandle& y_handle, const gfx::GpuMemoryBufferHandle& u_handle, const gfx::GpuMemoryBufferHandle& v_handle, @@ -246,10 +246,11 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { static scoped_refptr<VideoFrame> CreateEOSFrame(); // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). - static scoped_refptr<VideoFrame> CreateColorFrame( - const gfx::Size& size, - uint8 y, uint8 u, uint8 v, - base::TimeDelta timestamp); + static scoped_refptr<VideoFrame> CreateColorFrame(const gfx::Size& size, + uint8_t y, + uint8_t u, + uint8_t v, + base::TimeDelta timestamp); // Allocates YV12 frame based on |size|, and sets its data to the YUV // equivalent of RGB(0,0,0). @@ -329,15 +330,15 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // Returns pointer to the buffer for a given plane, if this is an // IsMappable() frame type. The memory is owned by VideoFrame object and must // not be freed by the caller. - const uint8* data(size_t plane) const; - uint8* data(size_t plane); + const uint8_t* data(size_t plane) const; + uint8_t* data(size_t plane); // Returns pointer to the data in the visible region of the frame, for // IsMappable() storage types. The returned pointer is offsetted into the // plane buffer specified by visible_rect().origin(). Memory is owned by // VideoFrame object and must not be freed by the caller. - const uint8* visible_data(size_t plane) const; - uint8* visible_data(size_t plane); + const uint8_t* visible_data(size_t plane) const; + uint8_t* visible_data(size_t plane); // Returns a mailbox holder for a given texture. // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the @@ -413,7 +414,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, - uint8* data, + uint8_t* data, size_t data_size, base::TimeDelta timestamp, base::SharedMemoryHandle handle, @@ -479,12 +480,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // Array of strides for each plane, typically greater or equal to the width // of the surface divided by the horizontal sampling period. Note that // strides can be negative. - int32 strides_[kMaxPlanes]; + int32_t strides_[kMaxPlanes]; // Array of data pointers to each plane. // TODO(mcasas): we don't know on ctor if we own |data_| or not. After - // refactoring VideoFrame, change to scoped_ptr<uint8, AlignedFreeDeleter>. - uint8* data_[kMaxPlanes]; + // refactoring VideoFrame, change to scoped_ptr<uint8_t, AlignedFreeDeleter>. + uint8_t* data_[kMaxPlanes]; // Native texture mailboxes, if this is a IsTexture() frame. gpu::MailboxHolder mailbox_holders_[kMaxPlanes]; diff --git a/media/base/video_frame_metadata.cc b/media/base/video_frame_metadata.cc index 938a018..af2d36d 100644 --- a/media/base/video_frame_metadata.cc +++ b/media/base/video_frame_metadata.cc @@ -52,7 +52,7 @@ template<class TimeType> void SetTimeValue(VideoFrameMetadata::Key key, const TimeType& value, base::DictionaryValue* dictionary) { - const int64 internal_value = value.ToInternalValue(); + const int64_t internal_value = value.ToInternalValue(); dictionary->SetWithoutPathExpansion( ToInternalKey(key), base::BinaryValue::CreateWithCopiedBuffer( @@ -100,7 +100,7 @@ namespace { template<class TimeType> bool ToTimeValue(const base::BinaryValue& binary_value, TimeType* value) { DCHECK(value); - int64 internal_value; + int64_t internal_value; if (binary_value.GetSize() != sizeof(internal_value)) return false; memcpy(&internal_value, binary_value.GetBuffer(), sizeof(internal_value)); diff --git a/media/base/video_frame_pool_unittest.cc b/media/base/video_frame_pool_unittest.cc index 2d0c120..9abed22 100644 --- a/media/base/video_frame_pool_unittest.cc +++ b/media/base/video_frame_pool_unittest.cc @@ -49,7 +49,7 @@ TEST_F(VideoFramePoolTest, FrameInitializedAndZeroed) { TEST_F(VideoFramePoolTest, SimpleFrameReuse) { scoped_refptr<VideoFrame> frame = CreateFrame(PIXEL_FORMAT_YV12, 10); - const uint8* old_y_data = frame->data(VideoFrame::kYPlane); + const uint8_t* old_y_data = frame->data(VideoFrame::kYPlane); // Clear frame reference to return the frame to the pool. frame = NULL; diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc index 157986f..c697d6f 100644 --- a/media/base/video_frame_unittest.cc +++ b/media/base/video_frame_unittest.cc @@ -25,14 +25,14 @@ void InitializeYV12Frame(VideoFrame* frame, double white_to_black) { EXPECT_EQ(PIXEL_FORMAT_YV12, frame->format()); const int first_black_row = static_cast<int>(frame->coded_size().height() * white_to_black); - uint8* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->data(VideoFrame::kYPlane); for (int row = 0; row < frame->coded_size().height(); ++row) { int color = (row < first_black_row) ? 0xFF : 0x00; memset(y_plane, color, frame->stride(VideoFrame::kYPlane)); y_plane += frame->stride(VideoFrame::kYPlane); } - uint8* u_plane = frame->data(VideoFrame::kUPlane); - uint8* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->data(VideoFrame::kVPlane); for (int row = 0; row < frame->coded_size().height(); row += 2) { memset(u_plane, 0x80, frame->stride(VideoFrame::kUPlane)); memset(v_plane, 0x80, frame->stride(VideoFrame::kVPlane)); @@ -43,7 +43,8 @@ void InitializeYV12Frame(VideoFrame* frame, double white_to_black) { // Given a |yv12_frame| this method converts the YV12 frame to RGBA and // makes sure that all the pixels of the RBG frame equal |expect_rgb_color|. -void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) { +void ExpectFrameColor(media::VideoFrame* yv12_frame, + uint32_t expect_rgb_color) { ASSERT_EQ(PIXEL_FORMAT_YV12, yv12_frame->format()); ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane), yv12_frame->stride(VideoFrame::kVPlane)); @@ -55,7 +56,7 @@ void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) { 0); size_t bytes_per_row = yv12_frame->coded_size().width() * 4u; - uint8* rgb_data = reinterpret_cast<uint8*>( + uint8_t* rgb_data = reinterpret_cast<uint8_t*>( base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() + VideoFrame::kFrameSizePadding, VideoFrame::kFrameAddressAlignment)); @@ -72,8 +73,8 @@ void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) { media::YV12); for (int row = 0; row < yv12_frame->coded_size().height(); ++row) { - uint32* rgb_row_data = reinterpret_cast<uint32*>( - rgb_data + (bytes_per_row * row)); + uint32_t* rgb_row_data = + reinterpret_cast<uint32_t*>(rgb_data + (bytes_per_row * row)); for (int col = 0; col < yv12_frame->coded_size().width(); ++col) { SCOPED_TRACE(base::StringPrintf("Checking (%d, %d)", row, col)); EXPECT_EQ(expect_rgb_color, rgb_row_data[col]); @@ -180,8 +181,8 @@ TEST(VideoFrame, CreateZeroInitializedFrame) { TEST(VideoFrame, CreateBlackFrame) { const int kWidth = 2; const int kHeight = 2; - const uint8 kExpectedYRow[] = { 0, 0 }; - const uint8 kExpectedUVRow[] = { 128 }; + const uint8_t kExpectedYRow[] = {0, 0}; + const uint8_t kExpectedUVRow[] = {128}; scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight)); @@ -199,14 +200,14 @@ TEST(VideoFrame, CreateBlackFrame) { EXPECT_EQ(kHeight, frame->coded_size().height()); // Test frames themselves. - uint8* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->data(VideoFrame::kYPlane); for (int y = 0; y < frame->coded_size().height(); ++y) { EXPECT_EQ(0, memcmp(kExpectedYRow, y_plane, arraysize(kExpectedYRow))); y_plane += frame->stride(VideoFrame::kYPlane); } - uint8* u_plane = frame->data(VideoFrame::kUPlane); - uint8* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->data(VideoFrame::kVPlane); for (int y = 0; y < frame->coded_size().height() / 2; ++y) { EXPECT_EQ(0, memcmp(kExpectedUVRow, u_plane, arraysize(kExpectedUVRow))); EXPECT_EQ(0, memcmp(kExpectedUVRow, v_plane, arraysize(kExpectedUVRow))); @@ -324,7 +325,7 @@ TEST(VideoFrame, gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7); sync_token.SetVerifyFlush(); - uint32 target = 9; + uint32_t target = 9; gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111); release_sync_token.SetVerifyFlush(); diff --git a/media/base/video_renderer_sink.h b/media/base/video_renderer_sink.h index 5a51a73..9dd62d8 100644 --- a/media/base/video_renderer_sink.h +++ b/media/base/video_renderer_sink.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_VIDEO_RENDERER_SINK_H_ #define MEDIA_BASE_VIDEO_RENDERER_SINK_H_ -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" diff --git a/media/base/video_util.cc b/media/base/video_util.cc index 414e57b..c628673 100644 --- a/media/base/video_util.cc +++ b/media/base/video_util.cc @@ -29,9 +29,9 @@ gfx::Size GetNaturalSize(const gfx::Size& visible_size, visible_size.height()); } -void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { +void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { // Fill the Y plane. - uint8* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->data(VideoFrame::kYPlane); int y_rows = frame->rows(VideoFrame::kYPlane); int y_row_bytes = frame->row_bytes(VideoFrame::kYPlane); for (int i = 0; i < y_rows; ++i) { @@ -40,8 +40,8 @@ void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { } // Fill the U and V planes. - uint8* u_plane = frame->data(VideoFrame::kUPlane); - uint8* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->data(VideoFrame::kVPlane); int uv_rows = frame->rows(VideoFrame::kUPlane); int u_row_bytes = frame->row_bytes(VideoFrame::kUPlane); int v_row_bytes = frame->row_bytes(VideoFrame::kVPlane); @@ -53,12 +53,12 @@ void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { } } -void FillYUVA(VideoFrame* frame, uint8 y, uint8 u, uint8 v, uint8 a) { +void FillYUVA(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v, uint8_t a) { // Fill Y, U and V planes. FillYUV(frame, y, u, v); // Fill the A plane. - uint8* a_plane = frame->data(VideoFrame::kAPlane); + uint8_t* a_plane = frame->data(VideoFrame::kAPlane); int a_rows = frame->rows(VideoFrame::kAPlane); int a_row_bytes = frame->row_bytes(VideoFrame::kAPlane); for (int i = 0; i < a_rows; ++i) { @@ -70,8 +70,8 @@ void FillYUVA(VideoFrame* frame, uint8 y, uint8 u, uint8 v, uint8 a) { static void LetterboxPlane(VideoFrame* frame, int plane, const gfx::Rect& view_area, - uint8 fill_byte) { - uint8* ptr = frame->data(plane); + uint8_t fill_byte) { + uint8_t* ptr = frame->data(plane); const int rows = frame->rows(plane); const int row_bytes = frame->row_bytes(plane); const int stride = frame->stride(plane); @@ -125,14 +125,13 @@ void LetterboxYUV(VideoFrame* frame, const gfx::Rect& view_area) { LetterboxPlane(frame, VideoFrame::kVPlane, half_view_area, 0x80); } -void RotatePlaneByPixels( - const uint8* src, - uint8* dest, - int width, - int height, - int rotation, // Clockwise. - bool flip_vert, - bool flip_horiz) { +void RotatePlaneByPixels(const uint8_t* src, + uint8_t* dest, + int width, + int height, + int rotation, // Clockwise. + bool flip_vert, + bool flip_horiz) { DCHECK((width > 0) && (height > 0) && ((width & 1) == 0) && ((height & 1) == 0) && (rotation >= 0) && (rotation < 360) && (rotation % 90 == 0)); @@ -215,8 +214,8 @@ void RotatePlaneByPixels( // Copy pixels. for (int row = 0; row < num_rows; ++row) { - const uint8* src_ptr = src; - uint8* dest_ptr = dest; + const uint8_t* src_ptr = src; + uint8_t* dest_ptr = dest; for (int col = 0; col < num_cols; ++col) { *dest_ptr = *src_ptr++; dest_ptr += dest_col_step; @@ -227,10 +226,10 @@ void RotatePlaneByPixels( } // Helper function to return |a| divided by |b|, rounded to the nearest integer. -static int RoundedDivision(int64 a, int b) { +static int RoundedDivision(int64_t a, int b) { DCHECK_GE(a, 0); DCHECK_GT(b, 0); - base::CheckedNumeric<uint64> result(a); + base::CheckedNumeric<uint64_t> result(a); result += b / 2; result /= b; return base::checked_cast<int>(result.ValueOrDie()); @@ -245,8 +244,8 @@ static gfx::Size ScaleSizeToTarget(const gfx::Size& size, if (size.IsEmpty()) return gfx::Size(); // Corner case: Aspect ratio is undefined. - const int64 x = static_cast<int64>(size.width()) * target.height(); - const int64 y = static_cast<int64>(size.height()) * target.width(); + const int64_t x = static_cast<int64_t>(size.width()) * target.height(); + const int64_t y = static_cast<int64_t>(size.height()) * target.width(); const bool use_target_width = fit_within_target ? (y < x) : (x < y); return use_target_width ? gfx::Size(target.width(), RoundedDivision(y, size.width())) : @@ -280,14 +279,14 @@ gfx::Size PadToMatchAspectRatio(const gfx::Size& size, if (target.IsEmpty()) return gfx::Size(); // Aspect ratio is undefined. - const int64 x = static_cast<int64>(size.width()) * target.height(); - const int64 y = static_cast<int64>(size.height()) * target.width(); + const int64_t x = static_cast<int64_t>(size.width()) * target.height(); + const int64_t y = static_cast<int64_t>(size.height()) * target.width(); if (x < y) return gfx::Size(RoundedDivision(y, target.height()), size.height()); return gfx::Size(size.width(), RoundedDivision(x, target.width())); } -void CopyRGBToVideoFrame(const uint8* source, +void CopyRGBToVideoFrame(const uint8_t* source, int stride, const gfx::Rect& region_in_frame, VideoFrame* frame) { diff --git a/media/base/video_util.h b/media/base/video_util.h index 77c6523..da11084 100644 --- a/media/base/video_util.h +++ b/media/base/video_util.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BASE_VIDEO_UTIL_H_ #define MEDIA_BASE_VIDEO_UTIL_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" @@ -20,14 +19,14 @@ MEDIA_EXPORT gfx::Size GetNaturalSize(const gfx::Size& visible_size, int aspect_ratio_denominator); // Fills |frame| containing YUV data to the given color values. -MEDIA_EXPORT void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v); +MEDIA_EXPORT void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v); // Fills |frame| containing YUVA data with the given color values. MEDIA_EXPORT void FillYUVA(VideoFrame* frame, - uint8 y, - uint8 u, - uint8 v, - uint8 a); + uint8_t y, + uint8_t u, + uint8_t v, + uint8_t a); // Creates a border in |frame| such that all pixels outside of // |view_area| are black. The size and position of |view_area| @@ -47,14 +46,13 @@ MEDIA_EXPORT void LetterboxYUV(VideoFrame* frame, // from column 80 through 559. The leftmost and rightmost 80 columns are // ignored for both |src| and |dest|. // The caller is responsible for blanking out the margin area. -MEDIA_EXPORT void RotatePlaneByPixels( - const uint8* src, - uint8* dest, - int width, - int height, - int rotation, // Clockwise. - bool flip_vert, - bool flip_horiz); +MEDIA_EXPORT void RotatePlaneByPixels(const uint8_t* src, + uint8_t* dest, + int width, + int height, + int rotation, // Clockwise. + bool flip_vert, + bool flip_horiz); // Return the largest centered rectangle with the same aspect ratio of |content| // that fits entirely inside of |bounds|. If |content| is empty, its aspect @@ -87,7 +85,7 @@ MEDIA_EXPORT gfx::Size PadToMatchAspectRatio(const gfx::Size& size, // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. // Fills the regions outside |region_in_frame| with black. -MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, +MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8_t* source, int stride, const gfx::Rect& region_in_frame, VideoFrame* frame); diff --git a/media/base/video_util_unittest.cc b/media/base/video_util_unittest.cc index ba53a58..3ff2302 100644 --- a/media/base/video_util_unittest.cc +++ b/media/base/video_util_unittest.cc @@ -31,9 +31,9 @@ class VideoUtilTest : public testing::Test { u_stride_ = u_stride; v_stride_ = v_stride; - y_plane_.reset(new uint8[y_stride * height]); - u_plane_.reset(new uint8[u_stride * height / 2]); - v_plane_.reset(new uint8[v_stride * height / 2]); + y_plane_.reset(new uint8_t[y_stride * height]); + u_plane_.reset(new uint8_t[u_stride * height / 2]); + v_plane_.reset(new uint8_t[v_stride * height / 2]); } void CreateDestinationFrame(int width, int height) { @@ -43,9 +43,9 @@ class VideoUtilTest : public testing::Test { } private: - scoped_ptr<uint8[]> y_plane_; - scoped_ptr<uint8[]> u_plane_; - scoped_ptr<uint8[]> v_plane_; + scoped_ptr<uint8_t[]> y_plane_; + scoped_ptr<uint8_t[]> u_plane_; + scoped_ptr<uint8_t[]> v_plane_; int height_; int y_stride_; @@ -88,162 +88,86 @@ TEST_F(VideoUtilTest, GetNaturalSize) { namespace { -uint8 src6x4[] = { - 0, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23 -}; +uint8_t src6x4[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; // Target images, name pattern target_rotation_flipV_flipH. -uint8* target6x4_0_n_n = src6x4; +uint8_t* target6x4_0_n_n = src6x4; -uint8 target6x4_0_n_y[] = { - 5, 4, 3, 2, 1, 0, - 11, 10, 9, 8, 7, 6, - 17, 16, 15, 14, 13, 12, - 23, 22, 21, 20, 19, 18 -}; +uint8_t target6x4_0_n_y[] = {5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, + 17, 16, 15, 14, 13, 12, 23, 22, 21, 20, 19, 18}; -uint8 target6x4_0_y_n[] = { - 18, 19, 20, 21, 22, 23, - 12, 13, 14, 15, 16, 17, - 6, 7, 8, 9, 10, 11, - 0, 1, 2, 3, 4, 5 -}; +uint8_t target6x4_0_y_n[] = {18, 19, 20, 21, 22, 23, 12, 13, 14, 15, 16, 17, + 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5}; -uint8 target6x4_0_y_y[] = { - 23, 22, 21, 20, 19, 18, - 17, 16, 15, 14, 13, 12, - 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0 -}; +uint8_t target6x4_0_y_y[] = {23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, + 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; -uint8 target6x4_90_n_n[] = { - 255, 19, 13, 7, 1, 255, - 255, 20, 14, 8, 2, 255, - 255, 21, 15, 9, 3, 255, - 255, 22, 16, 10, 4, 255 -}; +uint8_t target6x4_90_n_n[] = {255, 19, 13, 7, 1, 255, 255, 20, 14, 8, 2, 255, + 255, 21, 15, 9, 3, 255, 255, 22, 16, 10, 4, 255}; -uint8 target6x4_90_n_y[] = { - 255, 1, 7, 13, 19, 255, - 255, 2, 8, 14, 20, 255, - 255, 3, 9, 15, 21, 255, - 255, 4, 10, 16, 22, 255 -}; +uint8_t target6x4_90_n_y[] = {255, 1, 7, 13, 19, 255, 255, 2, 8, 14, 20, 255, + 255, 3, 9, 15, 21, 255, 255, 4, 10, 16, 22, 255}; -uint8 target6x4_90_y_n[] = { - 255, 22, 16, 10, 4, 255, - 255, 21, 15, 9, 3, 255, - 255, 20, 14, 8, 2, 255, - 255, 19, 13, 7, 1, 255 -}; +uint8_t target6x4_90_y_n[] = {255, 22, 16, 10, 4, 255, 255, 21, 15, 9, 3, 255, + 255, 20, 14, 8, 2, 255, 255, 19, 13, 7, 1, 255}; -uint8 target6x4_90_y_y[] = { - 255, 4, 10, 16, 22, 255, - 255, 3, 9, 15, 21, 255, - 255, 2, 8, 14, 20, 255, - 255, 1, 7, 13, 19, 255 -}; +uint8_t target6x4_90_y_y[] = {255, 4, 10, 16, 22, 255, 255, 3, 9, 15, 21, 255, + 255, 2, 8, 14, 20, 255, 255, 1, 7, 13, 19, 255}; -uint8* target6x4_180_n_n = target6x4_0_y_y; -uint8* target6x4_180_n_y = target6x4_0_y_n; -uint8* target6x4_180_y_n = target6x4_0_n_y; -uint8* target6x4_180_y_y = target6x4_0_n_n; - -uint8* target6x4_270_n_n = target6x4_90_y_y; -uint8* target6x4_270_n_y = target6x4_90_y_n; -uint8* target6x4_270_y_n = target6x4_90_n_y; -uint8* target6x4_270_y_y = target6x4_90_n_n; - -uint8 src4x6[] = { - 0, 1, 2, 3, - 4, 5, 6, 7, - 8, 9, 10, 11, - 12, 13, 14, 15, - 16, 17, 18, 19, - 20, 21, 22, 23 -}; +uint8_t* target6x4_180_n_n = target6x4_0_y_y; +uint8_t* target6x4_180_n_y = target6x4_0_y_n; +uint8_t* target6x4_180_y_n = target6x4_0_n_y; +uint8_t* target6x4_180_y_y = target6x4_0_n_n; -uint8* target4x6_0_n_n = src4x6; +uint8_t* target6x4_270_n_n = target6x4_90_y_y; +uint8_t* target6x4_270_n_y = target6x4_90_y_n; +uint8_t* target6x4_270_y_n = target6x4_90_n_y; +uint8_t* target6x4_270_y_y = target6x4_90_n_n; -uint8 target4x6_0_n_y[] = { - 3, 2, 1, 0, - 7, 6, 5, 4, - 11, 10, 9, 8, - 15, 14, 13, 12, - 19, 18, 17, 16, - 23, 22, 21, 20 -}; +uint8_t src4x6[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; -uint8 target4x6_0_y_n[] = { - 20, 21, 22, 23, - 16, 17, 18, 19, - 12, 13, 14, 15, - 8, 9, 10, 11, - 4, 5, 6, 7, - 0, 1, 2, 3 -}; +uint8_t* target4x6_0_n_n = src4x6; -uint8 target4x6_0_y_y[] = { - 23, 22, 21, 20, - 19, 18, 17, 16, - 15, 14, 13, 12, - 11, 10, 9, 8, - 7, 6, 5, 4, - 3, 2, 1, 0 -}; +uint8_t target4x6_0_n_y[] = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, + 15, 14, 13, 12, 19, 18, 17, 16, 23, 22, 21, 20}; -uint8 target4x6_90_n_n[] = { - 255, 255, 255, 255, - 16, 12, 8, 4, - 17, 13, 9, 5, - 18, 14, 10, 6, - 19, 15, 11, 7, - 255, 255, 255, 255 -}; +uint8_t target4x6_0_y_n[] = {20, 21, 22, 23, 16, 17, 18, 19, 12, 13, 14, 15, + 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3}; -uint8 target4x6_90_n_y[] = { - 255, 255, 255, 255, - 4, 8, 12, 16, - 5, 9, 13, 17, - 6, 10, 14, 18, - 7, 11, 15, 19, - 255, 255, 255, 255 -}; +uint8_t target4x6_0_y_y[] = {23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, + 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; -uint8 target4x6_90_y_n[] = { - 255, 255, 255, 255, - 19, 15, 11, 7, - 18, 14, 10, 6, - 17, 13, 9, 5, - 16, 12, 8, 4, - 255, 255, 255, 255 -}; +uint8_t target4x6_90_n_n[] = {255, 255, 255, 255, 16, 12, 8, 4, + 17, 13, 9, 5, 18, 14, 10, 6, + 19, 15, 11, 7, 255, 255, 255, 255}; -uint8 target4x6_90_y_y[] = { - 255, 255, 255, 255, - 7, 11, 15, 19, - 6, 10, 14, 18, - 5, 9, 13, 17, - 4, 8, 12, 16, - 255, 255, 255, 255 -}; +uint8_t target4x6_90_n_y[] = {255, 255, 255, 255, 4, 8, 12, 16, + 5, 9, 13, 17, 6, 10, 14, 18, + 7, 11, 15, 19, 255, 255, 255, 255}; + +uint8_t target4x6_90_y_n[] = {255, 255, 255, 255, 19, 15, 11, 7, + 18, 14, 10, 6, 17, 13, 9, 5, + 16, 12, 8, 4, 255, 255, 255, 255}; + +uint8_t target4x6_90_y_y[] = {255, 255, 255, 255, 7, 11, 15, 19, + 6, 10, 14, 18, 5, 9, 13, 17, + 4, 8, 12, 16, 255, 255, 255, 255}; -uint8* target4x6_180_n_n = target4x6_0_y_y; -uint8* target4x6_180_n_y = target4x6_0_y_n; -uint8* target4x6_180_y_n = target4x6_0_n_y; -uint8* target4x6_180_y_y = target4x6_0_n_n; +uint8_t* target4x6_180_n_n = target4x6_0_y_y; +uint8_t* target4x6_180_n_y = target4x6_0_y_n; +uint8_t* target4x6_180_y_n = target4x6_0_n_y; +uint8_t* target4x6_180_y_y = target4x6_0_n_n; -uint8* target4x6_270_n_n = target4x6_90_y_y; -uint8* target4x6_270_n_y = target4x6_90_y_n; -uint8* target4x6_270_y_n = target4x6_90_n_y; -uint8* target4x6_270_y_y = target4x6_90_n_n; +uint8_t* target4x6_270_n_n = target4x6_90_y_y; +uint8_t* target4x6_270_n_y = target4x6_90_y_n; +uint8_t* target4x6_270_y_n = target4x6_90_n_y; +uint8_t* target4x6_270_y_y = target4x6_90_n_n; struct VideoRotationTestData { - uint8* src; - uint8* target; + uint8_t* src; + uint8_t* target; int width; int height; int rotation; @@ -299,15 +223,15 @@ class VideoUtilRotationTest : public testing::TestWithParam<VideoRotationTestData> { public: VideoUtilRotationTest() { - dest_.reset(new uint8[GetParam().width * GetParam().height]); + dest_.reset(new uint8_t[GetParam().width * GetParam().height]); } virtual ~VideoUtilRotationTest() {} - uint8* dest_plane() { return dest_.get(); } + uint8_t* dest_plane() { return dest_.get(); } private: - scoped_ptr<uint8[]> dest_; + scoped_ptr<uint8_t[]> dest_; DISALLOW_COPY_AND_ASSIGN(VideoUtilRotationTest); }; @@ -317,7 +241,7 @@ TEST_P(VideoUtilRotationTest, Rotate) { EXPECT_TRUE((rotation >= 0) && (rotation < 360) && (rotation % 90 == 0)); int size = GetParam().width * GetParam().height; - uint8* dest = dest_plane(); + uint8_t* dest = dest_plane(); memset(dest, 255, size); RotatePlaneByPixels(GetParam().src, dest, GetParam().width, diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index 9bae5b3..9fb37fa 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -44,26 +44,23 @@ extern "C" { void EmptyRegisterState_MMX(); } // extern "C" namespace media { -typedef void (*FilterYUVRowsProc)(uint8*, - const uint8*, - const uint8*, - int, - uint8); - -typedef void (*ConvertRGBToYUVProc)(const uint8*, - uint8*, - uint8*, - uint8*, +typedef void ( + *FilterYUVRowsProc)(uint8_t*, const uint8_t*, const uint8_t*, int, uint8_t); + +typedef void (*ConvertRGBToYUVProc)(const uint8_t*, + uint8_t*, + uint8_t*, + uint8_t*, int, int, int, int, int); -typedef void (*ConvertYUVToRGB32Proc)(const uint8*, - const uint8*, - const uint8*, - uint8*, +typedef void (*ConvertYUVToRGB32Proc)(const uint8_t*, + const uint8_t*, + const uint8_t*, + uint8_t*, int, int, int, @@ -71,11 +68,11 @@ typedef void (*ConvertYUVToRGB32Proc)(const uint8*, int, YUVType); -typedef void (*ConvertYUVAToARGBProc)(const uint8*, - const uint8*, - const uint8*, - const uint8*, - uint8*, +typedef void (*ConvertYUVAToARGBProc)(const uint8_t*, + const uint8_t*, + const uint8_t*, + const uint8_t*, + uint8_t*, int, int, int, @@ -84,28 +81,28 @@ typedef void (*ConvertYUVAToARGBProc)(const uint8*, int, YUVType); -typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, - const uint8*, - const uint8*, - uint8*, +typedef void (*ConvertYUVToRGB32RowProc)(const uint8_t*, + const uint8_t*, + const uint8_t*, + uint8_t*, ptrdiff_t, - const int16*); + const int16_t*); -typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, - const uint8*, - const uint8*, - const uint8*, - uint8*, +typedef void (*ConvertYUVAToARGBRowProc)(const uint8_t*, + const uint8_t*, + const uint8_t*, + const uint8_t*, + uint8_t*, ptrdiff_t, - const int16*); + const int16_t*); -typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, - const uint8*, - const uint8*, - uint8*, +typedef void (*ScaleYUVToRGB32RowProc)(const uint8_t*, + const uint8_t*, + const uint8_t*, + uint8_t*, ptrdiff_t, ptrdiff_t, - const int16*); + const int16_t*); static FilterYUVRowsProc g_filter_yuv_rows_proc_ = NULL; static ConvertYUVToRGB32RowProc g_convert_yuv_to_rgb32_row_proc_ = NULL; @@ -116,7 +113,7 @@ static ConvertRGBToYUVProc g_convert_rgb24_to_yuv_proc_ = NULL; static ConvertYUVToRGB32Proc g_convert_yuv_to_rgb32_proc_ = NULL; static ConvertYUVAToARGBProc g_convert_yuva_to_argb_proc_ = NULL; -static const int kYUVToRGBTableSize = 256 * 4 * 4 * sizeof(int16); +static const int kYUVToRGBTableSize = 256 * 4 * 4 * sizeof(int16_t); // base::AlignedMemory has a private operator new(), so wrap it in a struct so // that we can put it in a LazyInstance::Leaky. @@ -129,9 +126,9 @@ typedef base::LazyInstance<YUVToRGBTableWrapper>::Leaky static YUVToRGBTable g_table_rec601 = LAZY_INSTANCE_INITIALIZER; static YUVToRGBTable g_table_jpeg = LAZY_INSTANCE_INITIALIZER; static YUVToRGBTable g_table_rec709 = LAZY_INSTANCE_INITIALIZER; -static const int16* g_table_rec601_ptr = NULL; -static const int16* g_table_jpeg_ptr = NULL; -static const int16* g_table_rec709_ptr = NULL; +static const int16_t* g_table_rec601_ptr = NULL; +static const int16_t* g_table_jpeg_ptr = NULL; +static const int16_t* g_table_rec709_ptr = NULL; // Empty SIMD registers state after using them. void EmptyRegisterStateStub() {} @@ -155,7 +152,7 @@ int GetVerticalShift(YUVType type) { return 0; } -const int16* GetLookupTable(YUVType type) { +const int16_t* GetLookupTable(YUVType type) { switch (type) { case YV12: case YV16: @@ -170,9 +167,9 @@ const int16* GetLookupTable(YUVType type) { } // Populates a pre-allocated lookup table from a YUV->RGB matrix. -const int16* PopulateYUVToRGBTable(const double matrix[3][3], - bool full_range, - int16* table) { +const int16_t* PopulateYUVToRGBTable(const double matrix[3][3], + bool full_range, + int16_t* table) { // We'll have 4 sub-tables that lie contiguous in memory, one for each of Y, // U, V and A. const int kNumTables = 4; @@ -181,7 +178,7 @@ const int16* PopulateYUVToRGBTable(const double matrix[3][3], // Each row has 4 columns, for contributions to each of R, G, B and A. const int kNumColumns = 4; // Each element is a fixed-point (10.6) 16-bit signed value. - const int kElementSize = sizeof(int16); + const int kElementSize = sizeof(int16_t); // Sanity check that our constants here match the size of the statically // allocated tables. @@ -304,14 +301,14 @@ void InitializeCPUSpecificYUVConversions() { }; PopulateYUVToRGBTable(kRec601ConvertMatrix, false, - g_table_rec601.Get().table.data_as<int16>()); + g_table_rec601.Get().table.data_as<int16_t>()); PopulateYUVToRGBTable(kJPEGConvertMatrix, true, - g_table_jpeg.Get().table.data_as<int16>()); + g_table_jpeg.Get().table.data_as<int16_t>()); PopulateYUVToRGBTable(kRec709ConvertMatrix, false, - g_table_rec709.Get().table.data_as<int16>()); - g_table_rec601_ptr = g_table_rec601.Get().table.data_as<int16>(); - g_table_rec709_ptr = g_table_rec709.Get().table.data_as<int16>(); - g_table_jpeg_ptr = g_table_jpeg.Get().table.data_as<int16>(); + g_table_rec709.Get().table.data_as<int16_t>()); + g_table_rec601_ptr = g_table_rec601.Get().table.data_as<int16_t>(); + g_table_rec709_ptr = g_table_rec709.Get().table.data_as<int16_t>(); + g_table_jpeg_ptr = g_table_jpeg.Get().table.data_as<int16_t>(); } // Empty SIMD registers state after using them. @@ -323,10 +320,10 @@ const int kFractionMax = 1 << kFractionBits; const int kFractionMask = ((1 << kFractionBits) - 1); // Scale a frame of YUV to 32 bit ARGB. -void ScaleYUVToRGB32(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int source_width, int source_height, int width, @@ -343,7 +340,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, width == 0 || height == 0) return; - const int16* lookup_table = GetLookupTable(yuv_type); + const int16_t* lookup_table = GetLookupTable(yuv_type); // 4096 allows 3 buffers to fit in 12k. // Helps performance on CPU with 16K L1 cache. @@ -403,11 +400,11 @@ void ScaleYUVToRGB32(const uint8* y_buf, // Need padding because FilterRows() will write 1 to 16 extra pixels // after the end for SSE2 version. - uint8 yuvbuf[16 + kFilterBufferSize * 3 + 16]; - uint8* ybuf = - reinterpret_cast<uint8*>(reinterpret_cast<uintptr_t>(yuvbuf + 15) & ~15); - uint8* ubuf = ybuf + kFilterBufferSize; - uint8* vbuf = ubuf + kFilterBufferSize; + uint8_t yuvbuf[16 + kFilterBufferSize * 3 + 16]; + uint8_t* ybuf = reinterpret_cast<uint8_t*>( + reinterpret_cast<uintptr_t>(yuvbuf + 15) & ~15); + uint8_t* ubuf = ybuf + kFilterBufferSize; + uint8_t* vbuf = ubuf + kFilterBufferSize; // TODO(fbarchard): Fixed point math is off by 1 on negatives. @@ -426,7 +423,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, // TODO(fbarchard): Split this into separate function for better efficiency. for (int y = 0; y < height; ++y) { - uint8* dest_pixel = rgb_buf + y * rgb_pitch; + uint8_t* dest_pixel = rgb_buf + y * rgb_pitch; int source_y_subpixel = source_y_subpixel_accum; source_y_subpixel_accum += source_y_subpixel_delta; if (source_y_subpixel < 0) @@ -434,9 +431,9 @@ void ScaleYUVToRGB32(const uint8* y_buf, else if (source_y_subpixel > ((source_height - 1) << kFractionBits)) source_y_subpixel = (source_height - 1) << kFractionBits; - const uint8* y_ptr = NULL; - const uint8* u_ptr = NULL; - const uint8* v_ptr = NULL; + const uint8_t* y_ptr = NULL; + const uint8_t* u_ptr = NULL; + const uint8_t* v_ptr = NULL; // Apply vertical filtering if necessary. // TODO(fbarchard): Remove memcpy when not necessary. if (filter & media::FILTER_BILINEAR_V) { @@ -446,7 +443,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, v_ptr = v_buf + (source_y >> y_shift) * uv_pitch; // Vertical scaler uses 16.8 fixed point. - uint8 source_y_fraction = (source_y_subpixel & kFractionMask) >> 8; + uint8_t source_y_fraction = (source_y_subpixel & kFractionMask) >> 8; if (source_y_fraction != 0) { g_filter_yuv_rows_proc_( ybuf, y_ptr, y_ptr + y_pitch, source_width, source_y_fraction); @@ -457,7 +454,7 @@ void ScaleYUVToRGB32(const uint8* y_buf, ybuf[source_width] = ybuf[source_width - 1]; int uv_source_width = (source_width + 1) / 2; - uint8 source_uv_fraction; + uint8_t source_uv_fraction; // For formats with half-height UV planes, each even-numbered pixel row // should not interpolate, since the next row to interpolate from should @@ -506,10 +503,10 @@ void ScaleYUVToRGB32(const uint8* y_buf, } // Scale a frame of YV12 to 32 bit ARGB for a specific rectangle. -void ScaleYUVToRGB32WithRect(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32WithRect(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int source_width, int source_height, int dest_width, @@ -531,7 +528,7 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, DCHECK(dest_rect_right > dest_rect_left); DCHECK(dest_rect_bottom > dest_rect_top); - const int16* lookup_table = GetLookupTable(YV12); + const int16_t* lookup_table = GetLookupTable(YV12); // Fixed-point value of vertical and horizontal scale down factor. // Values are in the format 16.16. @@ -582,14 +579,14 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, // write up to 16 bytes past the end of the buffer. const int kFilterBufferSize = 4096; const bool kAvoidUsingOptimizedFilter = source_width > kFilterBufferSize; - uint8 yuv_temp[16 + kFilterBufferSize * 3 + 16]; + uint8_t yuv_temp[16 + kFilterBufferSize * 3 + 16]; // memset() yuv_temp to 0 to avoid bogus warnings when running on Valgrind. if (RunningOnValgrind()) memset(yuv_temp, 0, sizeof(yuv_temp)); - uint8* y_temp = reinterpret_cast<uint8*>( + uint8_t* y_temp = reinterpret_cast<uint8_t*>( reinterpret_cast<uintptr_t>(yuv_temp + 15) & ~15); - uint8* u_temp = y_temp + kFilterBufferSize; - uint8* v_temp = u_temp + kFilterBufferSize; + uint8_t* u_temp = y_temp + kFilterBufferSize; + uint8_t* v_temp = u_temp + kFilterBufferSize; // Move to the top-left pixel of output. rgb_buf += dest_rect_top * rgb_pitch; @@ -604,12 +601,12 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, DCHECK(source_row < source_height); // Locate the first row for each plane for interpolation. - const uint8* y0_ptr = y_buf + y_pitch * source_row + source_y_left; - const uint8* u0_ptr = u_buf + uv_pitch * source_uv_row + source_uv_left; - const uint8* v0_ptr = v_buf + uv_pitch * source_uv_row + source_uv_left; - const uint8* y1_ptr = NULL; - const uint8* u1_ptr = NULL; - const uint8* v1_ptr = NULL; + const uint8_t* y0_ptr = y_buf + y_pitch * source_row + source_y_left; + const uint8_t* u0_ptr = u_buf + uv_pitch * source_uv_row + source_uv_left; + const uint8_t* v0_ptr = v_buf + uv_pitch * source_uv_row + source_uv_left; + const uint8_t* y1_ptr = NULL; + const uint8_t* u1_ptr = NULL; + const uint8_t* v1_ptr = NULL; // Locate the second row for interpolation, being careful not to overrun. if (source_row + 1 >= source_height) { @@ -627,7 +624,7 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, if (!kAvoidUsingOptimizedFilter) { // Vertical scaler uses 16.8 fixed point. - uint8 fraction = (source_top & kFractionMask) >> 8; + uint8_t fraction = (source_top & kFractionMask) >> 8; g_filter_yuv_rows_proc_( y_temp + source_y_left, y0_ptr, y1_ptr, source_y_width, fraction); g_filter_yuv_rows_proc_( @@ -655,10 +652,10 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, g_empty_register_state_proc_(); } -void ConvertRGB32ToYUV(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB32ToYUV(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -675,10 +672,10 @@ void ConvertRGB32ToYUV(const uint8* rgbframe, uvstride); } -void ConvertRGB24ToYUV(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +void ConvertRGB24ToYUV(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, @@ -695,10 +692,10 @@ void ConvertRGB24ToYUV(const uint8* rgbframe, uvstride); } -void ConvertYUVToRGB32(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYUVToRGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -717,11 +714,11 @@ void ConvertYUVToRGB32(const uint8* yplane, yuv_type); } -void ConvertYUVAToARGB(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +void ConvertYUVAToARGB(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, int width, int height, int ystride, diff --git a/media/base/yuv_convert.h b/media/base/yuv_convert.h index 1d35d30..68b2463 100644 --- a/media/base/yuv_convert.h +++ b/media/base/yuv_convert.h @@ -5,7 +5,8 @@ #ifndef MEDIA_BASE_YUV_CONVERT_H_ #define MEDIA_BASE_YUV_CONVERT_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/base/media_export.h" // Visual Studio 2010 does not support MMX intrinsics on x64. @@ -33,7 +34,7 @@ enum YUVType { MEDIA_EXPORT int GetVerticalShift(YUVType type); // Get the appropriate lookup table for a given YUV format. -MEDIA_EXPORT const int16* GetLookupTable(YUVType type); +MEDIA_EXPORT const int16_t* GetLookupTable(YUVType type); // Mirror means flip the image horizontally, as in looking in a mirror. // Rotate happens after mirroring. @@ -60,10 +61,10 @@ MEDIA_EXPORT void InitializeCPUSpecificYUVConversions(); // Convert a frame of YUV to 32 bit ARGB. // Pass in YV16/YV12 depending on source format -MEDIA_EXPORT void ConvertYUVToRGB32(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVToRGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -73,11 +74,11 @@ MEDIA_EXPORT void ConvertYUVToRGB32(const uint8* yplane, // Convert a frame of YUVA to 32 bit ARGB. // Pass in YV12A -MEDIA_EXPORT void ConvertYUVAToARGB(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - const uint8* aplane, - uint8* rgbframe, +MEDIA_EXPORT void ConvertYUVAToARGB(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* rgbframe, int width, int height, int ystride, @@ -88,10 +89,10 @@ MEDIA_EXPORT void ConvertYUVAToARGB(const uint8* yplane, // Scale a frame of YUV to 32 bit ARGB. // Supports rotation and mirroring. -MEDIA_EXPORT void ScaleYUVToRGB32(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ScaleYUVToRGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int source_width, int source_height, int width, @@ -106,10 +107,10 @@ MEDIA_EXPORT void ScaleYUVToRGB32(const uint8* yplane, // Biliner Scale a frame of YV12 to 32 bits ARGB on a specified rectangle. // |yplane|, etc and |rgbframe| should point to the top-left pixels of the // source and destination buffers. -MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int source_width, int source_height, int dest_width, @@ -122,20 +123,20 @@ MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8* yplane, int uvstride, int rgbstride); -MEDIA_EXPORT void ConvertRGB32ToYUV(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB32ToYUV(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, int ystride, int uvstride); -MEDIA_EXPORT void ConvertRGB24ToYUV(const uint8* rgbframe, - uint8* yplane, - uint8* uplane, - uint8* vplane, +MEDIA_EXPORT void ConvertRGB24ToYUV(const uint8_t* rgbframe, + uint8_t* yplane, + uint8_t* uplane, + uint8_t* vplane, int width, int height, int rgbstride, diff --git a/media/base/yuv_convert_perftest.cc b/media/base/yuv_convert_perftest.cc index 2f6d5c1..9266680 100644 --- a/media/base/yuv_convert_perftest.cc +++ b/media/base/yuv_convert_perftest.cc @@ -37,8 +37,8 @@ static const int kPerfTestIterations = 2000; class YUVConvertPerfTest : public testing::Test { public: YUVConvertPerfTest() - : yuv_bytes_(new uint8[kYUV12Size]), - rgb_bytes_converted_(new uint8[kRGBSize]) { + : yuv_bytes_(new uint8_t[kYUV12Size]), + rgb_bytes_converted_(new uint8_t[kRGBSize]) { base::FilePath path; CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &path)); path = path.Append(FILE_PATH_LITERAL("media")) @@ -47,7 +47,7 @@ class YUVConvertPerfTest : public testing::Test { .Append(FILE_PATH_LITERAL("bali_640x360_P420.yuv")); // Verify file size is correct. - int64 actual_size = 0; + int64_t actual_size = 0; base::GetFileSize(path, &actual_size); CHECK_EQ(actual_size, kYUV12Size); @@ -58,8 +58,8 @@ class YUVConvertPerfTest : public testing::Test { CHECK_EQ(bytes_read, kYUV12Size); } - scoped_ptr<uint8[]> yuv_bytes_; - scoped_ptr<uint8[]> rgb_bytes_converted_; + scoped_ptr<uint8_t[]> yuv_bytes_; + scoped_ptr<uint8_t[]> rgb_bytes_converted_; private: DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest); diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc index cf4a511..d8c7e06 100644 --- a/media/base/yuv_convert_unittest.cc +++ b/media/base/yuv_convert_unittest.cc @@ -40,11 +40,11 @@ static const int kSourceAOffset = kSourceYSize * 12 / 8; static const int kYUVA12Size = kSourceYSize * 20 / 8; #endif -// Helper for reading test data into a scoped_ptr<uint8[]>. +// Helper for reading test data into a scoped_ptr<uint8_t[]>. static void ReadData(const base::FilePath::CharType* filename, int expected_size, - scoped_ptr<uint8[]>* data) { - data->reset(new uint8[expected_size]); + scoped_ptr<uint8_t[]>* data) { + data->reset(new uint8_t[expected_size]); base::FilePath path; CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &path)); @@ -54,7 +54,7 @@ static void ReadData(const base::FilePath::CharType* filename, .Append(filename); // Verify file size is correct. - int64 actual_size = 0; + int64_t actual_size = 0; base::GetFileSize(path, &actual_size); CHECK_EQ(actual_size, expected_size); @@ -64,22 +64,22 @@ static void ReadData(const base::FilePath::CharType* filename, CHECK_EQ(bytes_read, expected_size); } -static void ReadYV12Data(scoped_ptr<uint8[]>* data) { +static void ReadYV12Data(scoped_ptr<uint8_t[]>* data) { ReadData(FILE_PATH_LITERAL("bali_640x360_P420.yuv"), kYUV12Size, data); } -static void ReadYV16Data(scoped_ptr<uint8[]>* data) { +static void ReadYV16Data(scoped_ptr<uint8_t[]>* data) { ReadData(FILE_PATH_LITERAL("bali_640x360_P422.yuv"), kYUV16Size, data); } #if !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY) && \ !defined(OS_ANDROID) -static void ReadYV12AData(scoped_ptr<uint8[]>* data) { +static void ReadYV12AData(scoped_ptr<uint8_t[]>* data) { ReadData(FILE_PATH_LITERAL("bali_640x360_P420_alpha.yuv"), kYUVA12Size, data); } #endif -static void ReadRGB24Data(scoped_ptr<uint8[]>* data) { +static void ReadRGB24Data(scoped_ptr<uint8_t[]>* data) { ReadData(FILE_PATH_LITERAL("bali_640x360_RGB24.rgb"), kRGB24Size, data); } @@ -96,9 +96,9 @@ namespace media { TEST(YUVConvertTest, YV12) { // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes; - scoped_ptr<uint8[]> rgb_bytes(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_converted_bytes(new uint8[kRGBSizeConverted]); + scoped_ptr<uint8_t[]> yuv_bytes; + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_converted_bytes(new uint8_t[kRGBSizeConverted]); // Read YUV reference data from file. ReadYV12Data(&yuv_bytes); @@ -118,16 +118,16 @@ TEST(YUVConvertTest, YV12) { SwapRedAndBlueChannels(rgb_converted_bytes.get(), kRGBSizeConverted); #endif - uint32 rgb_hash = DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted, - kDJB2HashSeed); + uint32_t rgb_hash = + DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted, kDJB2HashSeed); EXPECT_EQ(2413171226u, rgb_hash); } TEST(YUVConvertTest, YV16) { // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes; - scoped_ptr<uint8[]> rgb_bytes(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_converted_bytes(new uint8[kRGBSizeConverted]); + scoped_ptr<uint8_t[]> yuv_bytes; + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_converted_bytes(new uint8_t[kRGBSizeConverted]); // Read YUV reference data from file. ReadYV16Data(&yuv_bytes); @@ -147,21 +147,18 @@ TEST(YUVConvertTest, YV16) { SwapRedAndBlueChannels(rgb_converted_bytes.get(), kRGBSizeConverted); #endif - uint32 rgb_hash = DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted, - kDJB2HashSeed); + uint32_t rgb_hash = + DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted, kDJB2HashSeed); EXPECT_EQ(4222342047u, rgb_hash); } struct YUVScaleTestData { - YUVScaleTestData(media::YUVType y, media::ScaleFilter s, uint32 r) - : yuv_type(y), - scale_filter(s), - rgb_hash(r) { - } + YUVScaleTestData(media::YUVType y, media::ScaleFilter s, uint32_t r) + : yuv_type(y), scale_filter(s), rgb_hash(r) {} media::YUVType yuv_type; media::ScaleFilter scale_filter; - uint32 rgb_hash; + uint32_t rgb_hash; }; class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { @@ -178,13 +175,13 @@ class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { break; } - rgb_bytes_.reset(new uint8[kRGBSizeScaled]); + rgb_bytes_.reset(new uint8_t[kRGBSizeScaled]); } // Helpers for getting the proper Y, U and V plane offsets. - uint8* y_plane() { return yuv_bytes_.get(); } - uint8* u_plane() { return yuv_bytes_.get() + kSourceYSize; } - uint8* v_plane() { + uint8_t* y_plane() { return yuv_bytes_.get(); } + uint8_t* u_plane() { return yuv_bytes_.get() + kSourceYSize; } + uint8_t* v_plane() { switch (GetParam().yuv_type) { case media::YV12: case media::YV12J: @@ -196,8 +193,8 @@ class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { return NULL; } - scoped_ptr<uint8[]> yuv_bytes_; - scoped_ptr<uint8[]> rgb_bytes_; + scoped_ptr<uint8_t[]> yuv_bytes_; + scoped_ptr<uint8_t[]> rgb_bytes_; }; TEST_P(YUVScaleTest, NoScale) { @@ -214,7 +211,7 @@ TEST_P(YUVScaleTest, NoScale) { media::ROTATE_0, GetParam().scale_filter); - uint32 yuv_hash = DJB2Hash(rgb_bytes_.get(), kRGBSize, kDJB2HashSeed); + uint32_t yuv_hash = DJB2Hash(rgb_bytes_.get(), kRGBSize, kDJB2HashSeed); media::ConvertYUVToRGB32(y_plane(), // Y u_plane(), // U @@ -226,7 +223,7 @@ TEST_P(YUVScaleTest, NoScale) { kSourceWidth * kBpp, // RGBStride GetParam().yuv_type); - uint32 rgb_hash = DJB2Hash(rgb_bytes_.get(), kRGBSize, kDJB2HashSeed); + uint32_t rgb_hash = DJB2Hash(rgb_bytes_.get(), kRGBSize, kDJB2HashSeed); EXPECT_EQ(yuv_hash, rgb_hash); } @@ -249,7 +246,7 @@ TEST_P(YUVScaleTest, Normal) { SwapRedAndBlueChannels(rgb_bytes_.get(), kRGBSizeScaled); #endif - uint32 rgb_hash = DJB2Hash(rgb_bytes_.get(), kRGBSizeScaled, kDJB2HashSeed); + uint32_t rgb_hash = DJB2Hash(rgb_bytes_.get(), kRGBSizeScaled, kDJB2HashSeed); EXPECT_EQ(GetParam().rgb_hash, rgb_hash); } @@ -313,9 +310,9 @@ INSTANTIATE_TEST_CASE_P( // This tests a known worst case YUV value, and for overflow. TEST(YUVConvertTest, Clamp) { // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes(new uint8[1]); - scoped_ptr<uint8[]> rgb_bytes(new uint8[1]); - scoped_ptr<uint8[]> rgb_converted_bytes(new uint8[1]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[1]); + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[1]); + scoped_ptr<uint8_t[]> rgb_converted_bytes(new uint8_t[1]); // Values that failed previously in bug report. unsigned char y = 255u; @@ -346,8 +343,8 @@ TEST(YUVConvertTest, Clamp) { TEST(YUVConvertTest, RGB24ToYUV) { // Allocate all surfaces. - scoped_ptr<uint8[]> rgb_bytes; - scoped_ptr<uint8[]> yuv_converted_bytes(new uint8[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes; + scoped_ptr<uint8_t[]> yuv_converted_bytes(new uint8_t[kYUV12Size]); // Read RGB24 reference data from file. ReadRGB24Data(&rgb_bytes); @@ -362,17 +359,17 @@ TEST(YUVConvertTest, RGB24ToYUV) { kSourceWidth, // YStride kSourceWidth / 2); // UVStride - uint32 rgb_hash = DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, - kDJB2HashSeed); + uint32_t rgb_hash = + DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, kDJB2HashSeed); EXPECT_EQ(320824432u, rgb_hash); } TEST(YUVConvertTest, RGB32ToYUV) { // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes(new uint8[kRGBSize]); - scoped_ptr<uint8[]> yuv_converted_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_converted_bytes(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_converted_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_converted_bytes(new uint8_t[kRGBSize]); // Read YUV reference data from file. base::FilePath yuv_url; @@ -440,7 +437,7 @@ TEST(YUVConvertTest, DownScaleYUVToRGB32WithRect) { .Append(FILE_PATH_LITERAL("data")) .Append(FILE_PATH_LITERAL("bali_640x360_P420.yuv")); const size_t size_of_yuv = kSourceYSize * 12 / 8; // 12 bpp. - scoped_ptr<uint8[]> yuv_bytes(new uint8[size_of_yuv]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[size_of_yuv]); EXPECT_EQ(static_cast<int>(size_of_yuv), base::ReadFile(yuv_url, reinterpret_cast<char*>(yuv_bytes.get()), @@ -449,7 +446,7 @@ TEST(YUVConvertTest, DownScaleYUVToRGB32WithRect) { // Scale the full frame of YUV to 32 bit ARGB. // The API currently only supports down-scaling, so we don't test up-scaling. const size_t size_of_rgb_scaled = kDownScaledWidth * kDownScaledHeight * kBpp; - scoped_ptr<uint8[]> rgb_scaled_bytes(new uint8[size_of_rgb_scaled]); + scoped_ptr<uint8_t[]> rgb_scaled_bytes(new uint8_t[size_of_rgb_scaled]); gfx::Rect sub_rect(0, 0, kDownScaledWidth, kDownScaledHeight); // We can't compare with the full-frame scaler because it uses slightly @@ -467,9 +464,8 @@ TEST(YUVConvertTest, DownScaleYUVToRGB32WithRect) { kSourceWidth / 2, // UvStride kDownScaledWidth * kBpp); // RgbStride - uint32 rgb_hash_full_rect = DJB2Hash(rgb_scaled_bytes.get(), - size_of_rgb_scaled, - kDJB2HashSeed); + uint32_t rgb_hash_full_rect = + DJB2Hash(rgb_scaled_bytes.get(), size_of_rgb_scaled, kDJB2HashSeed); // Re-scale sub-rectangles and verify the results are the same. int next_sub_rect = 0; @@ -487,9 +483,8 @@ TEST(YUVConvertTest, DownScaleYUVToRGB32WithRect) { kSourceWidth, // YStride kSourceWidth / 2, // UvStride kDownScaledWidth * kBpp); // RgbStride - uint32 rgb_hash_sub_rect = DJB2Hash(rgb_scaled_bytes.get(), - size_of_rgb_scaled, - kDJB2HashSeed); + uint32_t rgb_hash_sub_rect = + DJB2Hash(rgb_scaled_bytes.get(), size_of_rgb_scaled, kDJB2HashSeed); EXPECT_EQ(rgb_hash_full_rect, rgb_hash_sub_rect); @@ -508,10 +503,10 @@ TEST(YUVConvertTest, DownScaleYUVToRGB32WithRect) { #if !defined(OS_ANDROID) TEST(YUVConvertTest, YUVAtoARGB_MMX_MatchReference) { // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes; - scoped_ptr<uint8[]> rgb_bytes(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_converted_bytes(new uint8[kRGBSizeConverted]); - scoped_ptr<uint8[]> rgb_converted_bytes_ref(new uint8[kRGBSizeConverted]); + scoped_ptr<uint8_t[]> yuv_bytes; + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_converted_bytes(new uint8_t[kRGBSizeConverted]); + scoped_ptr<uint8_t[]> rgb_converted_bytes_ref(new uint8_t[kRGBSizeConverted]); // Read YUV reference data from file. ReadYV12AData(&yuv_bytes); @@ -557,10 +552,10 @@ TEST(YUVConvertTest, RGB32ToYUV_SSE2_MatchReference) { } // Allocate all surfaces. - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes(new uint8[kRGBSize]); - scoped_ptr<uint8[]> yuv_converted_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> yuv_reference_bytes(new uint8[kYUV12Size]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_converted_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> yuv_reference_bytes(new uint8_t[kYUV12Size]); ReadYV12Data(&yuv_bytes); @@ -643,9 +638,9 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { return; } - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes_reference(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_bytes_converted(new uint8_t[kRGBSize]); ReadYV12Data(&yuv_bytes); const int kWidth = 167; @@ -677,9 +672,9 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { return; } - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes_reference(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_bytes_converted(new uint8_t[kRGBSize]); ReadYV12Data(&yuv_bytes); const int kWidth = 167; @@ -711,9 +706,9 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { return; } - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes_reference(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_bytes_converted(new uint8_t[kRGBSize]); ReadYV12Data(&yuv_bytes); const int kWidth = 167; @@ -740,8 +735,8 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { #endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD) TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) { - scoped_ptr<uint8[]> src(new uint8[16]); - scoped_ptr<uint8[]> dst(new uint8[16]); + scoped_ptr<uint8_t[]> src(new uint8_t[16]); + scoped_ptr<uint8_t[]> dst(new uint8_t[16]); memset(src.get(), 0xff, 16); memset(dst.get(), 0, 16); @@ -761,8 +756,8 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { return; } - scoped_ptr<uint8[]> src(new uint8[16]); - scoped_ptr<uint8[]> dst(new uint8[16]); + scoped_ptr<uint8_t[]> src(new uint8_t[16]); + scoped_ptr<uint8_t[]> dst(new uint8_t[16]); memset(src.get(), 0xff, 16); memset(dst.get(), 0, 16); @@ -783,9 +778,9 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { } const int kSize = 64; - scoped_ptr<uint8[]> src(new uint8[kSize]); - scoped_ptr<uint8[]> dst_sample(new uint8[kSize]); - scoped_ptr<uint8[]> dst(new uint8[kSize]); + scoped_ptr<uint8_t[]> src(new uint8_t[kSize]); + scoped_ptr<uint8_t[]> dst_sample(new uint8_t[kSize]); + scoped_ptr<uint8_t[]> dst(new uint8_t[kSize]); memset(dst_sample.get(), 0, kSize); memset(dst.get(), 0, kSize); @@ -796,9 +791,8 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { src.get(), src.get(), 37, 128); // Generate an unaligned output address. - uint8* dst_ptr = - reinterpret_cast<uint8*>( - (reinterpret_cast<uintptr_t>(dst.get() + 16) & ~15) + 1); + uint8_t* dst_ptr = reinterpret_cast<uint8_t*>( + (reinterpret_cast<uintptr_t>(dst.get() + 16) & ~15) + 1); media::FilterYUVRows_SSE2(dst_ptr, src.get(), src.get(), 37, 128); media::EmptyRegisterState(); @@ -808,9 +802,9 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { #if defined(ARCH_CPU_X86_64) TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE2_X64) { - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes_reference(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_bytes_converted(new uint8_t[kRGBSize]); ReadYV12Data(&yuv_bytes); const int kWidth = 167; @@ -836,9 +830,9 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE2_X64) { } TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) { - scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); - scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); - scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); + scoped_ptr<uint8_t[]> yuv_bytes(new uint8_t[kYUV12Size]); + scoped_ptr<uint8_t[]> rgb_bytes_reference(new uint8_t[kRGBSize]); + scoped_ptr<uint8_t[]> rgb_bytes_converted(new uint8_t[kRGBSize]); ReadYV12Data(&yuv_bytes); const int kWidth = 167; diff --git a/media/blink/active_loader.h b/media/blink/active_loader.h index e74aedf..5d5d22c 100644 --- a/media/blink/active_loader.h +++ b/media/blink/active_loader.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BLINK_ACTIVE_LOADER_H_ #define MEDIA_BLINK_ACTIVE_LOADER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/blink/media_blink_export.h" diff --git a/media/blink/buffered_data_source.cc b/media/blink/buffered_data_source.cc index 18f364d9..2766aed 100644 --- a/media/blink/buffered_data_source.cc +++ b/media/blink/buffered_data_source.cc @@ -33,7 +33,9 @@ namespace media { class BufferedDataSource::ReadOperation { public: - ReadOperation(int64 position, int size, uint8* data, + ReadOperation(int64_t position, + int size, + uint8_t* data, const DataSource::ReadCB& callback); ~ReadOperation(); @@ -45,23 +47,25 @@ class BufferedDataSource::ReadOperation { int retries() { return retries_; } void IncrementRetries() { ++retries_; } - int64 position() { return position_; } + int64_t position() { return position_; } int size() { return size_; } - uint8* data() { return data_; } + uint8_t* data() { return data_; } private: int retries_; - const int64 position_; + const int64_t position_; const int size_; - uint8* data_; + uint8_t* data_; DataSource::ReadCB callback_; DISALLOW_IMPLICIT_CONSTRUCTORS(ReadOperation); }; BufferedDataSource::ReadOperation::ReadOperation( - int64 position, int size, uint8* data, + int64_t position, + int size, + uint8_t* data, const DataSource::ReadCB& callback) : retries_(0), position_(position), @@ -128,7 +132,8 @@ bool BufferedDataSource::assume_fully_buffered() { // This method can be overridden to inject mock BufferedResourceLoader object // for testing purpose. BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( - int64 first_byte_position, int64 last_byte_position) { + int64_t first_byte_position, + int64_t last_byte_position) { DCHECK(render_task_runner_->BelongsToCurrentThread()); BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? @@ -253,9 +258,10 @@ int64_t BufferedDataSource::GetMemoryUsage() const { return loader_ ? loader_->GetMemoryUsage() : 0; } -void BufferedDataSource::Read( - int64 position, int size, uint8* data, - const DataSource::ReadCB& read_cb) { +void BufferedDataSource::Read(int64_t position, + int size, + uint8_t* data, + const DataSource::ReadCB& read_cb) { DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; DCHECK(!read_cb.is_null()); @@ -276,7 +282,7 @@ void BufferedDataSource::Read( base::Bind(&BufferedDataSource::ReadTask, weak_factory_.GetWeakPtr())); } -bool BufferedDataSource::GetSize(int64* size_out) { +bool BufferedDataSource::GetSize(int64_t* size_out) { if (total_bytes_ != kPositionNotSpecified) { *size_out = total_bytes_; return true; @@ -330,7 +336,7 @@ void BufferedDataSource::SetBitrateTask(int bitrate) { // prior to make this method call. void BufferedDataSource::ReadInternal() { DCHECK(render_task_runner_->BelongsToCurrentThread()); - int64 position = 0; + int64_t position = 0; int size = 0; { base::AutoLock auto_lock(lock_); @@ -554,7 +560,7 @@ void BufferedDataSource::LoadingStateChangedCallback( downloading_cb_.Run(is_downloading_data); } -void BufferedDataSource::ProgressCallback(int64 position) { +void BufferedDataSource::ProgressCallback(int64_t position) { DCHECK(render_task_runner_->BelongsToCurrentThread()); if (assume_fully_buffered()) diff --git a/media/blink/buffered_data_source.h b/media/blink/buffered_data_source.h index 127c0ad..5b4546b 100644 --- a/media/blink/buffered_data_source.h +++ b/media/blink/buffered_data_source.h @@ -28,12 +28,12 @@ class MediaLog; class MEDIA_BLINK_EXPORT BufferedDataSourceHost { public: // Notify the host of the total size of the media file. - virtual void SetTotalBytes(int64 total_bytes) = 0; + virtual void SetTotalBytes(int64_t total_bytes) = 0; // Notify the host that byte range [start,end] has been buffered. // TODO(fischman): remove this method when demuxing is push-based instead of // pull-based. http://crbug.com/131444 - virtual void AddBufferedByteRange(int64 start, int64 end) = 0; + virtual void AddBufferedByteRange(int64_t start, int64_t end) = 0; protected: virtual ~BufferedDataSourceHost() {} @@ -184,11 +184,11 @@ class MEDIA_BLINK_EXPORT BufferedDataSource // Called from demuxer thread. void Stop() override; - void Read(int64 position, + void Read(int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& read_cb) override; - bool GetSize(int64* size_out) override; + bool GetSize(int64_t* size_out) override; bool IsStreaming() override; void SetBitrate(int bitrate) override; @@ -197,7 +197,8 @@ class MEDIA_BLINK_EXPORT BufferedDataSource // parameters. We can override this file to object a mock // BufferedResourceLoader for testing. virtual BufferedResourceLoader* CreateResourceLoader( - int64 first_byte_position, int64 last_byte_position); + int64_t first_byte_position, + int64_t last_byte_position); private: friend class BufferedDataSourceTest; @@ -232,7 +233,7 @@ class MEDIA_BLINK_EXPORT BufferedDataSource // BufferedResourceLoader callbacks. void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); - void ProgressCallback(int64 position); + void ProgressCallback(int64_t position); // Update |loader_|'s deferring strategy. void UpdateDeferStrategy(); @@ -245,7 +246,7 @@ class MEDIA_BLINK_EXPORT BufferedDataSource // The total size of the resource. Set during StartCallback() if the size is // known, otherwise it will remain kPositionNotSpecified until the size is // determined by reaching EOF. - int64 total_bytes_; + int64_t total_bytes_; // This value will be true if this data source can only support streaming. // i.e. range request is not supported. @@ -275,7 +276,7 @@ class MEDIA_BLINK_EXPORT BufferedDataSource // because we want buffer to be passed into BufferedResourceLoader to be // always non-null. And by initializing this member with a default size we can // avoid creating zero-sized buffered if the first read has zero size. - std::vector<uint8> intermediate_read_buffer_; + std::vector<uint8_t> intermediate_read_buffer_; // The task runner of the render thread. const scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_; diff --git a/media/blink/buffered_data_source_host_impl.cc b/media/blink/buffered_data_source_host_impl.cc index 19d01be..d3ad3de 100644 --- a/media/blink/buffered_data_source_host_impl.cc +++ b/media/blink/buffered_data_source_host_impl.cc @@ -14,11 +14,12 @@ BufferedDataSourceHostImpl::BufferedDataSourceHostImpl() BufferedDataSourceHostImpl::~BufferedDataSourceHostImpl() { } -void BufferedDataSourceHostImpl::SetTotalBytes(int64 total_bytes) { +void BufferedDataSourceHostImpl::SetTotalBytes(int64_t total_bytes) { total_bytes_ = total_bytes; } -void BufferedDataSourceHostImpl::AddBufferedByteRange(int64 start, int64 end) { +void BufferedDataSourceHostImpl::AddBufferedByteRange(int64_t start, + int64_t end) { const auto i = buffered_byte_ranges_.find(start); if (i.value() && i.interval_end() >= end) { // No change @@ -28,8 +29,9 @@ void BufferedDataSourceHostImpl::AddBufferedByteRange(int64 start, int64 end) { did_loading_progress_ = true; } -static base::TimeDelta TimeForByteOffset( - int64 byte_offset, int64 total_bytes, base::TimeDelta duration) { +static base::TimeDelta TimeForByteOffset(int64_t byte_offset, + int64_t total_bytes, + base::TimeDelta duration) { double position = static_cast<double>(byte_offset) / total_bytes; // Snap to the beginning/end where the approximation can look especially bad. if (position < 0.01) @@ -37,7 +39,7 @@ static base::TimeDelta TimeForByteOffset( if (position > 0.99) return duration; return base::TimeDelta::FromMilliseconds( - static_cast<int64>(position * duration.InMilliseconds())); + static_cast<int64_t>(position * duration.InMilliseconds())); } void BufferedDataSourceHostImpl::AddBufferedTimeRanges( @@ -48,8 +50,8 @@ void BufferedDataSourceHostImpl::AddBufferedTimeRanges( if (total_bytes_ && !buffered_byte_ranges_.empty()) { for (const auto i : buffered_byte_ranges_) { if (i.second) { - int64 start = i.first.begin; - int64 end = i.first.end; + int64_t start = i.first.begin; + int64_t end = i.first.end; buffered_time_ranges->Add( TimeForByteOffset(start, total_bytes_, media_duration), TimeForByteOffset(end, total_bytes_, media_duration)); diff --git a/media/blink/buffered_data_source_host_impl.h b/media/blink/buffered_data_source_host_impl.h index b028c0e..cf61846 100644 --- a/media/blink/buffered_data_source_host_impl.h +++ b/media/blink/buffered_data_source_host_impl.h @@ -20,8 +20,8 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl ~BufferedDataSourceHostImpl() override; // BufferedDataSourceHost implementation. - void SetTotalBytes(int64 total_bytes) override; - void AddBufferedByteRange(int64 start, int64 end) override; + void SetTotalBytes(int64_t total_bytes) override; + void AddBufferedByteRange(int64_t start, int64_t end) override; // Translate the byte ranges to time ranges and append them to the list. // TODO(sandersd): This is a confusing name, find something better. @@ -33,11 +33,11 @@ class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl private: // Total size of the data source. - int64 total_bytes_; + int64_t total_bytes_; // List of buffered byte ranges for estimating buffered time. // The InterValMap value is 1 for bytes that are buffered, 0 otherwise. - IntervalMap<int64, int> buffered_byte_ranges_; + IntervalMap<int64_t, int> buffered_byte_ranges_; // True when AddBufferedByteRange() has been called more recently than // DidLoadingProgress(). diff --git a/media/blink/buffered_data_source_unittest.cc b/media/blink/buffered_data_source_unittest.cc index 4ac4f93..719ed2c 100644 --- a/media/blink/buffered_data_source_unittest.cc +++ b/media/blink/buffered_data_source_unittest.cc @@ -38,8 +38,8 @@ class MockBufferedDataSourceHost : public BufferedDataSourceHost { MockBufferedDataSourceHost() {} virtual ~MockBufferedDataSourceHost() {} - MOCK_METHOD1(SetTotalBytes, void(int64 total_bytes)); - MOCK_METHOD2(AddBufferedByteRange, void(int64 start, int64 end)); + MOCK_METHOD1(SetTotalBytes, void(int64_t total_bytes)); + MOCK_METHOD2(AddBufferedByteRange, void(int64_t start, int64_t end)); private: DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost); @@ -67,9 +67,9 @@ class MockBufferedDataSource : public BufferedDataSource { loading_(false) {} virtual ~MockBufferedDataSource() {} - MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64, int64)); - BufferedResourceLoader* CreateMockResourceLoader(int64 first_byte_position, - int64 last_byte_position) { + MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64_t, int64_t)); + BufferedResourceLoader* CreateMockResourceLoader(int64_t first_byte_position, + int64_t last_byte_position) { CHECK(!loading_) << "Previous resource load wasn't cancelled"; BufferedResourceLoader* loader = @@ -103,8 +103,8 @@ class MockBufferedDataSource : public BufferedDataSource { DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSource); }; -static const int64 kFileSize = 5000000; -static const int64 kFarReadPosition = 4000000; +static const int64_t kFileSize = 5000000; +static const int64_t kFarReadPosition = 4000000; static const int kDataSize = 1024; static const char kHttpUrl[] = "http://localhost/foo.webm"; @@ -224,7 +224,7 @@ class BufferedDataSourceTest : public testing::Test { MOCK_METHOD1(ReadCallback, void(int size)); - void ReadAt(int64 position) { + void ReadAt(int64_t position) { data_source_->Read(position, kDataSize, buffer_, base::Bind(&BufferedDataSourceTest::ReadCallback, base::Unretained(this))); @@ -307,7 +307,7 @@ class BufferedDataSourceTest : public testing::Test { private: // Used for calling BufferedDataSource::Read(). - uint8 buffer_[kDataSize]; + uint8_t buffer_[kDataSize]; BufferedDataSource::Preload preload_; @@ -699,7 +699,7 @@ TEST_F(BufferedDataSourceTest, File_Successful) { TEST_F(BufferedDataSourceTest, StopDuringRead) { InitializeWith206Response(); - uint8 buffer[256]; + uint8_t buffer[256]; data_source_->Read(0, arraysize(buffer), buffer, base::Bind( &BufferedDataSourceTest::ReadCallback, base::Unretained(this))); diff --git a/media/blink/buffered_resource_loader_unittest.cc b/media/blink/buffered_resource_loader_unittest.cc index bf9a911..0974b5d 100644 --- a/media/blink/buffered_resource_loader_unittest.cc +++ b/media/blink/buffered_resource_loader_unittest.cc @@ -117,11 +117,11 @@ class BufferedResourceLoaderTest : public testing::Test { view_->mainFrame()); } - void FullResponse(int64 instance_size) { + void FullResponse(int64_t instance_size) { FullResponse(instance_size, BufferedResourceLoader::kOk); } - void FullResponse(int64 instance_size, + void FullResponse(int64_t instance_size, BufferedResourceLoader::Status status) { EXPECT_CALL(*this, StartCallback(status)); @@ -141,13 +141,17 @@ class BufferedResourceLoaderTest : public testing::Test { EXPECT_FALSE(loader_->range_supported()); } - void PartialResponse(int64 first_position, int64 last_position, - int64 instance_size) { + void PartialResponse(int64_t first_position, + int64_t last_position, + int64_t instance_size) { PartialResponse(first_position, last_position, instance_size, false, true); } - void PartialResponse(int64 first_position, int64 last_position, - int64 instance_size, bool chunked, bool accept_ranges) { + void PartialResponse(int64_t first_position, + int64_t last_position, + int64_t instance_size, + bool chunked, + bool accept_ranges) { EXPECT_CALL(*this, StartCallback(BufferedResourceLoader::kOk)); WebURLResponse response(gurl_); @@ -159,7 +163,7 @@ class BufferedResourceLoaderTest : public testing::Test { instance_size))); // HTTP 1.1 doesn't permit Content-Length with Transfer-Encoding: chunked. - int64 content_length = -1; + int64_t content_length = -1; if (chunked) { response.setHTTPHeaderField(WebString::fromUTF8("Transfer-Encoding"), WebString::fromUTF8("chunked")); @@ -233,18 +237,18 @@ class BufferedResourceLoaderTest : public testing::Test { } // Helper method to read from |loader_|. - void ReadLoader(int64 position, int size, uint8* buffer) { + void ReadLoader(int64_t position, int size, uint8_t* buffer) { loader_->Read(position, size, buffer, base::Bind(&BufferedResourceLoaderTest::ReadCallback, base::Unretained(this))); } // Verifies that data in buffer[0...size] is equal to data_[pos...pos+size]. - void VerifyBuffer(uint8* buffer, int pos, int size) { + void VerifyBuffer(uint8_t* buffer, int pos, int size) { EXPECT_EQ(0, memcmp(buffer, data_ + pos, size)); } - void ConfirmLoaderOffsets(int64 expected_offset, + void ConfirmLoaderOffsets(int64_t expected_offset, int expected_first_offset, int expected_last_offset) { EXPECT_EQ(loader_->offset_, expected_offset); @@ -290,12 +294,12 @@ class BufferedResourceLoaderTest : public testing::Test { MOCK_METHOD1(StartCallback, void(BufferedResourceLoader::Status)); MOCK_METHOD2(ReadCallback, void(BufferedResourceLoader::Status, int)); MOCK_METHOD1(LoadingCallback, void(BufferedResourceLoader::LoadingState)); - MOCK_METHOD1(ProgressCallback, void(int64)); + MOCK_METHOD1(ProgressCallback, void(int64_t)); protected: GURL gurl_; - int64 first_position_; - int64 last_position_; + int64_t first_position_; + int64_t last_position_; scoped_ptr<BufferedResourceLoader> loader_; NiceMock<MockWebURLLoader>* url_loader_; @@ -306,7 +310,7 @@ class BufferedResourceLoaderTest : public testing::Test { base::MessageLoop message_loop_; - uint8 data_[kDataSize]; + uint8_t data_[kDataSize]; private: DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoaderTest); @@ -401,7 +405,7 @@ TEST_F(BufferedResourceLoaderTest, BufferAndRead) { Start(); PartialResponse(10, 29, 30); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // Writes 10 bytes and read them back. @@ -453,7 +457,7 @@ TEST_F(BufferedResourceLoaderTest, ReadExtendBuffer) { Start(); PartialResponse(10, 0x014FFFFFF, 0x015000000); - uint8 buffer[20]; + uint8_t buffer[20]; InSequence s; // Write more than forward capacity and read it back. Ensure forward capacity @@ -502,7 +506,7 @@ TEST_F(BufferedResourceLoaderTest, ReadOutsideBuffer) { Start(); PartialResponse(10, 0x00FFFFFF, 0x01000000); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // Read very far ahead will get a cache miss. @@ -531,7 +535,7 @@ TEST_F(BufferedResourceLoaderTest, RequestFailedWhenRead) { Start(); PartialResponse(10, 29, 30); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // We should convert any error we receive to BufferedResourceLoader::kFailed. @@ -549,7 +553,7 @@ TEST_F(BufferedResourceLoaderTest, RequestFailedWithNoPendingReads) { Start(); PartialResponse(10, 29, 30); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // Write enough data so that a read would technically complete had the request @@ -573,7 +577,7 @@ TEST_F(BufferedResourceLoaderTest, RequestCancelledWhenRead) { Start(); PartialResponse(10, 29, 30); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // We should convert any error we receive to BufferedResourceLoader::kFailed. @@ -594,7 +598,7 @@ TEST_F(BufferedResourceLoaderTest, NeverDeferStrategy) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[10]; + uint8_t buffer[10]; // Read past the buffer size; should not defer regardless. WriteLoader(10, 10); @@ -615,7 +619,7 @@ TEST_F(BufferedResourceLoaderTest, ReadThenDeferStrategy) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[10]; + uint8_t buffer[10]; // Make an outstanding read request. ReadLoader(10, 10, buffer); @@ -664,7 +668,7 @@ TEST_F(BufferedResourceLoaderTest, ThresholdDeferStrategy) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[10]; + uint8_t buffer[10]; InSequence s; // Write half of capacity: keep not deferring. @@ -692,7 +696,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadForwardsPastBuffered) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -737,7 +741,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadBackwardsPastBuffered) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -770,7 +774,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_SmallReadWithinThreshold) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -818,7 +822,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_LargeReadWithinThreshold) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -873,7 +877,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_LargeReadBackwards) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -934,7 +938,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadPastThreshold) { Start(); PartialResponse(10, kSize - 1, kSize); - uint8 buffer[256]; + uint8_t buffer[256]; InSequence s; // PRECONDITION @@ -1092,10 +1096,12 @@ TEST_F(BufferedResourceLoaderTest, BufferWindow_PlaybackRate_AboveUpperBound) { StopWhenLoad(); } -static void ExpectContentRange( - const std::string& str, bool expect_success, - int64 expected_first, int64 expected_last, int64 expected_size) { - int64 first, last, size; +static void ExpectContentRange(const std::string& str, + bool expect_success, + int64_t expected_first, + int64_t expected_last, + int64_t expected_size) { + int64_t first, last, size; ASSERT_EQ(expect_success, BufferedResourceLoader::ParseContentRange( str, &first, &last, &size)) << str; if (!expect_success) @@ -1109,9 +1115,10 @@ static void ExpectContentRangeFailure(const std::string& str) { ExpectContentRange(str, false, 0, 0, 0); } -static void ExpectContentRangeSuccess( - const std::string& str, - int64 expected_first, int64 expected_last, int64 expected_size) { +static void ExpectContentRangeSuccess(const std::string& str, + int64_t expected_first, + int64_t expected_last, + int64_t expected_size) { ExpectContentRange(str, true, expected_first, expected_last, expected_size); } @@ -1142,7 +1149,7 @@ TEST_F(BufferedResourceLoaderTest, CancelAfterDeferral) { Start(); PartialResponse(10, 99, 100); - uint8 buffer[10]; + uint8_t buffer[10]; // Make an outstanding read request. ReadLoader(10, 10, buffer); diff --git a/media/blink/cache_util.cc b/media/blink/cache_util.cc index 0f55b1f..d540980 100644 --- a/media/blink/cache_util.cc +++ b/media/blink/cache_util.cc @@ -24,8 +24,8 @@ namespace media { enum { kHttpOK = 200, kHttpPartialContent = 206 }; -uint32 GetReasonsForUncacheability(const WebURLResponse& response) { - uint32 reasons = 0; +uint32_t GetReasonsForUncacheability(const WebURLResponse& response) { + uint32_t reasons = 0; const int code = response.httpStatusCode(); const int version = response.httpVersion(); const HttpVersion http_version = @@ -66,7 +66,7 @@ uint32 GetReasonsForUncacheability(const WebURLResponse& response) { const char kMaxAgePrefix[] = "max-age="; const size_t kMaxAgePrefixLen = arraysize(kMaxAgePrefix) - 1; if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) { - int64 max_age_seconds; + int64_t max_age_seconds; base::StringToInt64( base::StringPiece(cache_control_header.begin() + kMaxAgePrefixLen, cache_control_header.end()), @@ -102,7 +102,7 @@ base::TimeDelta GetCacheValidUntil(const WebURLResponse& response) { const char kMaxAgePrefix[] = "max-age="; const size_t kMaxAgePrefixLen = arraysize(kMaxAgePrefix) - 1; if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) { - int64 max_age_seconds; + int64_t max_age_seconds; base::StringToInt64( base::StringPiece(cache_control_header.begin() + kMaxAgePrefixLen, cache_control_header.end()), diff --git a/media/blink/cache_util.h b/media/blink/cache_util.h index 8dd2a19..dc66c3d 100644 --- a/media/blink/cache_util.h +++ b/media/blink/cache_util.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/time/time.h" #include "media/blink/media_blink_export.h" @@ -34,7 +33,7 @@ enum UncacheableReason { // Return the logical OR of the reasons "response" cannot be used for a future // request (using the disk cache), or 0 if it might be useful. -uint32 MEDIA_BLINK_EXPORT +uint32_t MEDIA_BLINK_EXPORT GetReasonsForUncacheability(const blink::WebURLResponse& response); // Returns when we should evict data from this response from our diff --git a/media/blink/cache_util_unittest.cc b/media/blink/cache_util_unittest.cc index 8a7cd2f..4ba26aa 100644 --- a/media/blink/cache_util_unittest.cc +++ b/media/blink/cache_util_unittest.cc @@ -25,7 +25,7 @@ struct GRFUTestCase { WebURLResponse::HTTPVersion version; int status_code; const char* headers; - uint32 expected_reasons; + uint32_t expected_reasons; }; // Create a new WebURLResponse object. diff --git a/media/blink/cdm_result_promise.h b/media/blink/cdm_result_promise.h index 57313df..c3410b7 100644 --- a/media/blink/cdm_result_promise.h +++ b/media/blink/cdm_result_promise.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BLINK_CDM_RESULT_PROMISE_H_ #define MEDIA_BLINK_CDM_RESULT_PROMISE_H_ -#include "base/basictypes.h" #include "media/base/cdm_promise.h" #include "media/base/media_keys.h" #include "media/blink/cdm_result_promise_helper.h" @@ -31,7 +30,7 @@ class CdmResultPromise : public media::CdmPromiseTemplate<T...> { // CdmPromiseTemplate<T> implementation. void resolve(const T&... result) override; void reject(media::MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) override; private: @@ -67,7 +66,7 @@ inline void CdmResultPromise<>::resolve() { template <typename... T> void CdmResultPromise<T...>::reject(media::MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { MarkPromiseSettled(); ReportCdmResultUMA(uma_name_, diff --git a/media/blink/cdm_session_adapter.h b/media/blink/cdm_session_adapter.h index a6fc2bc..5fe3ffc 100644 --- a/media/blink/cdm_session_adapter.h +++ b/media/blink/cdm_session_adapter.h @@ -9,7 +9,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -145,7 +144,7 @@ class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching // OnCdmCreated() call. - uint32 trace_id_; + uint32_t trace_id_; scoped_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_; diff --git a/media/blink/encrypted_media_player_support.cc b/media/blink/encrypted_media_player_support.cc index 086c469..9e245b6 100644 --- a/media/blink/encrypted_media_player_support.cc +++ b/media/blink/encrypted_media_player_support.cc @@ -4,7 +4,6 @@ #include "media/blink/encrypted_media_player_support.h" - #include "base/bind.h" #include "base/callback_helpers.h" #include "base/metrics/histogram.h" @@ -291,16 +290,16 @@ void EncryptedMediaPlayerSupport::OnKeyAdded(const std::string& session_id) { void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id, MediaKeys::KeyError error_code, - uint32 system_code) { + uint32_t system_code) { EmeUMAHistogramEnumeration(current_key_system_, "KeyError", error_code, MediaKeys::kMaxKeyError); - uint16 short_system_code = 0; - if (system_code > std::numeric_limits<uint16>::max()) { + uint16_t short_system_code = 0; + if (system_code > std::numeric_limits<uint16_t>::max()) { LOG(WARNING) << "system_code exceeds unsigned short limit."; - short_system_code = std::numeric_limits<uint16>::max(); + short_system_code = std::numeric_limits<uint16_t>::max(); } else { - short_system_code = static_cast<uint16>(system_code); + short_system_code = static_cast<uint16_t>(system_code); } client_->keyError( @@ -313,7 +312,7 @@ void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id, void EncryptedMediaPlayerSupport::OnKeyMessage( const std::string& session_id, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& destination_url) { DCHECK(destination_url.is_empty() || destination_url.is_valid()); diff --git a/media/blink/encrypted_media_player_support.h b/media/blink/encrypted_media_player_support.h index 2d09579..dbc9f46 100644 --- a/media/blink/encrypted_media_player_support.h +++ b/media/blink/encrypted_media_player_support.h @@ -88,9 +88,9 @@ class EncryptedMediaPlayerSupport void OnKeyAdded(const std::string& session_id); void OnKeyError(const std::string& session_id, MediaKeys::KeyError error_code, - uint32 system_code); + uint32_t system_code); void OnKeyMessage(const std::string& session_id, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& destination_url); CdmFactory* cdm_factory_; diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc index bfaec20..36be309 100644 --- a/media/blink/multibuffer_data_source.cc +++ b/media/blink/multibuffer_data_source.cc @@ -17,31 +17,31 @@ using blink::WebFrame; namespace { // Minimum preload buffer. -const int64 kMinBufferPreload = 2 << 20; // 2 Mb +const int64_t kMinBufferPreload = 2 << 20; // 2 Mb // Maxmimum preload buffer. -const int64 kMaxBufferPreload = 20 << 20; // 20 Mb +const int64_t kMaxBufferPreload = 20 << 20; // 20 Mb // Preload this much extra, then stop preloading until we fall below the // kTargetSecondsBufferedAhead. -const int64 kPreloadHighExtra = 1 << 20; // 1 Mb +const int64_t kPreloadHighExtra = 1 << 20; // 1 Mb // Total size of the pinned region in the cache. -const int64 kMaxBufferSize = 25 << 20; // 25 Mb +const int64_t kMaxBufferSize = 25 << 20; // 25 Mb // If bitrate is not known, use this. -const int64 kDefaultBitrate = 200 * 8 << 10; // 200 Kbps. +const int64_t kDefaultBitrate = 200 * 8 << 10; // 200 Kbps. // Maximum bitrate for buffer calculations. -const int64 kMaxBitrate = 20 * 8 << 20; // 20 Mbps. +const int64_t kMaxBitrate = 20 * 8 << 20; // 20 Mbps. // Maximum playback rate for buffer calculations. const double kMaxPlaybackRate = 25.0; // Preload this many seconds of data by default. -const int64 kTargetSecondsBufferedAhead = 10; +const int64_t kTargetSecondsBufferedAhead = 10; // Keep this many seconds of data for going back by default. -const int64 kTargetSecondsBufferedBehind = 2; +const int64_t kTargetSecondsBufferedBehind = 2; } // namespace @@ -54,9 +54,9 @@ T clamp(T value, T min, T max) { class MultibufferDataSource::ReadOperation { public: - ReadOperation(int64 position, + ReadOperation(int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& callback); ~ReadOperation(); @@ -64,23 +64,23 @@ class MultibufferDataSource::ReadOperation { // afterwards. static void Run(scoped_ptr<ReadOperation> read_op, int result); - int64 position() { return position_; } + int64_t position() { return position_; } int size() { return size_; } - uint8* data() { return data_; } + uint8_t* data() { return data_; } private: - const int64 position_; + const int64_t position_; const int size_; - uint8* data_; + uint8_t* data_; DataSource::ReadCB callback_; DISALLOW_IMPLICIT_CONSTRUCTORS(ReadOperation); }; MultibufferDataSource::ReadOperation::ReadOperation( - int64 position, + int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& callback) : position_(position), size_(size), data_(data), callback_(callback) { DCHECK(!callback_.is_null()); @@ -148,8 +148,8 @@ bool MultibufferDataSource::assume_fully_buffered() { return !url_data_->url().SchemeIsHTTPOrHTTPS(); } -void MultibufferDataSource::CreateResourceLoader(int64 first_byte_position, - int64 last_byte_position) { +void MultibufferDataSource::CreateResourceLoader(int64_t first_byte_position, + int64_t last_byte_position) { DCHECK(render_task_runner_->BelongsToCurrentThread()); reader_.reset(new MultiBufferReader( @@ -326,9 +326,9 @@ int64_t MultibufferDataSource::GetMemoryUsage() const { << url_data_->multibuffer()->block_size_shift(); } -void MultibufferDataSource::Read(int64 position, +void MultibufferDataSource::Read(int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& read_cb) { DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; // Reading is not allowed until after initialization. @@ -352,7 +352,7 @@ void MultibufferDataSource::Read(int64 position, base::Bind(&MultibufferDataSource::ReadTask, weak_factory_.GetWeakPtr())); } -bool MultibufferDataSource::GetSize(int64* size_out) { +bool MultibufferDataSource::GetSize(int64_t* size_out) { *size_out = url_data_->length(); return *size_out != kPositionNotSpecified; } @@ -484,7 +484,7 @@ void MultibufferDataSource::StartCallback() { UpdateLoadingState(true); } -void MultibufferDataSource::ProgressCallback(int64 begin, int64 end) { +void MultibufferDataSource::ProgressCallback(int64_t begin, int64_t end) { DVLOG(1) << __FUNCTION__ << "(" << begin << ", " << end << ")"; DCHECK(render_task_runner_->BelongsToCurrentThread()); @@ -540,7 +540,7 @@ void MultibufferDataSource::UpdateBufferSizes() { } // Use a default bit rate if unknown and clamp to prevent overflow. - int64 bitrate = clamp<int64>(bitrate_, 0, kMaxBitrate); + int64_t bitrate = clamp<int64_t>(bitrate_, 0, kMaxBitrate); if (bitrate == 0) bitrate = kDefaultBitrate; @@ -551,13 +551,13 @@ void MultibufferDataSource::UpdateBufferSizes() { playback_rate = std::max(playback_rate, 1.0); playback_rate = std::min(playback_rate, kMaxPlaybackRate); - int64 bytes_per_second = (bitrate / 8.0) * playback_rate; + int64_t bytes_per_second = (bitrate / 8.0) * playback_rate; - int64 preload = clamp(kTargetSecondsBufferedAhead * bytes_per_second, - kMinBufferPreload, kMaxBufferPreload); - int64 back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second, - kMinBufferPreload, kMaxBufferPreload); - int64 pin_forwards = kMaxBufferSize - back_buffer; + int64_t preload = clamp(kTargetSecondsBufferedAhead * bytes_per_second, + kMinBufferPreload, kMaxBufferPreload); + int64_t back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second, + kMinBufferPreload, kMaxBufferPreload); + int64_t pin_forwards = kMaxBufferSize - back_buffer; DCHECK_LE(preload_ + kPreloadHighExtra, pin_forwards); reader_->SetMaxBuffer(back_buffer, pin_forwards); diff --git a/media/blink/multibuffer_data_source.h b/media/blink/multibuffer_data_source.h index 8cf3e54..9bff5c6 100644 --- a/media/blink/multibuffer_data_source.h +++ b/media/blink/multibuffer_data_source.h @@ -101,11 +101,11 @@ class MEDIA_BLINK_EXPORT MultibufferDataSource // Called from demuxer thread. void Stop() override; - void Read(int64 position, + void Read(int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& read_cb) override; - bool GetSize(int64* size_out) override; + bool GetSize(int64_t* size_out) override; bool IsStreaming() override; void SetBitrate(int bitrate) override; @@ -114,8 +114,8 @@ class MEDIA_BLINK_EXPORT MultibufferDataSource // A factory method to create a BufferedResourceLoader based on the read // parameters. - void CreateResourceLoader(int64 first_byte_position, - int64 last_byte_position); + void CreateResourceLoader(int64_t first_byte_position, + int64_t last_byte_position); friend class MultibufferDataSourceTest; @@ -139,7 +139,7 @@ class MEDIA_BLINK_EXPORT MultibufferDataSource void UpdateSingleOrigin(); // MultiBufferReader progress callback. - void ProgressCallback(int64 begin, int64 end); + void ProgressCallback(int64_t begin, int64_t end); // call downloading_cb_ if needed. // If |force_loading| is true, we call downloading_cb_ and tell it that @@ -158,7 +158,7 @@ class MEDIA_BLINK_EXPORT MultibufferDataSource // The total size of the resource. Set during StartCallback() if the size is // known, otherwise it will remain kPositionNotSpecified until the size is // determined by reaching EOF. - int64 total_bytes_; + int64_t total_bytes_; // This value will be true if this data source can only support streaming. // i.e. range request is not supported. diff --git a/media/blink/multibuffer_data_source_unittest.cc b/media/blink/multibuffer_data_source_unittest.cc index b1a8f85..9fbf5a0 100644 --- a/media/blink/multibuffer_data_source_unittest.cc +++ b/media/blink/multibuffer_data_source_unittest.cc @@ -162,8 +162,8 @@ class MockBufferedDataSourceHost : public BufferedDataSourceHost { MockBufferedDataSourceHost() {} virtual ~MockBufferedDataSourceHost() {} - MOCK_METHOD1(SetTotalBytes, void(int64 total_bytes)); - MOCK_METHOD2(AddBufferedByteRange, void(int64 start, int64 end)); + MOCK_METHOD1(SetTotalBytes, void(int64_t total_bytes)); + MOCK_METHOD2(AddBufferedByteRange, void(int64_t start, int64_t end)); private: DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost); @@ -203,8 +203,8 @@ class MockMultibufferDataSource : public MultibufferDataSource { DISALLOW_COPY_AND_ASSIGN(MockMultibufferDataSource); }; -static const int64 kFileSize = 5000000; -static const int64 kFarReadPosition = 3997696; +static const int64_t kFileSize = 5000000; +static const int64_t kFarReadPosition = 3997696; static const int kDataSize = 32 << 10; static const char kHttpUrl[] = "http://localhost/foo.webm"; @@ -331,7 +331,7 @@ class MultibufferDataSourceTest : public testing::Test { MOCK_METHOD1(ReadCallback, void(int size)); - void ReadAt(int64 position, int64 howmuch = kDataSize) { + void ReadAt(int64_t position, int64_t howmuch = kDataSize) { data_source_->Read(position, howmuch, buffer_, base::Bind(&MultibufferDataSourceTest::ReadCallback, base::Unretained(this))); @@ -429,11 +429,11 @@ class MultibufferDataSourceTest : public testing::Test { void set_preload(MultibufferDataSource::Preload preload) { preload_ = preload; } - int64 preload_high() { + int64_t preload_high() { CHECK(loader()); return loader()->preload_high(); } - int64 preload_low() { + int64_t preload_low() { CHECK(loader()); return loader()->preload_low(); } @@ -459,7 +459,7 @@ class MultibufferDataSourceTest : public testing::Test { base::MessageLoop message_loop_; // Used for calling MultibufferDataSource::Read(). - uint8 buffer_[kDataSize * 2]; + uint8_t buffer_[kDataSize * 2]; DISALLOW_COPY_AND_ASSIGN(MultibufferDataSourceTest); }; @@ -863,7 +863,7 @@ TEST_F(MultibufferDataSourceTest, File_Successful) { TEST_F(MultibufferDataSourceTest, StopDuringRead) { InitializeWith206Response(); - uint8 buffer[256]; + uint8_t buffer[256]; data_source_->Read(0, arraysize(buffer), buffer, base::Bind(&MultibufferDataSourceTest::ReadCallback, base::Unretained(this))); diff --git a/media/blink/new_session_cdm_result_promise.cc b/media/blink/new_session_cdm_result_promise.cc index f7f1446..4a97c34 100644 --- a/media/blink/new_session_cdm_result_promise.cc +++ b/media/blink/new_session_cdm_result_promise.cc @@ -56,7 +56,7 @@ void NewSessionCdmResultPromise::resolve(const std::string& session_id) { } void NewSessionCdmResultPromise::reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { MarkPromiseSettled(); ReportCdmResultUMA(uma_name_, diff --git a/media/blink/new_session_cdm_result_promise.h b/media/blink/new_session_cdm_result_promise.h index c26bc95..48d58f6 100644 --- a/media/blink/new_session_cdm_result_promise.h +++ b/media/blink/new_session_cdm_result_promise.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "media/base/cdm_promise.h" #include "media/base/media_keys.h" #include "media/blink/media_blink_export.h" @@ -49,7 +48,7 @@ class MEDIA_BLINK_EXPORT NewSessionCdmResultPromise // CdmPromiseTemplate<T> implementation. void resolve(const std::string& session_id) override; void reject(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) override; private: diff --git a/media/blink/resource_multibuffer_data_provider.cc b/media/blink/resource_multibuffer_data_provider.cc index fb4a5db..b7951fd 100644 --- a/media/blink/resource_multibuffer_data_provider.cc +++ b/media/blink/resource_multibuffer_data_provider.cc @@ -217,7 +217,7 @@ void ResourceMultiBufferDataProvider::didReceiveResponse( destination_url_data->set_valid_until(base::Time::Now() + GetCacheValidUntil(response)); - uint32 reasons = GetReasonsForUncacheability(response); + uint32_t reasons = GetReasonsForUncacheability(response); destination_url_data->set_cacheable(reasons == 0); UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); int shift = 0; @@ -235,7 +235,7 @@ void ResourceMultiBufferDataProvider::didReceiveResponse( // Expected content length can be |kPositionNotSpecified|, in that case // |content_length_| is not specified and this is a streaming response. - int64 content_length = response.expectedContentLength(); + int64_t content_length = response.expectedContentLength(); // We make a strong assumption that when we reach here we have either // received a response from HTTP/HTTPS protocol or the request was @@ -420,9 +420,9 @@ void ResourceMultiBufferDataProvider::didFail(WebURLLoader* loader, bool ResourceMultiBufferDataProvider::ParseContentRange( const std::string& content_range_str, - int64* first_byte_position, - int64* last_byte_position, - int64* instance_size) { + int64_t* first_byte_position, + int64_t* last_byte_position, + int64_t* instance_size) { const std::string kUpThroughBytesUnit = "bytes "; if (content_range_str.find(kUpThroughBytesUnit) != 0) return false; @@ -477,7 +477,7 @@ int64_t ResourceMultiBufferDataProvider::block_size() const { bool ResourceMultiBufferDataProvider::VerifyPartialResponse( const WebURLResponse& response) { - int64 first_byte_position, last_byte_position, instance_size; + int64_t first_byte_position, last_byte_position, instance_size; if (!ParseContentRange(response.httpHeaderField("Content-Range").utf8(), &first_byte_position, &last_byte_position, &instance_size)) { diff --git a/media/blink/resource_multibuffer_data_provider.h b/media/blink/resource_multibuffer_data_provider.h index 89b70e5..60bd0e7 100644 --- a/media/blink/resource_multibuffer_data_provider.h +++ b/media/blink/resource_multibuffer_data_provider.h @@ -76,9 +76,9 @@ class MEDIA_BLINK_EXPORT ResourceMultiBufferDataProvider // NOTE: only public for testing! This is an implementation detail of // VerifyPartialResponse (a private method). static bool ParseContentRange(const std::string& content_range_str, - int64* first_byte_position, - int64* last_byte_position, - int64* instance_size); + int64_t* first_byte_position, + int64_t* last_byte_position, + int64_t* instance_size); int64_t byte_pos() const; int64_t block_size() const; diff --git a/media/blink/resource_multibuffer_data_provider_unittest.cc b/media/blink/resource_multibuffer_data_provider_unittest.cc index a60edeb..7c069ac1 100644 --- a/media/blink/resource_multibuffer_data_provider_unittest.cc +++ b/media/blink/resource_multibuffer_data_provider_unittest.cc @@ -106,7 +106,7 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { loader_->Start(); } - void FullResponse(int64 instance_size, bool ok = true) { + void FullResponse(int64_t instance_size, bool ok = true) { WebURLResponse response(gurl_); response.setHTTPHeaderField( WebString::fromUTF8("Content-Length"), @@ -122,15 +122,15 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { EXPECT_FALSE(url_data_->range_supported()); } - void PartialResponse(int64 first_position, - int64 last_position, - int64 instance_size) { + void PartialResponse(int64_t first_position, + int64_t last_position, + int64_t instance_size) { PartialResponse(first_position, last_position, instance_size, false, true); } - void PartialResponse(int64 first_position, - int64 last_position, - int64 instance_size, + void PartialResponse(int64_t first_position, + int64_t last_position, + int64_t instance_size, bool chunked, bool accept_ranges) { WebURLResponse response(gurl_); @@ -142,7 +142,7 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { first_position, last_position, instance_size))); // HTTP 1.1 doesn't permit Content-Length with Transfer-Encoding: chunked. - int64 content_length = -1; + int64_t content_length = -1; if (chunked) { response.setHTTPHeaderField(WebString::fromUTF8("Transfer-Encoding"), WebString::fromUTF8("chunked")); @@ -199,7 +199,7 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { } // Verifies that data in buffer[0...size] is equal to data_[pos...pos+size]. - void VerifyBuffer(uint8* buffer, int pos, int size) { + void VerifyBuffer(uint8_t* buffer, int pos, int size) { EXPECT_EQ(0, memcmp(buffer, data_ + pos, size)); } @@ -212,7 +212,7 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { protected: GURL gurl_; - int64 first_position_; + int64_t first_position_; scoped_ptr<UrlIndex> url_index_; scoped_refptr<UrlData> url_data_; @@ -227,7 +227,7 @@ class ResourceMultiBufferDataProviderTest : public testing::Test { base::MessageLoop message_loop_; - uint8 data_[kDataSize]; + uint8_t data_[kDataSize]; private: DISALLOW_COPY_AND_ASSIGN(ResourceMultiBufferDataProviderTest); diff --git a/media/blink/test_random.h b/media/blink/test_random.h index a3603b4..de3df9f 100644 --- a/media/blink/test_random.h +++ b/media/blink/test_random.h @@ -25,14 +25,14 @@ class TestRandom { } int32_t Rand() { - static const uint64 A = 16807; // bits 14, 8, 7, 5, 2, 1, 0 + static const uint64_t A = 16807; // bits 14, 8, 7, 5, 2, 1, 0 seed_ = static_cast<int32_t>((seed_ * A) % M); CHECK_GT(seed_, 0); return seed_; } private: - static const uint64 M = 2147483647L; // 2^32-1 + static const uint64_t M = 2147483647L; // 2^32-1 int32_t seed_; }; diff --git a/media/blink/test_response_generator.cc b/media/blink/test_response_generator.cc index e6883db..7079f9e 100644 --- a/media/blink/test_response_generator.cc +++ b/media/blink/test_response_generator.cc @@ -17,10 +17,8 @@ using blink::WebURLResponse; namespace media { TestResponseGenerator::TestResponseGenerator(const GURL& gurl, - int64 content_length) - : gurl_(gurl), - content_length_(content_length) { -} + int64_t content_length) + : gurl_(gurl), content_length_(content_length) {} WebURLError TestResponseGenerator::GenerateError() { WebURLError error; @@ -40,26 +38,26 @@ WebURLResponse TestResponseGenerator::Generate200() { return response; } -WebURLResponse TestResponseGenerator::Generate206(int64 first_byte_offset) { +WebURLResponse TestResponseGenerator::Generate206(int64_t first_byte_offset) { return GeneratePartial206(first_byte_offset, content_length_ - 1, kNormal); } -WebURLResponse TestResponseGenerator::Generate206(int64 first_byte_offset, +WebURLResponse TestResponseGenerator::Generate206(int64_t first_byte_offset, Flags flags) { return GeneratePartial206(first_byte_offset, content_length_ - 1, flags); } WebURLResponse TestResponseGenerator::GeneratePartial206( - int64 first_byte_offset, - int64 last_byte_offset) { + int64_t first_byte_offset, + int64_t last_byte_offset) { return GeneratePartial206(first_byte_offset, last_byte_offset, kNormal); } WebURLResponse TestResponseGenerator::GeneratePartial206( - int64 first_byte_offset, - int64 last_byte_offset, + int64_t first_byte_offset, + int64_t last_byte_offset, Flags flags) { - int64 range_content_length = content_length_ - first_byte_offset; + int64_t range_content_length = content_length_ - first_byte_offset; WebURLResponse response(gurl_); response.setHTTPStatusCode(206); @@ -97,7 +95,7 @@ WebURLResponse TestResponseGenerator::Generate404() { } WebURLResponse TestResponseGenerator::GenerateFileResponse( - int64 first_byte_offset) { + int64_t first_byte_offset) { WebURLResponse response(gurl_); response.setHTTPStatusCode(0); diff --git a/media/blink/test_response_generator.h b/media/blink/test_response_generator.h index e5a1161..1a8b16e 100644 --- a/media/blink/test_response_generator.h +++ b/media/blink/test_response_generator.h @@ -5,7 +5,6 @@ #ifndef MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ #define MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ -#include "base/basictypes.h" #include "third_party/WebKit/public/platform/WebURLError.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" #include "url/gurl.h" @@ -25,7 +24,7 @@ class TestResponseGenerator { // Build an HTTP response generator for the given URL. |content_length| is // used to generate Content-Length and Content-Range headers. - TestResponseGenerator(const GURL& gurl, int64 content_length); + TestResponseGenerator(const GURL& gurl, int64_t content_length); // Generates a WebURLError object. blink::WebURLError GenerateError(); @@ -35,23 +34,23 @@ class TestResponseGenerator { // Generates a regular HTTP 206 response starting from |first_byte_offset| // until the end of the resource. - blink::WebURLResponse Generate206(int64 first_byte_offset); + blink::WebURLResponse Generate206(int64_t first_byte_offset); // Generates a custom HTTP 206 response starting from |first_byte_offset| // until the end of the resource. You can tweak what gets included in the // headers via |flags|. - blink::WebURLResponse Generate206(int64 first_byte_offset, Flags flags); + blink::WebURLResponse Generate206(int64_t first_byte_offset, Flags flags); // Generates a regular HTTP 206 response starting from |first_byte_offset| // until |last_byte_offset|. - blink::WebURLResponse GeneratePartial206(int64 first_byte_offset, - int64 last_byte_offset); + blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset, + int64_t last_byte_offset); // Generates a custom HTTP 206 response starting from |first_byte_offset| // until |last_byte_offset|. You can tweak what gets included in the // headers via |flags|. - blink::WebURLResponse GeneratePartial206(int64 first_byte_offset, - int64 last_byte_offset, + blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset, + int64_t last_byte_offset, Flags flags); // Generates a regular HTTP 404 response. @@ -62,13 +61,13 @@ class TestResponseGenerator { // // If |first_byte_offset| is negative a response containing no content length // will be returned. - blink::WebURLResponse GenerateFileResponse(int64 first_byte_offset); + blink::WebURLResponse GenerateFileResponse(int64_t first_byte_offset); - int64 content_length() { return content_length_; } + int64_t content_length() { return content_length_; } private: GURL gurl_; - int64 content_length_; + int64_t content_length_; DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator); }; diff --git a/media/blink/texttrack_impl.h b/media/blink/texttrack_impl.h index 70c6a22..5dcae15 100644 --- a/media/blink/texttrack_impl.h +++ b/media/blink/texttrack_impl.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/text_track.h" diff --git a/media/blink/url_index.cc b/media/blink/url_index.cc index 125c445..aadc8ca 100644 --- a/media/blink/url_index.cc +++ b/media/blink/url_index.cc @@ -84,7 +84,7 @@ void UrlData::set_cacheable(bool cacheable) { cacheable_ = cacheable; } -void UrlData::set_length(int64 length) { +void UrlData::set_length(int64_t length) { DCHECK(thread_checker_.CalledOnValidThread()); if (length != kPositionNotSpecified) { length_ = length; diff --git a/media/blink/url_index.h b/media/blink/url_index.h index 63f314a..2850b3b 100644 --- a/media/blink/url_index.h +++ b/media/blink/url_index.h @@ -20,7 +20,7 @@ namespace media { -const int64 kPositionNotSpecified = -1; +const int64_t kPositionNotSpecified = -1; class UrlData; @@ -81,7 +81,7 @@ class MEDIA_BLINK_EXPORT UrlData : public base::RefCounted<UrlData> { KeyType key() const; // Length of data associated with url or |kPositionNotSpecified| - int64 length() const { return length_; } + int64_t length() const { return length_; } // Returns the number of blocks cached for this resource. size_t CachedSize(); @@ -95,7 +95,7 @@ class MEDIA_BLINK_EXPORT UrlData : public base::RefCounted<UrlData> { void Use(); // Setters. - void set_length(int64 length); + void set_length(int64_t length); void set_cacheable(bool cacheable); void set_valid_until(base::Time valid_until); void set_range_supported(); @@ -151,7 +151,7 @@ class MEDIA_BLINK_EXPORT UrlData : public base::RefCounted<UrlData> { base::WeakPtr<UrlIndex> url_index_; // Length of resource this url points to. (in bytes) - int64 length_; + int64_t length_; // Does the server support ranges? bool range_supported_; diff --git a/media/blink/webcontentdecryptionmodule_impl.cc b/media/blink/webcontentdecryptionmodule_impl.cc index d6509da..81a0ee8 100644 --- a/media/blink/webcontentdecryptionmodule_impl.cc +++ b/media/blink/webcontentdecryptionmodule_impl.cc @@ -4,7 +4,6 @@ #include "webcontentdecryptionmodule_impl.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/logging.h" #include "base/numerics/safe_conversions.h" @@ -87,13 +86,13 @@ WebContentDecryptionModuleImpl::createSession() { } void WebContentDecryptionModuleImpl::setServerCertificate( - const uint8* server_certificate, + const uint8_t* server_certificate, size_t server_certificate_length, blink::WebContentDecryptionModuleResult result) { DCHECK(server_certificate); adapter_->SetServerCertificate( - std::vector<uint8>(server_certificate, - server_certificate + server_certificate_length), + std::vector<uint8_t>(server_certificate, + server_certificate + server_certificate_length), scoped_ptr<SimpleCdmPromise>( new CdmResultPromise<>(result, std::string()))); } diff --git a/media/blink/webcontentdecryptionmodule_impl.h b/media/blink/webcontentdecryptionmodule_impl.h index 730077e..d75adb8 100644 --- a/media/blink/webcontentdecryptionmodule_impl.h +++ b/media/blink/webcontentdecryptionmodule_impl.h @@ -43,7 +43,7 @@ class MEDIA_BLINK_EXPORT WebContentDecryptionModuleImpl blink::WebContentDecryptionModuleSession* createSession() override; void setServerCertificate( - const uint8* server_certificate, + const uint8_t* server_certificate, size_t server_certificate_length, blink::WebContentDecryptionModuleResult result) override; diff --git a/media/blink/webcontentdecryptionmodulesession_impl.cc b/media/blink/webcontentdecryptionmodulesession_impl.cc index 3234523..150886f 100644 --- a/media/blink/webcontentdecryptionmodulesession_impl.cc +++ b/media/blink/webcontentdecryptionmodulesession_impl.cc @@ -102,7 +102,7 @@ static MediaKeys::SessionType convertSessionType( static bool SanitizeInitData(EmeInitDataType init_data_type, const unsigned char* init_data, size_t init_data_length, - std::vector<uint8>* sanitized_init_data, + std::vector<uint8_t>* sanitized_init_data, std::string* error_message) { if (init_data_length > limits::kMaxInitDataLength) { error_message->assign("Initialization data too long."); @@ -179,9 +179,9 @@ static bool SanitizeSessionId(const blink::WebString& session_id, } static bool SanitizeResponse(const std::string& key_system, - const uint8* response, + const uint8_t* response, size_t response_length, - std::vector<uint8>* sanitized_response) { + std::vector<uint8_t>* sanitized_response) { // The user agent should thoroughly validate the response before passing it // to the CDM. This may include verifying values are within reasonable limits, // stripping irrelevant data or fields, pre-parsing it, sanitizing it, @@ -279,7 +279,7 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession( // needed by the CDM. // 9.3 If the previous step failed, reject promise with a new DOMException // whose name is InvalidAccessError. - std::vector<uint8> sanitized_init_data; + std::vector<uint8_t> sanitized_init_data; std::string message; if (!SanitizeInitData(eme_init_data_type, init_data, init_data_length, &sanitized_init_data, &message)) { @@ -335,14 +335,14 @@ void WebContentDecryptionModuleSessionImpl::load( } void WebContentDecryptionModuleSessionImpl::update( - const uint8* response, + const uint8_t* response, size_t response_length, blink::WebContentDecryptionModuleResult result) { DCHECK(response); DCHECK(!session_id_.empty()); DCHECK(thread_checker_.CalledOnValidThread()); - std::vector<uint8> sanitized_response; + std::vector<uint8_t> sanitized_response; if (!SanitizeResponse(adapter_->GetKeySystem(), response, response_length, &sanitized_response)) { result.completeWithError( @@ -379,7 +379,7 @@ void WebContentDecryptionModuleSessionImpl::remove( void WebContentDecryptionModuleSessionImpl::OnSessionMessage( MediaKeys::MessageType message_type, - const std::vector<uint8>& message) { + const std::vector<uint8_t>& message) { DCHECK(client_) << "Client not set before message event"; DCHECK(thread_checker_.CalledOnValidThread()); client_->message(convertMessageType(message_type), message.data(), diff --git a/media/blink/webcontentdecryptionmodulesession_impl.h b/media/blink/webcontentdecryptionmodulesession_impl.h index 9a63509..4a41d83 100644 --- a/media/blink/webcontentdecryptionmodulesession_impl.h +++ b/media/blink/webcontentdecryptionmodulesession_impl.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -42,7 +41,7 @@ class WebContentDecryptionModuleSessionImpl blink::WebContentDecryptionModuleResult result) override; void load(const blink::WebString& session_id, blink::WebContentDecryptionModuleResult result) override; - void update(const uint8* response, + void update(const uint8_t* response, size_t response_length, blink::WebContentDecryptionModuleResult result) override; void close(blink::WebContentDecryptionModuleResult result) override; @@ -50,7 +49,7 @@ class WebContentDecryptionModuleSessionImpl // Callbacks. void OnSessionMessage(MediaKeys::MessageType message_type, - const std::vector<uint8>& message); + const std::vector<uint8_t>& message); void OnSessionKeysChange(bool has_additional_usable_key, CdmKeysInfo keys_info); void OnSessionExpirationUpdate(const base::Time& new_expiry_time); diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index d55e864..0994d9e 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc @@ -805,7 +805,7 @@ void WebMediaPlayerImpl::setContentDecryptionModule( void WebMediaPlayerImpl::OnEncryptedMediaInitData( EmeInitDataType init_data_type, - const std::vector<uint8>& init_data) { + const std::vector<uint8_t>& init_data) { DCHECK(init_data_type != EmeInitDataType::UNKNOWN); // Do not fire "encrypted" event if encrypted media is not enabled. diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h index 3918395..1e602f0 100644 --- a/media/blink/webmediaplayer_impl.h +++ b/media/blink/webmediaplayer_impl.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" @@ -236,7 +235,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl // Called when the demuxer encounters encrypted streams. void OnEncryptedMediaInitData(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data); + const std::vector<uint8_t>& init_data); // Called when a decoder detects that the key needed to decrypt the stream // is not available. diff --git a/media/capture/content/animated_content_sampler.cc b/media/capture/content/animated_content_sampler.cc index ae90419..01c9fd4 100644 --- a/media/capture/content/animated_content_sampler.cc +++ b/media/capture/content/animated_content_sampler.cc @@ -160,7 +160,7 @@ gfx::Rect AnimatedContentSampler::ElectMajorityDamageRect() const { // pixel in a candidate gets one vote, as opposed to each candidate getting // one vote. const gfx::Rect* candidate = NULL; - int64 votes = 0; + int64_t votes = 0; for (ObservationFifo::const_iterator i = observations_.begin(); i != observations_.end(); ++i) { DCHECK_GT(i->damage_rect.size().GetArea(), 0); @@ -191,8 +191,8 @@ bool AnimatedContentSampler::AnalyzeObservations( // Scan |observations_|, gathering metrics about the ones having a damage Rect // equivalent to the |elected_rect|. Along the way, break early whenever the // event times reveal a non-animating period. - int64 num_pixels_damaged_in_all = 0; - int64 num_pixels_damaged_in_chosen = 0; + int64_t num_pixels_damaged_in_all = 0; + int64_t num_pixels_damaged_in_chosen = 0; base::TimeDelta sum_frame_durations; size_t count_frame_durations = 0; base::TimeTicks first_event_time; @@ -248,7 +248,7 @@ base::TimeTicks AnimatedContentSampler::ComputeNextFrameTimestamp( // TODO(miu): This is similar to the ClockSmoother in // media/base/audio_shifter.cc. Consider refactor-and-reuse here. const base::TimeDelta drift = ideal_timestamp - event_time; - const int64 correct_over_num_frames = + const int64_t correct_over_num_frames = base::TimeDelta::FromMilliseconds(kDriftCorrectionMillis) / sampling_period_; DCHECK_GT(correct_over_num_frames, 0); @@ -275,7 +275,7 @@ base::TimeDelta AnimatedContentSampler::ComputeSamplingPeriod( // 42/3 = 14, and so on. Of these candidates, 21 FPS is closest to 30. base::TimeDelta sampling_period; if (animation_period < target_sampling_period) { - const int64 ratio = target_sampling_period / animation_period; + const int64_t ratio = target_sampling_period / animation_period; const double target_fps = 1.0 / target_sampling_period.InSecondsF(); const double animation_fps = 1.0 / animation_period.InSecondsF(); if (std::abs(animation_fps / ratio - target_fps) < diff --git a/media/capture/content/animated_content_sampler_unittest.cc b/media/capture/content/animated_content_sampler_unittest.cc index bc3d595..697559f 100644 --- a/media/capture/content/animated_content_sampler_unittest.cc +++ b/media/capture/content/animated_content_sampler_unittest.cc @@ -603,7 +603,7 @@ TEST_P(AnimatedContentSamplerParameterizedTest, FrameTimestampsAreSmooth) { // of 30 Hz content on a 60 Hz v-sync interval should result in // display_counts[2] == 10. Quit early if any one frame was obviously // repeated too many times. - const int64 max_expected_repeats_per_frame = + const int64_t max_expected_repeats_per_frame = 1 + ComputeExpectedSamplingPeriod() / GetParam().vsync_interval; std::vector<size_t> display_counts(max_expected_repeats_per_frame + 1, 0); base::TimeTicks last_present_time = frame_timestamps.front(); diff --git a/media/capture/content/smooth_event_sampler.cc b/media/capture/content/smooth_event_sampler.cc index 233ab00..04af086 100644 --- a/media/capture/content/smooth_event_sampler.cc +++ b/media/capture/content/smooth_event_sampler.cc @@ -41,7 +41,7 @@ void SmoothEventSampler::ConsiderPresentationEvent(base::TimeTicks event_time) { token_bucket_ = token_bucket_capacity_; } TRACE_COUNTER1("gpu.capture", "MirroringTokenBucketUsec", - std::max<int64>(0, token_bucket_.InMicroseconds())); + std::max<int64_t>(0, token_bucket_.InMicroseconds())); } current_event_ = event_time; } @@ -55,7 +55,7 @@ void SmoothEventSampler::RecordSample() { if (token_bucket_ < base::TimeDelta()) token_bucket_ = base::TimeDelta(); TRACE_COUNTER1("gpu.capture", "MirroringTokenBucketUsec", - std::max<int64>(0, token_bucket_.InMicroseconds())); + std::max<int64_t>(0, token_bucket_.InMicroseconds())); if (HasUnrecordedEvent()) { last_sample_ = current_event_; diff --git a/media/capture/content/smooth_event_sampler_unittest.cc b/media/capture/content/smooth_event_sampler_unittest.cc index b3234aa..4fa6325 100644 --- a/media/capture/content/smooth_event_sampler_unittest.cc +++ b/media/capture/content/smooth_event_sampler_unittest.cc @@ -368,7 +368,7 @@ void ReplayCheckingSamplerDecisions(const DataPoint* data_points, base::TimeTicks t = InitialTestTimeTicks(); for (size_t i = 0; i < num_data_points; ++i) { t += base::TimeDelta::FromMicroseconds( - static_cast<int64>(data_points[i].increment_ms * 1000)); + static_cast<int64_t>(data_points[i].increment_ms * 1000)); ASSERT_EQ(data_points[i].should_capture, AddEventAndConsiderSampling(sampler, t)) << "at data_points[" << i << ']'; diff --git a/media/capture/content/thread_safe_capture_oracle.cc b/media/capture/content/thread_safe_capture_oracle.cc index 0c62e69..1d11d8c 100644 --- a/media/capture/content/thread_safe_capture_oracle.cc +++ b/media/capture/content/thread_safe_capture_oracle.cc @@ -4,7 +4,6 @@ #include "media/capture/content/thread_safe_capture_oracle.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/bits.h" #include "base/logging.h" @@ -35,14 +34,13 @@ ThreadSafeCaptureOracle::ThreadSafeCaptureOracle( const VideoCaptureParams& params, bool enable_auto_throttling) : client_(client.Pass()), - oracle_(base::TimeDelta::FromMicroseconds(static_cast<int64>( + oracle_(base::TimeDelta::FromMicroseconds(static_cast<int64_t>( 1000000.0 / params.requested_format.frame_rate + 0.5 /* to round to nearest int */)), params.requested_format.frame_size, params.resolution_change_policy, enable_auto_throttling), - params_(params) { -} + params_(params) {} ThreadSafeCaptureOracle::~ThreadSafeCaptureOracle() { } @@ -118,8 +116,9 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture( *storage = VideoFrame::WrapExternalSharedMemory( params_.requested_format.pixel_format, coded_size, gfx::Rect(visible_size), visible_size, - static_cast<uint8*>(output_buffer->data()), output_buffer->mapped_size(), - base::SharedMemory::NULLHandle(), 0u, base::TimeDelta()); + static_cast<uint8_t*>(output_buffer->data()), + output_buffer->mapped_size(), base::SharedMemory::NULLHandle(), 0u, + base::TimeDelta()); DCHECK(*storage); *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this, frame_number, diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc index fdbdbf9..8d2f19a 100644 --- a/media/capture/video/android/video_capture_device_android.cc +++ b/media/capture/video/android/video_capture_device_android.cc @@ -161,7 +161,7 @@ void VideoCaptureDeviceAndroid::OnFrameAvailable( if (expected_next_frame_time_ <= current_time) { expected_next_frame_time_ += frame_interval_; - client_->OnIncomingCapturedData(reinterpret_cast<uint8*>(buffer), length, + client_->OnIncomingCapturedData(reinterpret_cast<uint8_t*>(buffer), length, capture_format_, rotation, base::TimeTicks::Now()); } diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc index c12e7a0..302a0c9 100644 --- a/media/capture/video/fake_video_capture_device.cc +++ b/media/capture/video/fake_video_capture_device.cc @@ -119,7 +119,7 @@ void FakeVideoCaptureDevice::AllocateAndStart( } if (capture_format_.pixel_format == PIXEL_FORMAT_I420) { - fake_frame_.reset(new uint8[VideoFrame::AllocationSize( + fake_frame_.reset(new uint8_t[VideoFrame::AllocationSize( PIXEL_FORMAT_I420, capture_format_.frame_size)]); } diff --git a/media/capture/video/fake_video_capture_device.h b/media/capture/video/fake_video_capture_device.h index 2d8078e..ce94e24 100644 --- a/media/capture/video/fake_video_capture_device.h +++ b/media/capture/video/fake_video_capture_device.h @@ -62,7 +62,7 @@ class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { scoped_ptr<VideoCaptureDevice::Client> client_; // |fake_frame_| is used for capturing on Own Buffers. - scoped_ptr<uint8[]> fake_frame_; + scoped_ptr<uint8_t[]> fake_frame_; // Time when the next beep occurs. base::TimeDelta beep_time_; // Time since the fake video started rendering frames. diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc index fa1a95d..0af5228 100644 --- a/media/capture/video/fake_video_capture_device_unittest.cc +++ b/media/capture/video/fake_video_capture_device_unittest.cc @@ -32,7 +32,7 @@ class MockBuffer : public VideoCaptureDevice::Client::Buffer { MockBuffer(int buffer_id, size_t mapped_size) : id_(buffer_id), mapped_size_(mapped_size), - data_(new uint8[mapped_size]) {} + data_(new uint8_t[mapped_size]) {} ~MockBuffer() override { delete[] data_; } int id() const override { return id_; } @@ -49,7 +49,7 @@ class MockBuffer : public VideoCaptureDevice::Client::Buffer { private: const int id_; const size_t mapped_size_; - uint8* const data_; + uint8_t* const data_; }; class MockClient : public VideoCaptureDevice::Client { @@ -62,16 +62,16 @@ class MockClient : public VideoCaptureDevice::Client { : frame_cb_(frame_cb) {} // Client virtual methods for capturing using Device Buffers. - void OnIncomingCapturedData(const uint8* data, + void OnIncomingCapturedData(const uint8_t* data, int length, const VideoCaptureFormat& format, int rotation, const base::TimeTicks& timestamp) { frame_cb_.Run(format); } - void OnIncomingCapturedYuvData(const uint8* y_data, - const uint8* u_data, - const uint8* v_data, + void OnIncomingCapturedYuvData(const uint8_t* y_data, + const uint8_t* u_data, + const uint8_t* v_data, size_t y_stride, size_t u_stride, size_t v_stride, diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc index 4bb2b8a..595ea38 100644 --- a/media/capture/video/linux/v4l2_capture_delegate.cc +++ b/media/capture/video/linux/v4l2_capture_delegate.cc @@ -24,7 +24,7 @@ namespace media { // buffers by v4l2 driver can be higher or lower than this number. // kNumVideoBuffers should not be too small, or Chrome may not return enough // buffers back to driver in time. -const uint32 kNumVideoBuffers = 4; +const uint32_t kNumVideoBuffers = 4; // Timeout in milliseconds v4l2_thread_ blocks waiting for a frame from the hw. const int kCaptureTimeoutMs = 200; // The number of continuous timeouts tolerated before treated as error. diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc index f7dfa53..f1d89f8 100644 --- a/media/capture/video/linux/video_capture_device_factory_linux.cc +++ b/media/capture/video/linux/video_capture_device_factory_linux.cc @@ -23,7 +23,7 @@ namespace media { -static bool HasUsableFormats(int fd, uint32 capabilities) { +static bool HasUsableFormats(int fd, uint32_t capabilities) { const std::list<uint32_t>& usable_fourccs = VideoCaptureDeviceLinux::GetListOfUsableFourCCs(false); @@ -51,9 +51,9 @@ static bool HasUsableFormats(int fd, uint32 capabilities) { } static std::list<float> GetFrameRateList(int fd, - uint32 fourcc, - uint32 width, - uint32 height) { + uint32_t fourcc, + uint32_t width, + uint32_t height) { std::list<float> frame_rates; v4l2_frmivalenum frame_interval = {}; diff --git a/media/capture/video/linux/video_capture_device_linux.cc b/media/capture/video/linux/video_capture_device_linux.cc index 0d55d27..e6390b5 100644 --- a/media/capture/video/linux/video_capture_device_linux.cc +++ b/media/capture/video/linux/video_capture_device_linux.cc @@ -43,8 +43,8 @@ static bool ReadIdFile(const std::string& path, std::string* id) { // Translates Video4Linux pixel formats to Chromium pixel formats. // static -VideoPixelFormat -VideoCaptureDeviceLinux::V4l2FourCcToChromiumPixelFormat(uint32 v4l2_fourcc) { +VideoPixelFormat VideoCaptureDeviceLinux::V4l2FourCcToChromiumPixelFormat( + uint32_t v4l2_fourcc) { return V4L2CaptureDelegate::V4l2FourCcToChromiumPixelFormat(v4l2_fourcc); } diff --git a/media/capture/video/linux/video_capture_device_linux.h b/media/capture/video/linux/video_capture_device_linux.h index 100d87f..b8918e5 100644 --- a/media/capture/video/linux/video_capture_device_linux.h +++ b/media/capture/video/linux/video_capture_device_linux.h @@ -25,8 +25,7 @@ class V4L2CaptureDelegate; // Linux V4L2 implementation of VideoCaptureDevice. class VideoCaptureDeviceLinux : public VideoCaptureDevice { public: - static VideoPixelFormat V4l2FourCcToChromiumPixelFormat( - uint32 v4l2_fourcc); + static VideoPixelFormat V4l2FourCcToChromiumPixelFormat(uint32_t v4l2_fourcc); static std::list<uint32_t> GetListOfUsableFourCCs(bool favour_mjpeg); explicit VideoCaptureDeviceLinux(const Name& device_name); diff --git a/media/capture/video/mac/video_capture_device_decklink_mac.h b/media/capture/video/mac/video_capture_device_decklink_mac.h index 8718e03..5a584b0 100644 --- a/media/capture/video/mac/video_capture_device_decklink_mac.h +++ b/media/capture/video/mac/video_capture_device_decklink_mac.h @@ -49,7 +49,7 @@ class MEDIA_EXPORT VideoCaptureDeviceDeckLinkMac : public VideoCaptureDevice { // Copy of VideoCaptureDevice::Client::OnIncomingCapturedData(). Used by // |decklink_capture_delegate_| to forward captured frames. - void OnIncomingCapturedData(const uint8* data, + void OnIncomingCapturedData(const uint8_t* data, size_t length, const VideoCaptureFormat& frame_format, int rotation, // Clockwise. diff --git a/media/capture/video/mac/video_capture_device_decklink_mac.mm b/media/capture/video/mac/video_capture_device_decklink_mac.mm index 6877f96..9dc9865 100644 --- a/media/capture/video/mac/video_capture_device_decklink_mac.mm +++ b/media/capture/video/mac/video_capture_device_decklink_mac.mm @@ -232,7 +232,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived( IDeckLinkVideoInputFrame* video_frame, IDeckLinkAudioInputPacket* /* audio_packet */) { // Capture frames are manipulated as an IDeckLinkVideoFrame. - uint8* video_data = NULL; + uint8_t* video_data = NULL; video_frame->GetBytes(reinterpret_cast<void**>(&video_data)); media::VideoPixelFormat pixel_format = @@ -444,7 +444,7 @@ VideoCaptureDeviceDeckLinkMac::~VideoCaptureDeviceDeckLinkMac() { } void VideoCaptureDeviceDeckLinkMac::OnIncomingCapturedData( - const uint8* data, + const uint8_t* data, size_t length, const VideoCaptureFormat& frame_format, int rotation, // Clockwise. diff --git a/media/capture/video/mac/video_capture_device_mac.h b/media/capture/video/mac/video_capture_device_mac.h index c6ac509..4d4f228 100644 --- a/media/capture/video/mac/video_capture_device_mac.h +++ b/media/capture/video/mac/video_capture_device_mac.h @@ -70,7 +70,7 @@ class VideoCaptureDeviceMac : public VideoCaptureDevice { bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); // Called to deliver captured video frames. - void ReceiveFrame(const uint8* video_frame, + void ReceiveFrame(const uint8_t* video_frame, int video_frame_length, const VideoCaptureFormat& frame_format, int aspect_numerator, diff --git a/media/capture/video/mac/video_capture_device_mac.mm b/media/capture/video/mac/video_capture_device_mac.mm index d96670b..fa8eddd 100644 --- a/media/capture/video/mac/video_capture_device_mac.mm +++ b/media/capture/video/mac/video_capture_device_mac.mm @@ -465,7 +465,7 @@ bool VideoCaptureDeviceMac::Init( return true; } -void VideoCaptureDeviceMac::ReceiveFrame(const uint8* video_frame, +void VideoCaptureDeviceMac::ReceiveFrame(const uint8_t* video_frame, int video_frame_length, const VideoCaptureFormat& frame_format, int aspect_numerator, diff --git a/media/capture/video/video_capture_device.h b/media/capture/video/video_capture_device.h index 099cf28..20e8bcb 100644 --- a/media/capture/video/video_capture_device.h +++ b/media/capture/video/video_capture_device.h @@ -203,7 +203,7 @@ class MEDIA_EXPORT VideoCaptureDevice { // be tightly packed. This method will try to reserve an output buffer and // copy from |data| into the output buffer. If no output buffer is // available, the frame will be silently dropped. - virtual void OnIncomingCapturedData(const uint8* data, + virtual void OnIncomingCapturedData(const uint8_t* data, int length, const VideoCaptureFormat& frame_format, int clockwise_rotation, @@ -212,9 +212,9 @@ class MEDIA_EXPORT VideoCaptureDevice { // Captured a 3 planar YUV frame. Planes are possibly disjoint. // |frame_format| must indicate I420. virtual void OnIncomingCapturedYuvData( - const uint8* y_data, - const uint8* u_data, - const uint8* v_data, + const uint8_t* y_data, + const uint8_t* u_data, + const uint8_t* v_data, size_t y_stride, size_t u_stride, size_t v_stride, diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc index 150a280..c2c714e 100644 --- a/media/capture/video/video_capture_device_unittest.cc +++ b/media/capture/video/video_capture_device_unittest.cc @@ -67,9 +67,9 @@ static const gfx::Size kCaptureSizes[] = {gfx::Size(640, 480), class MockClient : public VideoCaptureDevice::Client { public: MOCK_METHOD9(OnIncomingCapturedYuvData, - void(const uint8* y_data, - const uint8* u_data, - const uint8* v_data, + void(const uint8_t* y_data, + const uint8_t* u_data, + const uint8_t* v_data, size_t y_stride, size_t u_stride, size_t v_stride, @@ -88,7 +88,7 @@ class MockClient : public VideoCaptureDevice::Client { : main_thread_(base::ThreadTaskRunnerHandle::Get()), frame_cb_(frame_cb) {} - void OnIncomingCapturedData(const uint8* data, + void OnIncomingCapturedData(const uint8_t* data, int length, const VideoCaptureFormat& format, int rotation, diff --git a/media/capture/video/win/sink_filter_observer_win.h b/media/capture/video/win/sink_filter_observer_win.h index acfc70f..14a915e 100644 --- a/media/capture/video/win/sink_filter_observer_win.h +++ b/media/capture/video/win/sink_filter_observer_win.h @@ -14,7 +14,8 @@ class SinkFilterObserver { public: // SinkFilter will call this function with all frames delivered to it. // buffer in only valid during this function call. - virtual void FrameReceived(const uint8* buffer, int length, + virtual void FrameReceived(const uint8_t* buffer, + int length, base::TimeTicks timestamp) = 0; protected: diff --git a/media/capture/video/win/sink_input_pin_win.cc b/media/capture/video/win/sink_input_pin_win.cc index 91baf2a..d0da746 100644 --- a/media/capture/video/win/sink_input_pin_win.cc +++ b/media/capture/video/win/sink_input_pin_win.cc @@ -188,7 +188,7 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) { HRESULT SinkInputPin::Receive(IMediaSample* sample) { const int length = sample->GetActualDataLength(); - uint8* buffer = NULL; + uint8_t* buffer = NULL; if (length <= 0) { DLOG(WARNING) << "Media sample length is 0 or less."; diff --git a/media/capture/video/win/video_capture_device_mf_win.cc b/media/capture/video/win/video_capture_device_mf_win.cc index 77f54f8..21a1a32 100644 --- a/media/capture/video/win/video_capture_device_mf_win.cc +++ b/media/capture/video/win/video_capture_device_mf_win.cc @@ -293,7 +293,7 @@ void VideoCaptureDeviceMFWin::StopAndDeAllocate() { } void VideoCaptureDeviceMFWin::OnIncomingCapturedData( - const uint8* data, + const uint8_t* data, int length, int rotation, const base::TimeTicks& time_stamp) { diff --git a/media/capture/video/win/video_capture_device_mf_win.h b/media/capture/video/win/video_capture_device_mf_win.h index bcc9c1f..8ca664a 100644 --- a/media/capture/video/win/video_capture_device_mf_win.h +++ b/media/capture/video/win/video_capture_device_mf_win.h @@ -50,7 +50,7 @@ class MEDIA_EXPORT VideoCaptureDeviceMFWin : public base::NonThreadSafe, void StopAndDeAllocate() override; // Captured new video data. - void OnIncomingCapturedData(const uint8* data, + void OnIncomingCapturedData(const uint8_t* data, int length, int rotation, const base::TimeTicks& time_stamp); diff --git a/media/capture/video/win/video_capture_device_win.cc b/media/capture/video/win/video_capture_device_win.cc index 92ee2a5..aa45c71 100644 --- a/media/capture/video/win/video_capture_device_win.cc +++ b/media/capture/video/win/video_capture_device_win.cc @@ -447,10 +447,9 @@ void VideoCaptureDeviceWin::StopAndDeAllocate() { } // Implements SinkFilterObserver::SinkFilterObserver. -void VideoCaptureDeviceWin::FrameReceived( - const uint8* buffer, - int length, - base::TimeTicks timestamp) { +void VideoCaptureDeviceWin::FrameReceived(const uint8_t* buffer, + int length, + base::TimeTicks timestamp) { client_->OnIncomingCapturedData(buffer, length, capture_format_, 0, timestamp); } diff --git a/media/capture/video/win/video_capture_device_win.h b/media/capture/video/win/video_capture_device_win.h index 6bd0eb4..419c3a5 100644 --- a/media/capture/video/win/video_capture_device_win.h +++ b/media/capture/video/win/video_capture_device_win.h @@ -81,7 +81,8 @@ class VideoCaptureDeviceWin : public VideoCaptureDevice, }; // Implements SinkFilterObserver. - void FrameReceived(const uint8* buffer, int length, + void FrameReceived(const uint8_t* buffer, + int length, base::TimeTicks timestamp) override; bool CreateCapabilityMap(); diff --git a/media/cast/cast_config.h b/media/cast/cast_config.h index 4ebef67..091ee25 100644 --- a/media/cast/cast_config.h +++ b/media/cast/cast_config.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/shared_memory.h" @@ -60,10 +59,10 @@ struct AudioSenderConfig { ~AudioSenderConfig(); // Identifier referring to the sender, used by the receiver. - uint32 ssrc; + uint32_t ssrc; // The receiver's SSRC identifier. - uint32 receiver_ssrc; + uint32_t receiver_ssrc; // The total amount of time between a frame's capture/recording on the sender // and its playback on the receiver (i.e., shown to a user). This should be @@ -98,10 +97,10 @@ struct VideoSenderConfig { ~VideoSenderConfig(); // Identifier referring to the sender, used by the receiver. - uint32 ssrc; + uint32_t ssrc; // The receiver's SSRC identifier. - uint32 receiver_ssrc; + uint32_t receiver_ssrc; // The total amount of time between a frame's capture/recording on the sender // and its playback on the receiver (i.e., shown to a user). This should be @@ -154,10 +153,10 @@ struct FrameReceiverConfig { ~FrameReceiverConfig(); // The receiver's SSRC identifier. - uint32 receiver_ssrc; + uint32_t receiver_ssrc; // The sender's SSRC identifier. - uint32 sender_ssrc; + uint32_t sender_ssrc; // The total amount of time between a frame's capture/recording on the sender // and its playback on the receiver (i.e., shown to a user). This is fixed as diff --git a/media/cast/cast_defines.h b/media/cast/cast_defines.h index 6860797..d839b59 100644 --- a/media/cast/cast_defines.h +++ b/media/cast/cast_defines.h @@ -13,37 +13,38 @@ namespace cast { // TODO(miu): All remaining functions in this file are to be replaced with // methods in well-defined data types. http://crbug.com/530839 -inline bool IsNewerFrameId(uint32 frame_id, uint32 prev_frame_id) { +inline bool IsNewerFrameId(uint32_t frame_id, uint32_t prev_frame_id) { return (frame_id != prev_frame_id) && - static_cast<uint32>(frame_id - prev_frame_id) < 0x80000000; + static_cast<uint32_t>(frame_id - prev_frame_id) < 0x80000000; } -inline bool IsNewerRtpTimestamp(uint32 timestamp, uint32 prev_timestamp) { +inline bool IsNewerRtpTimestamp(uint32_t timestamp, uint32_t prev_timestamp) { return (timestamp != prev_timestamp) && - static_cast<uint32>(timestamp - prev_timestamp) < 0x80000000; + static_cast<uint32_t>(timestamp - prev_timestamp) < 0x80000000; } -inline bool IsOlderFrameId(uint32 frame_id, uint32 prev_frame_id) { +inline bool IsOlderFrameId(uint32_t frame_id, uint32_t prev_frame_id) { return (frame_id == prev_frame_id) || IsNewerFrameId(prev_frame_id, frame_id); } -inline bool IsNewerPacketId(uint16 packet_id, uint16 prev_packet_id) { +inline bool IsNewerPacketId(uint16_t packet_id, uint16_t prev_packet_id) { return (packet_id != prev_packet_id) && - static_cast<uint16>(packet_id - prev_packet_id) < 0x8000; + static_cast<uint16_t>(packet_id - prev_packet_id) < 0x8000; } -inline bool IsNewerSequenceNumber(uint16 sequence_number, - uint16 prev_sequence_number) { +inline bool IsNewerSequenceNumber(uint16_t sequence_number, + uint16_t prev_sequence_number) { // Same function as IsNewerPacketId just different data and name. return IsNewerPacketId(sequence_number, prev_sequence_number); } -inline base::TimeDelta RtpDeltaToTimeDelta(int64 rtp_delta, int rtp_timebase) { +inline base::TimeDelta RtpDeltaToTimeDelta(int64_t rtp_delta, + int rtp_timebase) { DCHECK_GT(rtp_timebase, 0); return rtp_delta * base::TimeDelta::FromSeconds(1) / rtp_timebase; } -inline int64 TimeDeltaToRtpDelta(base::TimeDelta delta, int rtp_timebase) { +inline int64_t TimeDeltaToRtpDelta(base::TimeDelta delta, int rtp_timebase) { DCHECK_GT(rtp_timebase, 0); return delta * rtp_timebase / base::TimeDelta::FromSeconds(1); } diff --git a/media/cast/cast_environment.h b/media/cast/cast_environment.h index 9b29d4a..39c556b 100644 --- a/media/cast/cast_environment.h +++ b/media/cast/cast_environment.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CAST_CAST_ENVIRONMENT_H_ #define MEDIA_CAST_CAST_ENVIRONMENT_H_ -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" diff --git a/media/cast/cast_receiver.h b/media/cast/cast_receiver.h index a2668c7..2b827d7 100644 --- a/media/cast/cast_receiver.h +++ b/media/cast/cast_receiver.h @@ -8,7 +8,6 @@ #ifndef MEDIA_CAST_CAST_RECEIVER_H_ #define MEDIA_CAST_CAST_RECEIVER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/cast/cast_sender.h b/media/cast/cast_sender.h index 99d3c86..c35664e 100644 --- a/media/cast/cast_sender.h +++ b/media/cast/cast_sender.h @@ -10,7 +10,6 @@ #ifndef MEDIA_CAST_CAST_SENDER_H_ #define MEDIA_CAST_CAST_SENDER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/cast/common/clock_drift_smoother.cc b/media/cast/common/clock_drift_smoother.cc index df3ffdb..01b7d06a 100644 --- a/media/cast/common/clock_drift_smoother.cc +++ b/media/cast/common/clock_drift_smoother.cc @@ -19,8 +19,8 @@ ClockDriftSmoother::~ClockDriftSmoother() {} base::TimeDelta ClockDriftSmoother::Current() const { DCHECK(!last_update_time_.is_null()); - return base::TimeDelta::FromMicroseconds( - static_cast<int64>(estimate_us_ + 0.5)); // Round to nearest microsecond. + return base::TimeDelta::FromMicroseconds(static_cast<int64_t>( + estimate_us_ + 0.5)); // Round to nearest microsecond. } void ClockDriftSmoother::Reset(base::TimeTicks now, diff --git a/media/cast/common/transport_encryption_handler.cc b/media/cast/common/transport_encryption_handler.cc index 360e40c..b0b2f96 100644 --- a/media/cast/common/transport_encryption_handler.cc +++ b/media/cast/common/transport_encryption_handler.cc @@ -15,7 +15,7 @@ namespace { const size_t kAesBlockSize = 16; const size_t kAesKeySize = 16; -std::string GetAesNonce(uint32 frame_id, const std::string& iv_mask) { +std::string GetAesNonce(uint32_t frame_id, const std::string& iv_mask) { std::string aes_nonce(kAesBlockSize, 0); // Serializing frame_id in big-endian order (aes_nonce[8] is the most @@ -61,7 +61,7 @@ bool TransportEncryptionHandler::Initialize(const std::string& aes_key, return true; } -bool TransportEncryptionHandler::Encrypt(uint32 frame_id, +bool TransportEncryptionHandler::Encrypt(uint32_t frame_id, const base::StringPiece& data, std::string* encrypted_data) { if (!is_activated_) @@ -77,7 +77,7 @@ bool TransportEncryptionHandler::Encrypt(uint32 frame_id, return true; } -bool TransportEncryptionHandler::Decrypt(uint32 frame_id, +bool TransportEncryptionHandler::Decrypt(uint32_t frame_id, const base::StringPiece& ciphertext, std::string* plaintext) { if (!is_activated_) { diff --git a/media/cast/common/transport_encryption_handler.h b/media/cast/common/transport_encryption_handler.h index d71dc49..d89a1b87 100644 --- a/media/cast/common/transport_encryption_handler.h +++ b/media/cast/common/transport_encryption_handler.h @@ -8,7 +8,6 @@ // Helper class to handle encryption for the Cast Transport library. #include <string> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" #include "base/threading/non_thread_safe.h" @@ -28,11 +27,11 @@ class TransportEncryptionHandler : public base::NonThreadSafe { bool Initialize(const std::string& aes_key, const std::string& aes_iv_mask); - bool Encrypt(uint32 frame_id, + bool Encrypt(uint32_t frame_id, const base::StringPiece& data, std::string* encrypted_data); - bool Decrypt(uint32 frame_id, + bool Decrypt(uint32_t frame_id, const base::StringPiece& ciphertext, std::string* plaintext); diff --git a/media/cast/logging/encoding_event_subscriber.cc b/media/cast/logging/encoding_event_subscriber.cc index 82ec06f..a393c22 100644 --- a/media/cast/logging/encoding_event_subscriber.cc +++ b/media/cast/logging/encoding_event_subscriber.cc @@ -103,12 +103,13 @@ void EncodingEventSubscriber::OnReceiveFrameEvent( } else if (frame_event.type == FRAME_ENCODED) { event_proto->set_encoded_frame_size(frame_event.size); if (frame_event.encoder_cpu_utilization >= 0.0) { - event_proto->set_encoder_cpu_percent_utilized(base::saturated_cast<int32>( + event_proto->set_encoder_cpu_percent_utilized( + base::saturated_cast<int32_t>( frame_event.encoder_cpu_utilization * 100.0 + 0.5)); } if (frame_event.idealized_bitrate_utilization >= 0.0) { event_proto->set_idealized_bitrate_percent_utilized( - base::saturated_cast<int32>( + base::saturated_cast<int32_t>( frame_event.idealized_bitrate_utilization * 100.0 + 0.5)); } if (frame_event.media_type == VIDEO_EVENT) { diff --git a/media/cast/logging/encoding_event_subscriber_unittest.cc b/media/cast/logging/encoding_event_subscriber_unittest.cc index 123a8fe..cfcbb34 100644 --- a/media/cast/logging/encoding_event_subscriber_unittest.cc +++ b/media/cast/logging/encoding_event_subscriber_unittest.cc @@ -19,7 +19,7 @@ using media::cast::proto::LogMetadata; namespace { -int64 InMilliseconds(base::TimeTicks event_time) { +int64_t InMilliseconds(base::TimeTicks event_time) { return (event_time - base::TimeTicks()).InMilliseconds(); } diff --git a/media/cast/logging/log_deserializer.cc b/media/cast/logging/log_deserializer.cc index 5e5b189..09f74c7 100644 --- a/media/cast/logging/log_deserializer.cc +++ b/media/cast/logging/log_deserializer.cc @@ -72,7 +72,7 @@ bool PopulateDeserializedLog(base::BigEndianReader* reader, int num_frame_events = log->metadata.num_frame_events(); RtpTimestamp relative_rtp_timestamp = 0; - uint16 proto_size = 0; + uint16_t proto_size = 0; for (int i = 0; i < num_frame_events; i++) { if (!reader->ReadU16(&proto_size)) return false; @@ -146,7 +146,7 @@ bool DoDeserializeEvents(const char* data, base::BigEndianReader reader(data, data_bytes); LogMetadata metadata; - uint16 proto_size = 0; + uint16_t proto_size = 0; while (reader.remaining() > 0) { if (!reader.ReadU16(&proto_size)) return false; @@ -186,9 +186,9 @@ bool Uncompress(const char* data, int* uncompressed_bytes) { z_stream stream = {0}; - stream.next_in = reinterpret_cast<uint8*>(const_cast<char*>(data)); + stream.next_in = reinterpret_cast<uint8_t*>(const_cast<char*>(data)); stream.avail_in = data_bytes; - stream.next_out = reinterpret_cast<uint8*>(uncompressed); + stream.next_out = reinterpret_cast<uint8_t*>(uncompressed); stream.avail_out = max_uncompressed_bytes; bool success = false; diff --git a/media/cast/logging/log_serializer.cc b/media/cast/logging/log_serializer.cc index c5cb252..732be17 100644 --- a/media/cast/logging/log_serializer.cc +++ b/media/cast/logging/log_serializer.cc @@ -47,7 +47,7 @@ bool DoSerializeEvents(const LogMetadata& metadata, int proto_size = metadata.ByteSize(); DCHECK(proto_size <= kMaxSerializedProtoBytes); - if (!writer.WriteU16(static_cast<uint16>(proto_size))) + if (!writer.WriteU16(static_cast<uint16_t>(proto_size))) return false; if (!metadata.SerializeToArray(writer.ptr(), writer.remaining())) return false; @@ -73,7 +73,7 @@ bool DoSerializeEvents(const LogMetadata& metadata, DCHECK(proto_size <= kMaxSerializedProtoBytes); // Write size of the proto, then write the proto. - if (!writer.WriteU16(static_cast<uint16>(proto_size))) + if (!writer.WriteU16(static_cast<uint16_t>(proto_size))) return false; if (!frame_event.SerializeToArray(writer.ptr(), writer.remaining())) return false; @@ -97,7 +97,7 @@ bool DoSerializeEvents(const LogMetadata& metadata, DCHECK(proto_size <= kMaxSerializedProtoBytes); // Write size of the proto, then write the proto. - if (!writer.WriteU16(static_cast<uint16>(proto_size))) + if (!writer.WriteU16(static_cast<uint16_t>(proto_size))) return false; if (!packet_event.SerializeToArray(writer.ptr(), writer.remaining())) return false; @@ -124,9 +124,9 @@ bool Compress(char* uncompressed_buffer, Z_DEFAULT_STRATEGY); DCHECK_EQ(Z_OK, result); - stream.next_in = reinterpret_cast<uint8*>(uncompressed_buffer); + stream.next_in = reinterpret_cast<uint8_t*>(uncompressed_buffer); stream.avail_in = uncompressed_bytes; - stream.next_out = reinterpret_cast<uint8*>(output); + stream.next_out = reinterpret_cast<uint8_t*>(output); stream.avail_out = max_output_bytes; // Do a one-shot compression. This will return Z_STREAM_END only if |output| diff --git a/media/cast/logging/logging_defines.h b/media/cast/logging/logging_defines.h index dc29554..607ff0d 100644 --- a/media/cast/logging/logging_defines.h +++ b/media/cast/logging/logging_defines.h @@ -14,9 +14,9 @@ namespace media { namespace cast { -static const uint32 kFrameIdUnknown = 0xFFFFFFFF; +static const uint32_t kFrameIdUnknown = 0xFFFFFFFF; -typedef uint32 RtpTimestamp; +typedef uint32_t RtpTimestamp; enum CastLoggingEvent { UNKNOWN, @@ -53,7 +53,7 @@ struct FrameEvent { ~FrameEvent(); RtpTimestamp rtp_timestamp; - uint32 frame_id; + uint32_t frame_id; // Resolution of the frame. Only set for video FRAME_CAPTURE_END events. int width; @@ -93,9 +93,9 @@ struct PacketEvent { ~PacketEvent(); RtpTimestamp rtp_timestamp; - uint32 frame_id; - uint16 max_packet_id; - uint16 packet_id; + uint32_t frame_id; + uint16_t max_packet_id; + uint16_t packet_id; size_t size; // Time of event logged. diff --git a/media/cast/logging/receiver_time_offset_estimator_impl.cc b/media/cast/logging/receiver_time_offset_estimator_impl.cc index d511654..db80fc4 100644 --- a/media/cast/logging/receiver_time_offset_estimator_impl.cc +++ b/media/cast/logging/receiver_time_offset_estimator_impl.cc @@ -17,23 +17,23 @@ ReceiverTimeOffsetEstimatorImpl::BoundCalculator::BoundCalculator() ReceiverTimeOffsetEstimatorImpl::BoundCalculator::~BoundCalculator() {} void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::SetSent( - uint32 rtp, - uint32 packet_id, + uint32_t rtp, + uint32_t packet_id, bool audio, base::TimeTicks t) { - uint64 key = (static_cast<uint64>(rtp) << 32) | (packet_id << 1) | - static_cast<uint64>(audio); + uint64_t key = (static_cast<uint64_t>(rtp) << 32) | (packet_id << 1) | + static_cast<uint64_t>(audio); events_[key].first = t; CheckUpdate(key); } void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::SetReceived( - uint32 rtp, - uint16 packet_id, + uint32_t rtp, + uint16_t packet_id, bool audio, base::TimeTicks t) { - uint64 key = (static_cast<uint64>(rtp) << 32) | (packet_id << 1) | - static_cast<uint64>(audio); + uint64_t key = (static_cast<uint64_t>(rtp) << 32) | (packet_id << 1) | + static_cast<uint64_t>(audio); events_[key].second = t; CheckUpdate(key); } @@ -53,8 +53,8 @@ void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::UpdateBound( has_bound_ = true; } -void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::CheckUpdate( - uint64 key) { + void ReceiverTimeOffsetEstimatorImpl::BoundCalculator::CheckUpdate( + uint64_t key) { const TimeTickPair& ticks = events_[key]; if (!ticks.first.is_null() && !ticks.second.is_null()) { UpdateBound(ticks.first, ticks.second); diff --git a/media/cast/logging/receiver_time_offset_estimator_impl.h b/media/cast/logging/receiver_time_offset_estimator_impl.h index c2b6455..77d5275 100644 --- a/media/cast/logging/receiver_time_offset_estimator_impl.h +++ b/media/cast/logging/receiver_time_offset_estimator_impl.h @@ -58,26 +58,26 @@ class ReceiverTimeOffsetEstimatorImpl : public ReceiverTimeOffsetEstimator { class BoundCalculator { public: typedef std::pair<base::TimeTicks, base::TimeTicks> TimeTickPair; - typedef std::map<uint64, TimeTickPair> EventMap; + typedef std::map<uint64_t, TimeTickPair> EventMap; BoundCalculator(); ~BoundCalculator(); bool has_bound() const { return has_bound_; } base::TimeDelta bound() const { return bound_; } - void SetSent(uint32 rtp, - uint32 packet_id, + void SetSent(uint32_t rtp, + uint32_t packet_id, bool audio, base::TimeTicks t); - void SetReceived(uint32 rtp, - uint16 packet_id, + void SetReceived(uint32_t rtp, + uint16_t packet_id, bool audio, base::TimeTicks t); private: void UpdateBound(base::TimeTicks a, base::TimeTicks b); - void CheckUpdate(uint64 key); + void CheckUpdate(uint64_t key); private: EventMap events_; diff --git a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc index 2cbaafd..eab8ff3 100644 --- a/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc +++ b/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc @@ -50,7 +50,7 @@ class ReceiverTimeOffsetEstimatorImplTest : public ::testing::Test { // Event C occurred at sender time 60ms. // Then the bound after all 3 events have arrived is [130-60=70, 130-20=110]. TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) { - int64 true_offset_ms = 100; + int64_t true_offset_ms = 100; receiver_clock_.Advance(base::TimeDelta::FromMilliseconds(true_offset_ms)); base::TimeDelta lower_bound; @@ -59,7 +59,7 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) { EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound)); RtpTimestamp rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t frame_id = 0; AdvanceClocks(base::TimeDelta::FromMilliseconds(20)); @@ -122,8 +122,8 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) { EXPECT_TRUE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound)); - int64 lower_bound_ms = lower_bound.InMilliseconds(); - int64 upper_bound_ms = upper_bound.InMilliseconds(); + int64_t lower_bound_ms = lower_bound.InMilliseconds(); + int64_t upper_bound_ms = upper_bound.InMilliseconds(); EXPECT_EQ(70, lower_bound_ms); EXPECT_EQ(110, upper_bound_ms); EXPECT_GE(true_offset_ms, lower_bound_ms); @@ -133,7 +133,7 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EstimateOffset) { // Same scenario as above, but event C arrives before event B. It doesn't mean // event C occurred before event B. TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) { - int64 true_offset_ms = 100; + int64_t true_offset_ms = 100; receiver_clock_.Advance(base::TimeDelta::FromMilliseconds(true_offset_ms)); base::TimeDelta lower_bound; @@ -142,7 +142,7 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) { EXPECT_FALSE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound)); RtpTimestamp rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t frame_id = 0; AdvanceClocks(base::TimeDelta::FromMilliseconds(20)); @@ -208,8 +208,8 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) { EXPECT_TRUE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound)); - int64 lower_bound_ms = lower_bound.InMilliseconds(); - int64 upper_bound_ms = upper_bound.InMilliseconds(); + int64_t lower_bound_ms = lower_bound.InMilliseconds(); + int64_t upper_bound_ms = upper_bound.InMilliseconds(); EXPECT_EQ(70, lower_bound_ms); EXPECT_EQ(110, upper_bound_ms); EXPECT_GE(true_offset_ms, lower_bound_ms); @@ -217,7 +217,7 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, EventCArrivesBeforeEventB) { } TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) { - int64 true_offset_ms = 100; + int64_t true_offset_ms = 100; receiver_clock_.Advance(base::TimeDelta::FromMilliseconds(true_offset_ms)); base::TimeDelta lower_bound; @@ -387,8 +387,8 @@ TEST_F(ReceiverTimeOffsetEstimatorImplTest, MultipleIterations) { cast_environment_->logger()->DispatchFrameEvent(ack_event.Pass()); EXPECT_TRUE(estimator_.GetReceiverOffsetBounds(&lower_bound, &upper_bound)); - int64 lower_bound_ms = lower_bound.InMilliseconds(); - int64 upper_bound_ms = upper_bound.InMilliseconds(); + int64_t lower_bound_ms = lower_bound.InMilliseconds(); + int64_t upper_bound_ms = upper_bound.InMilliseconds(); EXPECT_GT(lower_bound_ms, 90); EXPECT_LE(lower_bound_ms, true_offset_ms); EXPECT_LT(upper_bound_ms, 150); diff --git a/media/cast/logging/serialize_deserialize_test.cc b/media/cast/logging/serialize_deserialize_test.cc index f1766d0..aa4ba1d 100644 --- a/media/cast/logging/serialize_deserialize_test.cc +++ b/media/cast/logging/serialize_deserialize_test.cc @@ -31,7 +31,7 @@ const media::cast::CastLoggingEvent kVideoPacketEvents[] = { const int kWidth[] = {1280, 1280, 1280, 1280, 1920, 1920, 1920, 1920}; const int kHeight[] = {720, 720, 720, 720, 1080, 1080, 1080, 1080}; const int kEncodedFrameSize[] = {512, 425, 399, 400, 237}; -const int64 kDelayMillis[] = {15, 4, 8, 42, 23, 16}; +const int64_t kDelayMillis[] = {15, 4, 8, 42, 23, 16}; const int kEncoderCPUPercentUtilized[] = {10, 9, 42, 3, 11, 12, 15, 7}; const int kIdealizedBitratePercentUtilized[] = {9, 9, 9, 15, 36, 38, 35, 40}; @@ -55,12 +55,12 @@ class SerializeDeserializeTest : public ::testing::Test { metadata_.set_num_frame_events(10); metadata_.set_num_packet_events(10); - int64 event_time_ms = 0; + int64_t event_time_ms = 0; // Insert frame and packet events with RTP timestamps 0, 90, 180, ... for (int i = 0; i < metadata_.num_frame_events(); i++) { linked_ptr<AggregatedFrameEvent> frame_event(new AggregatedFrameEvent); frame_event->set_relative_rtp_timestamp(i * 90); - for (uint32 event_index = 0; event_index < arraysize(kVideoFrameEvents); + for (uint32_t event_index = 0; event_index < arraysize(kVideoFrameEvents); ++event_index) { frame_event->add_event_type( ToProtoEventType(kVideoFrameEvents[event_index])); @@ -90,9 +90,8 @@ class SerializeDeserializeTest : public ::testing::Test { BasePacketEvent* base_event = packet_event->add_base_packet_event(); base_event->set_packet_id(packet_id); packet_id++; - for (uint32 event_index = 0; - event_index < arraysize(kVideoPacketEvents); - ++event_index) { + for (uint32_t event_index = 0; + event_index < arraysize(kVideoPacketEvents); ++event_index) { base_event->add_event_type( ToProtoEventType(kVideoPacketEvents[event_index])); base_event->add_event_timestamp_ms(event_time_ms); diff --git a/media/cast/logging/simple_event_subscriber.cc b/media/cast/logging/simple_event_subscriber.cc index cad9956..7146f64 100644 --- a/media/cast/logging/simple_event_subscriber.cc +++ b/media/cast/logging/simple_event_subscriber.cc @@ -4,7 +4,6 @@ #include "media/cast/logging/simple_event_subscriber.h" - #include "base/logging.h" namespace media { diff --git a/media/cast/logging/stats_event_subscriber.cc b/media/cast/logging/stats_event_subscriber.cc index a254e63..ff5e6f8 100644 --- a/media/cast/logging/stats_event_subscriber.cc +++ b/media/cast/logging/stats_event_subscriber.cc @@ -35,9 +35,9 @@ bool IsReceiverEvent(CastLoggingEvent event) { } // namespace -StatsEventSubscriber::SimpleHistogram::SimpleHistogram(int64 min, - int64 max, - int64 width) +StatsEventSubscriber::SimpleHistogram::SimpleHistogram(int64_t min, + int64_t max, + int64_t width) : min_(min), max_(max), width_(width), buckets_((max - min) / width + 2) { CHECK_GT(buckets_.size(), 2u); CHECK_EQ(0, (max_ - min_) % width_); @@ -46,7 +46,7 @@ StatsEventSubscriber::SimpleHistogram::SimpleHistogram(int64 min, StatsEventSubscriber::SimpleHistogram::~SimpleHistogram() { } -void StatsEventSubscriber::SimpleHistogram::Add(int64 sample) { +void StatsEventSubscriber::SimpleHistogram::Add(int64_t sample) { if (sample < min_) { ++buckets_.front(); } else if (sample >= max_) { @@ -78,8 +78,8 @@ StatsEventSubscriber::SimpleHistogram::GetHistogram() const { if (!buckets_[i]) continue; bucket.reset(new base::DictionaryValue); - int64 lower = min_ + (i - 1) * width_; - int64 upper = lower + width_ - 1; + int64_t lower = min_ + (i - 1) * width_; + int64_t upper = lower + width_ - 1; bucket->SetInteger( base::StringPrintf("%" PRId64 "-%" PRId64, lower, upper), buckets_[i]); @@ -596,7 +596,7 @@ void StatsEventSubscriber::UpdateLastResponseTime( void StatsEventSubscriber::ErasePacketSentTime( const PacketEvent& packet_event) { - std::pair<RtpTimestamp, uint16> key( + std::pair<RtpTimestamp, uint16_t> key( std::make_pair(packet_event.rtp_timestamp, packet_event.packet_id)); packet_sent_times_.erase(key); } @@ -622,7 +622,7 @@ void StatsEventSubscriber::RecordPacketRelatedLatencies( if (!GetReceiverOffset(&receiver_offset)) return; - std::pair<RtpTimestamp, uint16> key( + std::pair<RtpTimestamp, uint16_t> key( std::make_pair(packet_event.rtp_timestamp, packet_event.packet_id)); PacketEventTimeMap::iterator it = packet_sent_times_.find(key); if (it == packet_sent_times_.end()) { diff --git a/media/cast/logging/stats_event_subscriber.h b/media/cast/logging/stats_event_subscriber.h index 36d5110..c1a1e19 100644 --- a/media/cast/logging/stats_event_subscriber.h +++ b/media/cast/logging/stats_event_subscriber.h @@ -90,20 +90,20 @@ class StatsEventSubscriber : public RawEventSubscriber { // Overflow bucket: >= max // |min| must be less than |max|. // |width| must divide |max - min| evenly. - SimpleHistogram(int64 min, int64 max, int64 width); + SimpleHistogram(int64_t min, int64_t max, int64_t width); ~SimpleHistogram(); - void Add(int64 sample); + void Add(int64_t sample); void Reset(); scoped_ptr<base::ListValue> GetHistogram() const; private: - int64 min_; - int64 max_; - int64 width_; + int64_t min_; + int64_t max_; + int64_t width_; std::vector<int> buckets_; }; @@ -183,9 +183,8 @@ class StatsEventSubscriber : public RawEventSubscriber { typedef std::map<CastStat, double> StatsMap; typedef std::map<CastStat, linked_ptr<SimpleHistogram> > HistogramMap; typedef std::map<RtpTimestamp, FrameInfo> FrameInfoMap; - typedef std::map< - std::pair<RtpTimestamp, uint16>, - std::pair<base::TimeTicks, CastLoggingEvent> > + typedef std::map<std::pair<RtpTimestamp, uint16_t>, + std::pair<base::TimeTicks, CastLoggingEvent>> PacketEventTimeMap; typedef std::map<CastLoggingEvent, FrameLogStats> FrameStatsMap; typedef std::map<CastLoggingEvent, PacketLogStats> PacketStatsMap; diff --git a/media/cast/logging/stats_event_subscriber_unittest.cc b/media/cast/logging/stats_event_subscriber_unittest.cc index d649c89..0cec20f 100644 --- a/media/cast/logging/stats_event_subscriber_unittest.cc +++ b/media/cast/logging/stats_event_subscriber_unittest.cc @@ -67,8 +67,8 @@ class StatsEventSubscriberTest : public ::testing::Test { TEST_F(StatsEventSubscriberTest, CaptureEncode) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 0; + uint32_t frame_id = 0; int extra_frames = 50; // Only the first |extra_frames| frames logged will be taken into account // when computing dropped frames. @@ -147,8 +147,8 @@ TEST_F(StatsEventSubscriberTest, CaptureEncode) { TEST_F(StatsEventSubscriberTest, Encode) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 0; + uint32_t frame_id = 0; int num_frames = 10; base::TimeTicks start_time = sender_clock_->NowTicks(); AdvanceClocks(base::TimeDelta::FromMicroseconds(35678)); @@ -215,8 +215,8 @@ TEST_F(StatsEventSubscriberTest, Encode) { TEST_F(StatsEventSubscriberTest, Decode) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 0; + uint32_t frame_id = 0; int num_frames = 10; base::TimeTicks start_time = sender_clock_->NowTicks(); for (int i = 0; i < num_frames; i++) { @@ -251,8 +251,8 @@ TEST_F(StatsEventSubscriberTest, Decode) { TEST_F(StatsEventSubscriberTest, PlayoutDelay) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 0; + uint32_t frame_id = 0; int num_frames = 10; int late_frames = 0; for (int i = 0, delay_ms = -50; i < num_frames; i++, delay_ms += 10) { @@ -286,8 +286,8 @@ TEST_F(StatsEventSubscriberTest, PlayoutDelay) { TEST_F(StatsEventSubscriberTest, E2ELatency) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 0; + uint32_t frame_id = 0; int num_frames = 10; base::TimeDelta total_latency; for (int i = 0; i < num_frames; i++) { @@ -333,7 +333,7 @@ TEST_F(StatsEventSubscriberTest, E2ELatency) { TEST_F(StatsEventSubscriberTest, Packets) { Init(VIDEO_EVENT); - uint32 rtp_timestamp = 0; + uint32_t rtp_timestamp = 0; int num_packets = 10; int num_latency_recorded_packets = 0; base::TimeTicks start_time = sender_clock_->NowTicks(); @@ -557,8 +557,8 @@ TEST_F(StatsEventSubscriberTest, Histograms) { Init(VIDEO_EVENT); AdvanceClocks(base::TimeDelta::FromMilliseconds(123)); - uint32 rtp_timestamp = 123; - uint32 frame_id = 0; + uint32_t rtp_timestamp = 123; + uint32_t frame_id = 0; // 10 Frames with capture latency in the bucket of "10-14"ms. // 10 Frames with encode time in the bucket of "15-19"ms. diff --git a/media/cast/net/cast_transport_config.h b/media/cast/net/cast_transport_config.h index 7cdeec9..eb3cac6 100644 --- a/media/cast/net/cast_transport_config.h +++ b/media/cast/net/cast_transport_config.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/callback.h" #include "base/stl_util.h" #include "media/cast/net/cast_transport_defines.h" @@ -31,10 +30,10 @@ struct CastTransportRtpConfig { ~CastTransportRtpConfig(); // Identifier refering to this sender. - uint32 ssrc; + uint32_t ssrc; // Identifier for incoming RTCP traffic. - uint32 feedback_ssrc; + uint32_t feedback_ssrc; // RTP payload type enum: Specifies the type/encoding of frame data. int rtp_payload_type; @@ -70,13 +69,13 @@ struct EncodedFrame { EncodedFrame(); virtual ~EncodedFrame(); - // Convenience accessors to data as an array of uint8 elements. - const uint8* bytes() const { - return reinterpret_cast<uint8*>(string_as_array( - const_cast<std::string*>(&data))); + // Convenience accessors to data as an array of uint8_t elements. + const uint8_t* bytes() const { + return reinterpret_cast<uint8_t*>( + string_as_array(const_cast<std::string*>(&data))); } - uint8* mutable_bytes() { - return reinterpret_cast<uint8*>(string_as_array(&data)); + uint8_t* mutable_bytes() { + return reinterpret_cast<uint8_t*>(string_as_array(&data)); } // Copies all data members except |data| to |dest|. @@ -88,19 +87,19 @@ struct EncodedFrame { // The label associated with this frame. Implies an ordering relative to // other frames in the same stream. - uint32 frame_id; + uint32_t frame_id; // The label associated with the frame upon which this frame depends. If // this frame does not require any other frame in order to become decodable // (e.g., key frames), |referenced_frame_id| must equal |frame_id|. - uint32 referenced_frame_id; + uint32_t referenced_frame_id; // The stream timestamp, on the timeline of the signal data. For example, RTP // timestamps for audio are usually defined as the total number of audio // samples encoded in all prior frames. A playback system uses this value to // detect gaps in the stream, and otherwise stretch the signal to match // playout targets. - uint32 rtp_timestamp; + uint32_t rtp_timestamp; // The common reference clock timestamp for this frame. This value originates // from a sender and is used to provide lip synchronization between streams in @@ -113,7 +112,7 @@ struct EncodedFrame { // Playout delay for this and all future frames. Used by the Adaptive // Playout delay extension. Zero means no change. - uint16 new_playout_delay_ms; + uint16_t new_playout_delay_ms; // The encoded signal data. std::string data; @@ -133,7 +132,7 @@ class PacketSender { virtual bool SendPacket(PacketRef packet, const base::Closure& cb) = 0; // Returns the number of bytes ever sent. - virtual int64 GetBytesSent() = 0; + virtual int64_t GetBytesSent() = 0; virtual ~PacketSender() {} }; @@ -143,31 +142,31 @@ struct RtcpSenderInfo { ~RtcpSenderInfo(); // First three members are used for lipsync. // First two members are used for rtt. - uint32 ntp_seconds; - uint32 ntp_fraction; - uint32 rtp_timestamp; - uint32 send_packet_count; + uint32_t ntp_seconds; + uint32_t ntp_fraction; + uint32_t rtp_timestamp; + uint32_t send_packet_count; size_t send_octet_count; }; struct RtcpReportBlock { RtcpReportBlock(); ~RtcpReportBlock(); - uint32 remote_ssrc; // SSRC of sender of this report. - uint32 media_ssrc; // SSRC of the RTP packet sender. - uint8 fraction_lost; - uint32 cumulative_lost; // 24 bits valid. - uint32 extended_high_sequence_number; - uint32 jitter; - uint32 last_sr; - uint32 delay_since_last_sr; + uint32_t remote_ssrc; // SSRC of sender of this report. + uint32_t media_ssrc; // SSRC of the RTP packet sender. + uint8_t fraction_lost; + uint32_t cumulative_lost; // 24 bits valid. + uint32_t extended_high_sequence_number; + uint32_t jitter; + uint32_t last_sr; + uint32_t delay_since_last_sr; }; struct RtcpDlrrReportBlock { RtcpDlrrReportBlock(); ~RtcpDlrrReportBlock(); - uint32 last_rr; - uint32 delay_since_last_rr; + uint32_t last_rr; + uint32_t delay_since_last_rr; }; inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { diff --git a/media/cast/net/cast_transport_defines.h b/media/cast/net/cast_transport_defines.h index bdd5494..cddd055 100644 --- a/media/cast/net/cast_transport_defines.h +++ b/media/cast/net/cast_transport_defines.h @@ -12,7 +12,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" @@ -41,10 +40,10 @@ const uint16_t kRtcpCastLastPacket = 0xfffe; const size_t kMaxIpPacketSize = 1500; -// Each uint16 represents one packet id within a cast frame. +// Each uint16_t represents one packet id within a cast frame. // Can also contain kRtcpCastAllPacketsLost and kRtcpCastLastPacket. using PacketIdSet = std::set<uint16_t>; -// Each uint8 represents one cast frame. +// Each uint8_t represents one cast frame. using MissingFramesAndPacketsMap = std::map<uint8_t, PacketIdSet>; using Packet = std::vector<uint8_t>; @@ -60,8 +59,8 @@ class FrameIdWrapHelper { explicit FrameIdWrapHelper(uint32_t start_frame_id) : largest_frame_id_seen_(start_frame_id) {} - uint32 MapTo32bitsFrameId(const uint8 over_the_wire_frame_id) { - uint32 ret = (largest_frame_id_seen_ & ~0xff) | over_the_wire_frame_id; + uint32_t MapTo32bitsFrameId(const uint8_t over_the_wire_frame_id) { + uint32_t ret = (largest_frame_id_seen_ & ~0xff) | over_the_wire_frame_id; // Add 1000 to both sides to avoid underflows. if (1000 + ret - largest_frame_id_seen_ > 1000 + 127) { ret -= 0x100; @@ -77,7 +76,7 @@ class FrameIdWrapHelper { private: friend class FrameIdWrapHelperTest; - uint32 largest_frame_id_seen_; + uint32_t largest_frame_id_seen_; DISALLOW_COPY_AND_ASSIGN(FrameIdWrapHelper); }; diff --git a/media/cast/net/cast_transport_sender.h b/media/cast/net/cast_transport_sender.h index b20c9df..5988928 100644 --- a/media/cast/net/cast_transport_sender.h +++ b/media/cast/net/cast_transport_sender.h @@ -18,7 +18,6 @@ #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ #define MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" @@ -82,26 +81,25 @@ class CastTransportSender : public base::NonThreadSafe { // Encrypt, packetize and transmit |frame|. |ssrc| must refer to a // a channel already established with InitializeAudio / InitializeVideo. - virtual void InsertFrame(uint32 ssrc, const EncodedFrame& frame) = 0; + virtual void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) = 0; // Sends a RTCP sender report to the receiver. // |ssrc| is the SSRC for this report. // |current_time| is the current time reported by a tick clock. // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp. - virtual void SendSenderReport( - uint32 ssrc, - base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp) = 0; + virtual void SendSenderReport(uint32_t ssrc, + base::TimeTicks current_time, + uint32_t current_time_as_rtp_timestamp) = 0; // Cancels sending packets for the frames in the set. // |ssrc| is the SSRC for the stream. // |frame_ids| contains the IDs of the frames that will be cancelled. - virtual void CancelSendingFrames(uint32 ssrc, - const std::vector<uint32>& frame_ids) = 0; + virtual void CancelSendingFrames(uint32_t ssrc, + const std::vector<uint32_t>& frame_ids) = 0; // Resends a frame or part of a frame to kickstart. This is used when the // stream appears to be stalled. - virtual void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) = 0; + virtual void ResendFrameForKickstart(uint32_t ssrc, uint32_t frame_id) = 0; // Returns a callback for receiving packets for testing purposes. virtual PacketReceiverCallback PacketReceiverForTesting(); @@ -111,12 +109,12 @@ class CastTransportSender : public base::NonThreadSafe { // Add a valid SSRC. This is used to verify that incoming packets // come from the right sender. Without valid SSRCs, the return address cannot // be automatically established. - virtual void AddValidSsrc(uint32 ssrc) = 0; + virtual void AddValidSsrc(uint32_t ssrc) = 0; // Send an RTCP message from receiver to sender. virtual void SendRtcpFromRtpReceiver( - uint32 ssrc, - uint32 sender_ssrc, + uint32_t ssrc, + uint32_t sender_ssrc, const RtcpTimeData& time_data, const RtcpCastMessage* cast_message, base::TimeDelta target_delay, diff --git a/media/cast/net/cast_transport_sender_impl.cc b/media/cast/net/cast_transport_sender_impl.cc index f473219..10646ee 100644 --- a/media/cast/net/cast_transport_sender_impl.cc +++ b/media/cast/net/cast_transport_sender_impl.cc @@ -38,13 +38,14 @@ int LookupOptionWithDefault(const base::DictionaryValue& options, } }; -int32 GetTransportSendBufferSize(const base::DictionaryValue& options) { +int32_t GetTransportSendBufferSize(const base::DictionaryValue& options) { // Socket send buffer size needs to be at least greater than one burst // size. - int32 max_burst_size = + int32_t max_burst_size = LookupOptionWithDefault(options, kOptionPacerMaxBurstSize, - kMaxBurstSize) * kMaxIpPacketSize; - int32 min_send_buffer_size = + kMaxBurstSize) * + kMaxIpPacketSize; + int32_t min_send_buffer_size = LookupOptionWithDefault(options, kOptionSendBufferMinSize, 0); return std::max(max_burst_size, min_send_buffer_size); } @@ -254,7 +255,7 @@ void EncryptAndSendFrame(const EncodedFrame& frame, } } // namespace -void CastTransportSenderImpl::InsertFrame(uint32 ssrc, +void CastTransportSenderImpl::InsertFrame(uint32_t ssrc, const EncodedFrame& frame) { if (audio_sender_ && ssrc == audio_sender_->ssrc()) { EncryptAndSendFrame(frame, &audio_encryptor_, audio_sender_.get()); @@ -266,9 +267,9 @@ void CastTransportSenderImpl::InsertFrame(uint32 ssrc, } void CastTransportSenderImpl::SendSenderReport( - uint32 ssrc, + uint32_t ssrc, base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp) { + uint32_t current_time_as_rtp_timestamp) { if (audio_sender_ && ssrc == audio_sender_->ssrc()) { audio_rtcp_session_->SendRtcpFromRtpSender( current_time, current_time_as_rtp_timestamp, @@ -283,8 +284,8 @@ void CastTransportSenderImpl::SendSenderReport( } void CastTransportSenderImpl::CancelSendingFrames( - uint32 ssrc, - const std::vector<uint32>& frame_ids) { + uint32_t ssrc, + const std::vector<uint32_t>& frame_ids) { if (audio_sender_ && ssrc == audio_sender_->ssrc()) { audio_sender_->CancelSendingFrames(frame_ids); } else if (video_sender_ && ssrc == video_sender_->ssrc()) { @@ -294,8 +295,8 @@ void CastTransportSenderImpl::CancelSendingFrames( } } -void CastTransportSenderImpl::ResendFrameForKickstart(uint32 ssrc, - uint32 frame_id) { +void CastTransportSenderImpl::ResendFrameForKickstart(uint32_t ssrc, + uint32_t frame_id) { if (audio_sender_ && ssrc == audio_sender_->ssrc()) { DCHECK(audio_rtcp_session_); audio_sender_->ResendFrameForKickstart( @@ -312,7 +313,7 @@ void CastTransportSenderImpl::ResendFrameForKickstart(uint32 ssrc, } void CastTransportSenderImpl::ResendPackets( - uint32 ssrc, + uint32_t ssrc, const MissingFramesAndPacketsMap& missing_packets, bool cancel_rtx_if_not_in_list, const DedupInfo& dedup_info) { @@ -358,7 +359,7 @@ void CastTransportSenderImpl::SendRawEvents() { bool CastTransportSenderImpl::OnReceivedPacket(scoped_ptr<Packet> packet) { const uint8_t* const data = &packet->front(); const size_t length = packet->size(); - uint32 ssrc; + uint32_t ssrc; if (Rtcp::IsRtcpPacket(data, length)) { ssrc = Rtcp::GetSsrcOfSender(data, length); } else if (!RtpParser::ParseSsrc(data, length, &ssrc)) { @@ -430,7 +431,7 @@ void CastTransportSenderImpl::OnReceivedLogMessage( } void CastTransportSenderImpl::OnReceivedCastMessage( - uint32 ssrc, + uint32_t ssrc, const RtcpCastMessageCallback& cast_message_cb, const RtcpCastMessage& cast_message) { if (!cast_message_cb.is_null()) @@ -438,7 +439,7 @@ void CastTransportSenderImpl::OnReceivedCastMessage( DedupInfo dedup_info; if (audio_sender_ && audio_sender_->ssrc() == ssrc) { - const int64 acked_bytes = + const int64_t acked_bytes = audio_sender_->GetLastByteSentForFrame(cast_message.ack_frame_id); last_byte_acked_for_audio_ = std::max(acked_bytes, last_byte_acked_for_audio_); @@ -465,13 +466,13 @@ void CastTransportSenderImpl::OnReceivedCastMessage( dedup_info); } -void CastTransportSenderImpl::AddValidSsrc(uint32 ssrc) { +void CastTransportSenderImpl::AddValidSsrc(uint32_t ssrc) { valid_ssrcs_.insert(ssrc); } void CastTransportSenderImpl::SendRtcpFromRtpReceiver( - uint32 ssrc, - uint32 sender_ssrc, + uint32_t ssrc, + uint32_t sender_ssrc, const RtcpTimeData& time_data, const RtcpCastMessage* cast_message, base::TimeDelta target_delay, diff --git a/media/cast/net/cast_transport_sender_impl.h b/media/cast/net/cast_transport_sender_impl.h index 09b4299..2e32ac2 100644 --- a/media/cast/net/cast_transport_sender_impl.h +++ b/media/cast/net/cast_transport_sender_impl.h @@ -99,25 +99,25 @@ class CastTransportSenderImpl : public CastTransportSender { void InitializeVideo(const CastTransportRtpConfig& config, const RtcpCastMessageCallback& cast_message_cb, const RtcpRttCallback& rtt_cb) final; - void InsertFrame(uint32 ssrc, const EncodedFrame& frame) final; + void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final; - void SendSenderReport(uint32 ssrc, + void SendSenderReport(uint32_t ssrc, base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp) final; + uint32_t current_time_as_rtp_timestamp) final; - void CancelSendingFrames(uint32 ssrc, - const std::vector<uint32>& frame_ids) final; + void CancelSendingFrames(uint32_t ssrc, + const std::vector<uint32_t>& frame_ids) final; - void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) final; + void ResendFrameForKickstart(uint32_t ssrc, uint32_t frame_id) final; PacketReceiverCallback PacketReceiverForTesting() final; // CastTransportReceiver implementation. - void AddValidSsrc(uint32 ssrc) final; + void AddValidSsrc(uint32_t ssrc) final; void SendRtcpFromRtpReceiver( - uint32 ssrc, - uint32 sender_ssrc, + uint32_t ssrc, + uint32_t sender_ssrc, const RtcpTimeData& time_data, const RtcpCastMessage* cast_message, base::TimeDelta target_delay, @@ -135,7 +135,7 @@ class CastTransportSenderImpl : public CastTransportSender { // If |cancel_rtx_if_not_in_list| is true then transmission of packets for the // frames but not in the list will be dropped. // See PacedSender::ResendPackets() to see how |dedup_info| works. - void ResendPackets(uint32 ssrc, + void ResendPackets(uint32_t ssrc, const MissingFramesAndPacketsMap& missing_packets, bool cancel_rtx_if_not_in_list, const DedupInfo& dedup_info); @@ -152,7 +152,7 @@ class CastTransportSenderImpl : public CastTransportSender { const RtcpReceiverLogMessage& log); // Called when a RTCP Cast message is received. - void OnReceivedCastMessage(uint32 ssrc, + void OnReceivedCastMessage(uint32_t ssrc, const RtcpCastMessageCallback& cast_message_cb, const RtcpCastMessage& cast_message); @@ -192,10 +192,10 @@ class CastTransportSenderImpl : public CastTransportSender { // Right after a frame is sent we record the number of bytes sent to the // socket. We record the corresponding bytes sent for the most recent ACKed // audio packet. - int64 last_byte_acked_for_audio_; + int64_t last_byte_acked_for_audio_; // Packets that don't match these ssrcs are ignored. - std::set<uint32> valid_ssrcs_; + std::set<uint32_t> valid_ssrcs_; // Called with incoming packets. (Unless they match the // channels created by Initialize{Audio,Video}. diff --git a/media/cast/net/cast_transport_sender_impl_unittest.cc b/media/cast/net/cast_transport_sender_impl_unittest.cc index fecf820..bd795be 100644 --- a/media/cast/net/cast_transport_sender_impl_unittest.cc +++ b/media/cast/net/cast_transport_sender_impl_unittest.cc @@ -20,9 +20,9 @@ namespace media { namespace cast { namespace { -const int64 kStartMillisecond = INT64_C(12345678900000); -const uint32 kVideoSsrc = 1; -const uint32 kAudioSsrc = 2; +const int64_t kStartMillisecond = INT64_C(12345678900000); +const uint32_t kVideoSsrc = 1; +const uint32_t kAudioSsrc = 2; } // namespace class FakePacketSender : public PacketSender { @@ -41,7 +41,7 @@ class FakePacketSender : public PacketSender { return true; } - int64 GetBytesSent() final { return bytes_sent_; } + int64_t GetBytesSent() final { return bytes_sent_; } void SetPaused(bool paused) { paused_ = paused; @@ -58,7 +58,7 @@ class FakePacketSender : public PacketSender { base::Closure callback_; PacketRef stored_packet_; int packets_sent_; - int64 bytes_sent_; + int64_t bytes_sent_; DISALLOW_COPY_AND_ASSIGN(FakePacketSender); }; @@ -256,7 +256,7 @@ TEST_F(CastTransportSenderImplTest, CancelRetransmits) { task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); EXPECT_EQ(2, num_times_logging_callback_called_); - std::vector<uint32> cancel_sending_frames; + std::vector<uint32_t> cancel_sending_frames; cancel_sending_frames.push_back(1); transport_sender_->CancelSendingFrames(kVideoSsrc, cancel_sending_frames); diff --git a/media/cast/net/frame_id_wrap_helper_test.cc b/media/cast/net/frame_id_wrap_helper_test.cc index 9be52bd..5ffeb22 100644 --- a/media/cast/net/frame_id_wrap_helper_test.cc +++ b/media/cast/net/frame_id_wrap_helper_test.cc @@ -14,16 +14,16 @@ class FrameIdWrapHelperTest : public ::testing::Test { FrameIdWrapHelperTest() : frame_id_wrap_helper_(kFirstFrameId - 1) {} ~FrameIdWrapHelperTest() override {} - void RunOneTest(uint32 starting_point, int iterations) { + void RunOneTest(uint32_t starting_point, int iterations) { const int window_size = 127; - uint32 window_base = starting_point; + uint32_t window_base = starting_point; frame_id_wrap_helper_.largest_frame_id_seen_ = starting_point; for (int i = 0; i < iterations; i++) { - uint32 largest_frame_id_seen = + uint32_t largest_frame_id_seen = frame_id_wrap_helper_.largest_frame_id_seen_; int offset = rand() % window_size; - uint32 frame_id = window_base + offset; - uint32 mapped_frame_id = + uint32_t frame_id = window_base + offset; + uint32_t mapped_frame_id = frame_id_wrap_helper_.MapTo32bitsFrameId(frame_id & 0xff); EXPECT_EQ(frame_id, mapped_frame_id) << " Largest ID seen: " << largest_frame_id_seen @@ -46,19 +46,19 @@ TEST_F(FrameIdWrapHelperTest, FirstFrame) { } TEST_F(FrameIdWrapHelperTest, Rollover) { - uint32 new_frame_id = 0u; + uint32_t new_frame_id = 0u; for (int i = 0; i <= 256; ++i) { new_frame_id = - frame_id_wrap_helper_.MapTo32bitsFrameId(static_cast<uint8>(i)); + frame_id_wrap_helper_.MapTo32bitsFrameId(static_cast<uint8_t>(i)); } EXPECT_EQ(256u, new_frame_id); } TEST_F(FrameIdWrapHelperTest, OutOfOrder) { - uint32 new_frame_id = 0u; + uint32_t new_frame_id = 0u; for (int i = 0; i < 255; ++i) { new_frame_id = - frame_id_wrap_helper_.MapTo32bitsFrameId(static_cast<uint8>(i)); + frame_id_wrap_helper_.MapTo32bitsFrameId(static_cast<uint8_t>(i)); } EXPECT_EQ(254u, new_frame_id); new_frame_id = frame_id_wrap_helper_.MapTo32bitsFrameId(0u); diff --git a/media/cast/net/mock_cast_transport_sender.h b/media/cast/net/mock_cast_transport_sender.h index 0827e1f..5eee66c 100644 --- a/media/cast/net/mock_cast_transport_sender.h +++ b/media/cast/net/mock_cast_transport_sender.h @@ -24,25 +24,24 @@ class MockCastTransportSender : public CastTransportSender { const CastTransportRtpConfig& config, const RtcpCastMessageCallback& cast_message_cb, const RtcpRttCallback& rtt_cb)); - MOCK_METHOD2(InsertFrame, void(uint32 ssrc, const EncodedFrame& frame)); - MOCK_METHOD3(SendSenderReport, void( - uint32 ssrc, - base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp)); - MOCK_METHOD2(CancelSendingFrames, void( - uint32 ssrc, - const std::vector<uint32>& frame_ids)); - MOCK_METHOD2(ResendFrameForKickstart, void(uint32 ssrc, uint32 frame_id)); + MOCK_METHOD2(InsertFrame, void(uint32_t ssrc, const EncodedFrame& frame)); + MOCK_METHOD3(SendSenderReport, + void(uint32_t ssrc, + base::TimeTicks current_time, + uint32_t current_time_as_rtp_timestamp)); + MOCK_METHOD2(CancelSendingFrames, + void(uint32_t ssrc, const std::vector<uint32_t>& frame_ids)); + MOCK_METHOD2(ResendFrameForKickstart, void(uint32_t ssrc, uint32_t frame_id)); MOCK_METHOD0(PacketReceiverForTesting, PacketReceiverCallback()); - MOCK_METHOD1(AddValidSsrc, void(uint32 ssrc)); - MOCK_METHOD7(SendRtcpFromRtpReceiver, void( - uint32 ssrc, - uint32 sender_ssrc, - const RtcpTimeData& time_data, - const RtcpCastMessage* cast_message, - base::TimeDelta target_delay, - const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, - const RtpReceiverStatistics* rtp_receiver_statistics)); + MOCK_METHOD1(AddValidSsrc, void(uint32_t ssrc)); + MOCK_METHOD7(SendRtcpFromRtpReceiver, + void(uint32_t ssrc, + uint32_t sender_ssrc, + const RtcpTimeData& time_data, + const RtcpCastMessage* cast_message, + base::TimeDelta target_delay, + const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, + const RtpReceiverStatistics* rtp_receiver_statistics)); }; } // namespace cast diff --git a/media/cast/net/pacing/paced_sender.cc b/media/cast/net/pacing/paced_sender.cc index 61166da..f70fc40 100644 --- a/media/cast/net/pacing/paced_sender.cc +++ b/media/cast/net/pacing/paced_sender.cc @@ -14,7 +14,7 @@ namespace cast { namespace { -static const int64 kPacingIntervalMs = 10; +static const int64_t kPacingIntervalMs = 10; // Each frame will be split into no more than kPacingMaxBurstsPerFrame // bursts of packets. static const size_t kPacingMaxBurstsPerFrame = 3; @@ -32,9 +32,9 @@ DedupInfo::DedupInfo() : last_byte_acked_for_audio(0) {} // static PacketKey PacedPacketSender::MakePacketKey(PacketKey::PacketType packet_type, - uint32 frame_id, - uint32 ssrc, - uint16 packet_id) { + uint32_t frame_id, + uint32_t ssrc, + uint16_t packet_id) { PacketKey key{packet_type, frame_id, ssrc, packet_id}; return key; } @@ -67,27 +67,27 @@ PacedSender::PacedSender( PacedSender::~PacedSender() {} -void PacedSender::RegisterAudioSsrc(uint32 audio_ssrc) { +void PacedSender::RegisterAudioSsrc(uint32_t audio_ssrc) { audio_ssrc_ = audio_ssrc; } -void PacedSender::RegisterVideoSsrc(uint32 video_ssrc) { +void PacedSender::RegisterVideoSsrc(uint32_t video_ssrc) { video_ssrc_ = video_ssrc; } -void PacedSender::RegisterPrioritySsrc(uint32 ssrc) { +void PacedSender::RegisterPrioritySsrc(uint32_t ssrc) { priority_ssrcs_.push_back(ssrc); } -int64 PacedSender::GetLastByteSentForPacket(const PacketKey& packet_key) { +int64_t PacedSender::GetLastByteSentForPacket(const PacketKey& packet_key) { PacketSendHistory::const_iterator it = send_history_.find(packet_key); if (it == send_history_.end()) return 0; return it->second.last_byte_sent; } -int64 PacedSender::GetLastByteSentForSsrc(uint32 ssrc) { - std::map<uint32, int64>::const_iterator it = last_byte_sent_.find(ssrc); +int64_t PacedSender::GetLastByteSentForSsrc(uint32_t ssrc) { + std::map<uint32_t, int64_t>::const_iterator it = last_byte_sent_.find(ssrc); if (it == last_byte_sent_.end()) return 0; return it->second; @@ -169,7 +169,7 @@ bool PacedSender::ResendPackets(const SendPacketVector& packets, return true; } -bool PacedSender::SendRtcpPacket(uint32 ssrc, PacketRef packet) { +bool PacedSender::SendRtcpPacket(uint32_t ssrc, PacketRef packet) { if (state_ == State_TransportBlocked) { PacketKey key = PacedPacketSender::MakePacketKey(PacketKey::RTCP, 0, ssrc, 0); @@ -336,7 +336,7 @@ void PacedSender::LogPacketEvent(const Packet& packet, CastLoggingEvent type) { packet.size()); bool success = reader.Skip(4); success &= reader.ReadU32(&event.rtp_timestamp); - uint32 ssrc; + uint32_t ssrc; success &= reader.ReadU32(&ssrc); if (ssrc == audio_ssrc_) { event.media_type = AUDIO_EVENT; diff --git a/media/cast/net/pacing/paced_sender.h b/media/cast/net/pacing/paced_sender.h index f37ebe7..c2a32d2 100644 --- a/media/cast/net/pacing/paced_sender.h +++ b/media/cast/net/pacing/paced_sender.h @@ -9,7 +9,6 @@ #include <tuple> #include <vector> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" @@ -37,9 +36,9 @@ struct PacketKey { enum PacketType { RTCP = 0, RTP = 1 }; PacketType packet_type; - uint32 frame_id; - uint32 ssrc; - uint16 packet_id; + uint32_t frame_id; + uint32_t ssrc; + uint16_t packet_id; bool operator<(const PacketKey& key) const { return std::tie(packet_type, frame_id, ssrc, packet_id) < @@ -66,7 +65,7 @@ typedef std::vector<std::pair<PacketKey, PacketRef> > SendPacketVector; struct DedupInfo { DedupInfo(); base::TimeDelta resend_interval; - int64 last_byte_acked_for_audio; + int64_t last_byte_acked_for_audio; }; // We have this pure virtual class to enable mocking. @@ -75,15 +74,15 @@ class PacedPacketSender { virtual bool SendPackets(const SendPacketVector& packets) = 0; virtual bool ResendPackets(const SendPacketVector& packets, const DedupInfo& dedup_info) = 0; - virtual bool SendRtcpPacket(uint32 ssrc, PacketRef packet) = 0; + virtual bool SendRtcpPacket(uint32_t ssrc, PacketRef packet) = 0; virtual void CancelSendingPacket(const PacketKey& packet_key) = 0; virtual ~PacedPacketSender() {} static PacketKey MakePacketKey(PacketKey::PacketType, - uint32 frame_id, - uint32 ssrc, - uint16 packet_id); + uint32_t frame_id, + uint32_t ssrc, + uint16_t packet_id); }; class PacedSender : public PacedPacketSender, @@ -105,29 +104,29 @@ class PacedSender : public PacedPacketSender, ~PacedSender() final; // These must be called before non-RTCP packets are sent. - void RegisterAudioSsrc(uint32 audio_ssrc); - void RegisterVideoSsrc(uint32 video_ssrc); + void RegisterAudioSsrc(uint32_t audio_ssrc); + void RegisterVideoSsrc(uint32_t video_ssrc); // Register SSRC that has a higher priority for sending. Multiple SSRCs can // be registered. // Note that it is not expected to register many SSRCs with this method. // Because IsHigherPriority() is determined in linear time. - void RegisterPrioritySsrc(uint32 ssrc); + void RegisterPrioritySsrc(uint32_t ssrc); // Returns the total number of bytes sent to the socket when the specified // packet was just sent. // Returns 0 if the packet cannot be found or not yet sent. - int64 GetLastByteSentForPacket(const PacketKey& packet_key); + int64_t GetLastByteSentForPacket(const PacketKey& packet_key); // Returns the total number of bytes sent to the socket when the last payload // identified by SSRC is just sent. - int64 GetLastByteSentForSsrc(uint32 ssrc); + int64_t GetLastByteSentForSsrc(uint32_t ssrc); // PacedPacketSender implementation. bool SendPackets(const SendPacketVector& packets) final; bool ResendPackets(const SendPacketVector& packets, const DedupInfo& dedup_info) final; - bool SendRtcpPacket(uint32 ssrc, PacketRef packet) final; + bool SendRtcpPacket(uint32_t ssrc, PacketRef packet) final; void CancelSendingPacket(const PacketKey& packet_key) final; private: @@ -185,12 +184,12 @@ class PacedSender : public PacedPacketSender, PacketSender* const transport_; scoped_refptr<base::SingleThreadTaskRunner> transport_task_runner_; - uint32 audio_ssrc_; - uint32 video_ssrc_; + uint32_t audio_ssrc_; + uint32_t video_ssrc_; // Set of SSRCs that have higher priority. This is a vector instead of a // set because there's only very few in it (most likely 1). - std::vector<uint32> priority_ssrcs_; + std::vector<uint32_t> priority_ssrcs_; typedef std::map<PacketKey, std::pair<PacketType, PacketRef> > PacketList; PacketList packet_list_; PacketList priority_packet_list_; @@ -198,16 +197,16 @@ class PacedSender : public PacedPacketSender, struct PacketSendRecord { PacketSendRecord(); base::TimeTicks time; // Time when the packet was sent. - int64 last_byte_sent; // Number of bytes sent to network just after this - // packet was sent. - int64 last_byte_sent_for_audio; // Number of bytes sent to network from - // audio stream just before this packet. + int64_t last_byte_sent; // Number of bytes sent to network just after this + // packet was sent. + int64_t last_byte_sent_for_audio; // Number of bytes sent to network from + // audio stream just before this packet. }; typedef std::map<PacketKey, PacketSendRecord> PacketSendHistory; PacketSendHistory send_history_; PacketSendHistory send_history_buffer_; // Records the last byte sent for payload with a specific SSRC. - std::map<uint32, int64> last_byte_sent_; + std::map<uint32_t, int64_t> last_byte_sent_; size_t target_burst_size_; size_t max_burst_size_; diff --git a/media/cast/net/pacing/paced_sender_unittest.cc b/media/cast/net/pacing/paced_sender_unittest.cc index 1df7415..b11625d 100644 --- a/media/cast/net/pacing/paced_sender_unittest.cc +++ b/media/cast/net/pacing/paced_sender_unittest.cc @@ -16,16 +16,16 @@ namespace media { namespace cast { namespace { -static const uint8 kValue = 123; +static const uint8_t kValue = 123; static const size_t kSize1 = 101; static const size_t kSize2 = 102; static const size_t kSize3 = 103; static const size_t kSize4 = 104; static const size_t kNackSize = 105; -static const int64 kStartMillisecond = INT64_C(12345678900000); -static const uint32 kVideoSsrc = 0x1234; -static const uint32 kAudioSsrc = 0x5678; -static const uint32 kFrameRtpTimestamp = 12345; +static const int64_t kStartMillisecond = INT64_C(12345678900000); +static const uint32_t kVideoSsrc = 0x1234; +static const uint32_t kAudioSsrc = 0x5678; +static const uint32_t kFrameRtpTimestamp = 12345; class TestPacketSender : public PacketSender { public: @@ -40,7 +40,7 @@ class TestPacketSender : public PacketSender { return true; } - int64 GetBytesSent() final { return bytes_sent_; } + int64_t GetBytesSent() final { return bytes_sent_; } void AddExpectedSize(int expected_packet_size, int repeat_count) { for (int i = 0; i < repeat_count; ++i) { @@ -50,7 +50,7 @@ class TestPacketSender : public PacketSender { public: std::list<int> expected_packet_size_; - int64 bytes_sent_; + int64_t bytes_sent_; DISALLOW_COPY_AND_ASSIGN(TestPacketSender); }; @@ -123,7 +123,7 @@ class PacedSenderTest : public ::testing::Test { TestPacketSender mock_transport_; scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; scoped_ptr<PacedSender> paced_sender_; - uint32 frame_id_; + uint32_t frame_id_; DISALLOW_COPY_AND_ASSIGN(PacedSenderTest); }; @@ -177,7 +177,7 @@ TEST_F(PacedSenderTest, BasicPace) { // Check that packet logging events match expected values. EXPECT_EQ(num_of_packets, static_cast<int>(packet_events_.size())); - uint16 expected_packet_id = 0; + uint16_t expected_packet_id = 0; for (const PacketEvent& e : packet_events_) { ASSERT_LE(earliest_event_timestamp, e.timestamp); ASSERT_GE(latest_event_timestamp, e.timestamp); @@ -407,34 +407,34 @@ TEST_F(PacedSenderTest, GetLastByteSent) { SendPacketVector packets2 = CreateSendPacketVector(kSize1, 1, false); EXPECT_TRUE(paced_sender_->SendPackets(packets1)); - EXPECT_EQ(static_cast<int64>(kSize1), + EXPECT_EQ(static_cast<int64_t>(kSize1), paced_sender_->GetLastByteSentForPacket(packets1[0].first)); - EXPECT_EQ(static_cast<int64>(kSize1), + EXPECT_EQ(static_cast<int64_t>(kSize1), paced_sender_->GetLastByteSentForSsrc(kAudioSsrc)); EXPECT_EQ(0, paced_sender_->GetLastByteSentForSsrc(kVideoSsrc)); EXPECT_TRUE(paced_sender_->SendPackets(packets2)); - EXPECT_EQ(static_cast<int64>(2 * kSize1), + EXPECT_EQ(static_cast<int64_t>(2 * kSize1), paced_sender_->GetLastByteSentForPacket(packets2[0].first)); - EXPECT_EQ(static_cast<int64>(kSize1), + EXPECT_EQ(static_cast<int64_t>(kSize1), paced_sender_->GetLastByteSentForSsrc(kAudioSsrc)); - EXPECT_EQ(static_cast<int64>(2 * kSize1), + EXPECT_EQ(static_cast<int64_t>(2 * kSize1), paced_sender_->GetLastByteSentForSsrc(kVideoSsrc)); EXPECT_TRUE(paced_sender_->ResendPackets(packets1, DedupInfo())); - EXPECT_EQ(static_cast<int64>(3 * kSize1), + EXPECT_EQ(static_cast<int64_t>(3 * kSize1), paced_sender_->GetLastByteSentForPacket(packets1[0].first)); - EXPECT_EQ(static_cast<int64>(3 * kSize1), + EXPECT_EQ(static_cast<int64_t>(3 * kSize1), paced_sender_->GetLastByteSentForSsrc(kAudioSsrc)); - EXPECT_EQ(static_cast<int64>(2 * kSize1), + EXPECT_EQ(static_cast<int64_t>(2 * kSize1), paced_sender_->GetLastByteSentForSsrc(kVideoSsrc)); EXPECT_TRUE(paced_sender_->ResendPackets(packets2, DedupInfo())); - EXPECT_EQ(static_cast<int64>(4 * kSize1), + EXPECT_EQ(static_cast<int64_t>(4 * kSize1), paced_sender_->GetLastByteSentForPacket(packets2[0].first)); - EXPECT_EQ(static_cast<int64>(3 * kSize1), + EXPECT_EQ(static_cast<int64_t>(3 * kSize1), paced_sender_->GetLastByteSentForSsrc(kAudioSsrc)); - EXPECT_EQ(static_cast<int64>(4 * kSize1), + EXPECT_EQ(static_cast<int64_t>(4 * kSize1), paced_sender_->GetLastByteSentForSsrc(kVideoSsrc)); } @@ -450,11 +450,11 @@ TEST_F(PacedSenderTest, DedupWithResendInterval) { // This packet will not be sent. EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); - EXPECT_EQ(static_cast<int64>(kSize1), mock_transport_.GetBytesSent()); + EXPECT_EQ(static_cast<int64_t>(kSize1), mock_transport_.GetBytesSent()); dedup_info.resend_interval = base::TimeDelta::FromMilliseconds(5); EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); - EXPECT_EQ(static_cast<int64>(2 * kSize1), mock_transport_.GetBytesSent()); + EXPECT_EQ(static_cast<int64_t>(2 * kSize1), mock_transport_.GetBytesSent()); } } // namespace cast diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc index 6ada1e4..7935e67 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc @@ -81,7 +81,7 @@ void ReceiverRtcpEventSubscriber::GetRtcpEventsWithRedundancy( DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(rtcp_events); - uint64 event_level = rtcp_events_.size() + popped_events_; + uint64_t event_level = rtcp_events_.size() + popped_events_; event_levels_for_past_frames_.push_back(event_level); for (size_t i = 0; i < kNumResends; i++) { @@ -89,8 +89,9 @@ void ReceiverRtcpEventSubscriber::GetRtcpEventsWithRedundancy( if (event_levels_for_past_frames_.size() < resend_delay + 1) break; - uint64 send_limit = event_levels_for_past_frames_[ - event_levels_for_past_frames_.size() - 1 - resend_delay]; + uint64_t send_limit = + event_levels_for_past_frames_[event_levels_for_past_frames_.size() - 1 - + resend_delay]; if (send_ptrs_[i] < popped_events_) { send_ptrs_[i] = popped_events_; diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h index 248f07a..54ee477 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h @@ -74,21 +74,21 @@ class ReceiverRtcpEventSubscriber : public RawEventSubscriber { std::deque<RtcpEventPair> rtcp_events_; // Counts how many events have been removed from rtcp_events_. - uint64 popped_events_; + uint64_t popped_events_; // Events greater than send_ptrs_[0] have not been sent yet. // Events greater than send_ptrs_[1] have been transmit once. // Note that these counters use absolute numbers, so you need // to subtract popped_events_ before looking up the events in // rtcp_events_. - uint64 send_ptrs_[kNumResends]; + uint64_t send_ptrs_[kNumResends]; // For each frame, we push how many events have been added to // rtcp_events_ so far. We use this to make sure that // send_ptrs_[N+1] is always at least kResendDelay frames behind // send_ptrs_[N]. Old information is removed so that information // for (kNumResends + 1) * kResendDelay frames remain. - std::deque<uint64> event_levels_for_past_frames_; + std::deque<uint64_t> event_levels_for_past_frames_; // Ensures methods are only called on the main thread. base::ThreadChecker thread_checker_; diff --git a/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc b/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc index 4980494..7797da3 100644 --- a/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc +++ b/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc @@ -18,7 +18,7 @@ namespace cast { namespace { const size_t kMaxEventEntries = 10u; -const int64 kDelayMs = 20L; +const int64_t kDelayMs = 20L; } // namespace @@ -152,7 +152,7 @@ TEST_F(ReceiverRtcpEventSubscriberTest, LogAudioEvents) { TEST_F(ReceiverRtcpEventSubscriberTest, DropEventsWhenSizeExceeded) { Init(VIDEO_EVENT); - for (uint32 i = 1u; i <= 10u; ++i) { + for (uint32_t i = 1u; i <= 10u; ++i) { scoped_ptr<FrameEvent> decode_event(new FrameEvent()); decode_event->timestamp = testing_clock_->NowTicks(); decode_event->type = FRAME_DECODED; diff --git a/media/cast/net/rtcp/rtcp.h b/media/cast/net/rtcp/rtcp.h index 48c6f0d..4780a9f 100644 --- a/media/cast/net/rtcp/rtcp.h +++ b/media/cast/net/rtcp/rtcp.h @@ -85,7 +85,7 @@ class Rtcp { // and used to maintain a RTCP session. // Returns false if this is not a RTCP packet or it is not directed to // this session, e.g. SSRC doesn't match. - bool IncomingRtcpPacket(const uint8* data, size_t length); + bool IncomingRtcpPacket(const uint8_t* data, size_t length); // If available, returns true and sets the output arguments to the latest // lip-sync timestamps gleaned from the sender reports. While the sender @@ -102,8 +102,8 @@ class Rtcp { return current_round_trip_time_; } - static bool IsRtcpPacket(const uint8* packet, size_t length); - static uint32_t GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); + static bool IsRtcpPacket(const uint8_t* packet, size_t length); + static uint32_t GetSsrcOfSender(const uint8_t* rtcp_buffer, size_t length); uint32_t GetLocalSsrc() const { return local_ssrc_; } uint32_t GetRemoteSsrc() const { return remote_ssrc_; } diff --git a/media/cast/net/rtcp/rtcp_builder.cc b/media/cast/net/rtcp/rtcp_builder.cc index 07006fc..1f81520 100644 --- a/media/cast/net/rtcp/rtcp_builder.cc +++ b/media/cast/net/rtcp/rtcp_builder.cc @@ -18,20 +18,20 @@ namespace { // Max delta is 4095 milliseconds because we need to be able to encode it in // 12 bits. -const int64 kMaxWireFormatTimeDeltaMs = INT64_C(0xfff); +const int64_t kMaxWireFormatTimeDeltaMs = INT64_C(0xfff); -uint16 MergeEventTypeAndTimestampForWireFormat( +uint16_t MergeEventTypeAndTimestampForWireFormat( const CastLoggingEvent& event, const base::TimeDelta& time_delta) { - int64 time_delta_ms = time_delta.InMilliseconds(); + int64_t time_delta_ms = time_delta.InMilliseconds(); DCHECK_GE(time_delta_ms, 0); DCHECK_LE(time_delta_ms, kMaxWireFormatTimeDeltaMs); - uint16 time_delta_12_bits = - static_cast<uint16>(time_delta_ms & kMaxWireFormatTimeDeltaMs); + uint16_t time_delta_12_bits = + static_cast<uint16_t>(time_delta_ms & kMaxWireFormatTimeDeltaMs); - uint16 event_type_4_bits = ConvertEventTypeToWireFormat(event); + uint16_t event_type_4_bits = ConvertEventTypeToWireFormat(event); DCHECK(event_type_4_bits); DCHECK(~(event_type_4_bits & 0xfff0)); return (event_type_4_bits << 12) | time_delta_12_bits; @@ -114,11 +114,8 @@ class NackStringBuilder { }; } // namespace -RtcpBuilder::RtcpBuilder(uint32 sending_ssrc) - : writer_(NULL, 0), - ssrc_(sending_ssrc), - ptr_of_length_(NULL) { -} +RtcpBuilder::RtcpBuilder(uint32_t sending_ssrc) + : writer_(NULL, 0), ssrc_(sending_ssrc), ptr_of_length_(NULL) {} RtcpBuilder::~RtcpBuilder() {} @@ -237,8 +234,8 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, writer_.WriteU32(ssrc_); // Add our own SSRC. writer_.WriteU32(cast->media_ssrc); // Remote SSRC. writer_.WriteU32(kCast); - writer_.WriteU8(static_cast<uint8>(cast->ack_frame_id)); - uint8* cast_loss_field_pos = reinterpret_cast<uint8*>(writer_.ptr()); + writer_.WriteU8(static_cast<uint8_t>(cast->ack_frame_id)); + uint8_t* cast_loss_field_pos = reinterpret_cast<uint8_t*>(writer_.ptr()); writer_.WriteU8(0); // Overwritten with number_of_loss_fields. DCHECK_LE(target_delay.InMilliseconds(), std::numeric_limits<uint16_t>::max()); @@ -259,7 +256,7 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, // Iterate through all frames with missing packets. if (frame_it->second.empty()) { // Special case all packets in a frame is missing. - writer_.WriteU8(static_cast<uint8>(frame_it->first)); + writer_.WriteU8(static_cast<uint8_t>(frame_it->first)); writer_.WriteU16(kRtcpCastAllPacketsLost); writer_.WriteU8(0); nack_string_builder.PushPacket(kRtcpCastAllPacketsLost); @@ -267,16 +264,16 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, } else { PacketIdSet::const_iterator packet_it = frame_it->second.begin(); while (packet_it != frame_it->second.end()) { - uint16 packet_id = *packet_it; + uint16_t packet_id = *packet_it; // Write frame and packet id to buffer before calculating bitmask. - writer_.WriteU8(static_cast<uint8>(frame_it->first)); + writer_.WriteU8(static_cast<uint8_t>(frame_it->first)); writer_.WriteU16(packet_id); nack_string_builder.PushPacket(packet_id); - uint8 bitmask = 0; + uint8_t bitmask = 0; ++packet_it; while (packet_it != frame_it->second.end()) { - int shift = static_cast<uint8>(*packet_it - packet_id) - 1; + int shift = static_cast<uint8_t>(*packet_it - packet_id) - 1; if (shift >= 0 && shift <= 7) { nack_string_builder.PushPacket(*packet_it); bitmask |= (1 << shift); @@ -295,7 +292,7 @@ void RtcpBuilder::AddCast(const RtcpCastMessage* cast, << ", ACK: " << cast->ack_frame_id << ", NACK: " << nack_string_builder.GetString(); DCHECK_LE(number_of_loss_fields, kRtcpMaxCastLossFields); - *cast_loss_field_pos = static_cast<uint8>(number_of_loss_fields); + *cast_loss_field_pos = static_cast<uint8_t>(number_of_loss_fields); } void RtcpBuilder::AddSR(const RtcpSenderInfo& sender_info) { @@ -305,7 +302,7 @@ void RtcpBuilder::AddSR(const RtcpSenderInfo& sender_info) { writer_.WriteU32(sender_info.ntp_fraction); writer_.WriteU32(sender_info.rtp_timestamp); writer_.WriteU32(sender_info.send_packet_count); - writer_.WriteU32(static_cast<uint32>(sender_info.send_octet_count)); + writer_.WriteU32(static_cast<uint32_t>(sender_info.send_octet_count)); } /* @@ -367,21 +364,21 @@ void RtcpBuilder::AddReceiverLog( total_number_of_messages_to_send -= messages_in_frame; // On the wire format is number of messages - 1. - writer_.WriteU8(static_cast<uint8>(messages_in_frame - 1)); + writer_.WriteU8(static_cast<uint8_t>(messages_in_frame - 1)); base::TimeTicks event_timestamp_base = frame_log_messages.event_log_messages_.front().event_timestamp; - uint32 base_timestamp_ms = + uint32_t base_timestamp_ms = (event_timestamp_base - base::TimeTicks()).InMilliseconds(); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms >> 16)); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms >> 8)); - writer_.WriteU8(static_cast<uint8>(base_timestamp_ms)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms >> 16)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms >> 8)); + writer_.WriteU8(static_cast<uint8_t>(base_timestamp_ms)); while (!frame_log_messages.event_log_messages_.empty() && messages_in_frame > 0) { const RtcpReceiverEventLogMessage& event_message = frame_log_messages.event_log_messages_.front(); - uint16 event_type_and_timestamp_delta = + uint16_t event_type_and_timestamp_delta = MergeEventTypeAndTimestampForWireFormat( event_message.type, event_message.event_timestamp - event_timestamp_base); @@ -389,8 +386,8 @@ void RtcpBuilder::AddReceiverLog( case FRAME_ACK_SENT: case FRAME_PLAYOUT: case FRAME_DECODED: - writer_.WriteU16( - static_cast<uint16>(event_message.delay_delta.InMilliseconds())); + writer_.WriteU16(static_cast<uint16_t>( + event_message.delay_delta.InMilliseconds())); writer_.WriteU16(event_type_and_timestamp_delta); break; case PACKET_RECEIVED: diff --git a/media/cast/net/rtcp/rtcp_builder.h b/media/cast/net/rtcp/rtcp_builder.h index e6890d2..c7470a3 100644 --- a/media/cast/net/rtcp/rtcp_builder.h +++ b/media/cast/net/rtcp/rtcp_builder.h @@ -20,7 +20,7 @@ namespace cast { class RtcpBuilder { public: - explicit RtcpBuilder(uint32 sending_ssrc); + explicit RtcpBuilder(uint32_t sending_ssrc); ~RtcpBuilder(); PacketRef BuildRtcpFromReceiver( @@ -54,7 +54,7 @@ class RtcpBuilder { PacketRef Finish(); base::BigEndianWriter writer_; - const uint32 ssrc_; + const uint32_t ssrc_; char* ptr_of_length_; PacketRef packet_; diff --git a/media/cast/net/rtcp/rtcp_builder_unittest.cc b/media/cast/net/rtcp/rtcp_builder_unittest.cc index f39c82d..3ed5294 100644 --- a/media/cast/net/rtcp/rtcp_builder_unittest.cc +++ b/media/cast/net/rtcp/rtcp_builder_unittest.cc @@ -18,8 +18,8 @@ namespace media { namespace cast { namespace { -static const uint32 kSendingSsrc = 0x12345678; -static const uint32 kMediaSsrc = 0x87654321; +static const uint32_t kSendingSsrc = 0x12345678; +static const uint32_t kMediaSsrc = 0x87654321; static const base::TimeDelta kDefaultDelay = base::TimeDelta::FromMilliseconds(100); @@ -167,8 +167,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtraAndCastMessage) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtrCastMessageAndLog) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -242,8 +242,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithRrtrCastMessageAndLog) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -264,10 +264,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { num_events, kTimeBaseMs); for (int i = 0; i < num_events; i++) { - p.AddReceiverEventLog( - kLostPacketId1, - PACKET_RECEIVED, - static_cast<uint16>(kTimeDelayMs * i)); + p.AddReceiverEventLog(kLostPacketId1, PACKET_RECEIVED, + static_cast<uint16_t>(kTimeDelayMs * i)); } @@ -297,8 +295,8 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOversizedFrameLog) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithTooManyLogFrames) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -343,7 +341,7 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithTooManyLogFrames) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOldLogFrames) { - static const uint32 kTimeBaseMs = 12345678; + static const uint32_t kTimeBaseMs = 12345678; TestRtcpPacketBuilder p; p.AddRr(kSendingSsrc, 1); @@ -390,7 +388,7 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportWithOldLogFrames) { } TEST_F(RtcpBuilderTest, RtcpReceiverReportRedundancy) { - uint32 time_base_ms = 12345678; + uint32_t time_base_ms = 12345678; int kTimeBetweenEventsMs = 10; RtcpReportBlock report_block = GetReportBlock(); @@ -413,9 +411,9 @@ TEST_F(RtcpBuilderTest, RtcpReceiverReportRedundancy) { time_base_ms - (num_events - 1) * kResendDelay * kTimeBetweenEventsMs); for (int i = 0; i < num_events; i++) { - p.AddReceiverEventLog( - 0, FRAME_ACK_SENT, - base::checked_cast<uint16>(i * kResendDelay * kTimeBetweenEventsMs)); + p.AddReceiverEventLog(0, FRAME_ACK_SENT, + base::checked_cast<uint16_t>(i * kResendDelay * + kTimeBetweenEventsMs)); } FrameEvent frame_event; diff --git a/media/cast/net/rtcp/rtcp_defines.cc b/media/cast/net/rtcp/rtcp_defines.cc index 128682b..2648a04 100644 --- a/media/cast/net/rtcp/rtcp_defines.cc +++ b/media/cast/net/rtcp/rtcp_defines.cc @@ -9,7 +9,7 @@ namespace media { namespace cast { -RtcpCastMessage::RtcpCastMessage(uint32 ssrc) +RtcpCastMessage::RtcpCastMessage(uint32_t ssrc) : media_ssrc(ssrc), ack_frame_id(0u), target_delay_ms(0) {} RtcpCastMessage::RtcpCastMessage() : media_ssrc(0), ack_frame_id(0u), target_delay_ms(0) {} @@ -19,7 +19,7 @@ RtcpReceiverEventLogMessage::RtcpReceiverEventLogMessage() : type(UNKNOWN), packet_id(0u) {} RtcpReceiverEventLogMessage::~RtcpReceiverEventLogMessage() {} -RtcpReceiverFrameLogMessage::RtcpReceiverFrameLogMessage(uint32 timestamp) +RtcpReceiverFrameLogMessage::RtcpReceiverFrameLogMessage(uint32_t timestamp) : rtp_timestamp_(timestamp) {} RtcpReceiverFrameLogMessage::~RtcpReceiverFrameLogMessage() {} diff --git a/media/cast/net/rtcp/rtcp_defines.h b/media/cast/net/rtcp/rtcp_defines.h index 72fdc31..032383a 100644 --- a/media/cast/net/rtcp/rtcp_defines.h +++ b/media/cast/net/rtcp/rtcp_defines.h @@ -38,13 +38,13 @@ enum RtcpPacketFields { // Handle the per frame ACK and NACK messages. struct RtcpCastMessage { - explicit RtcpCastMessage(uint32 ssrc); + explicit RtcpCastMessage(uint32_t ssrc); RtcpCastMessage(); ~RtcpCastMessage(); - uint32 media_ssrc; - uint32 ack_frame_id; - uint16 target_delay_ms; + uint32_t media_ssrc; + uint32_t ack_frame_id; + uint16_t target_delay_ms; MissingFramesAndPacketsMap missing_frames_and_packets; }; @@ -56,16 +56,16 @@ struct RtcpReceiverEventLogMessage { CastLoggingEvent type; base::TimeTicks event_timestamp; base::TimeDelta delay_delta; - uint16 packet_id; + uint16_t packet_id; }; typedef std::list<RtcpReceiverEventLogMessage> RtcpReceiverEventLogMessages; struct RtcpReceiverFrameLogMessage { - explicit RtcpReceiverFrameLogMessage(uint32 rtp_timestamp); + explicit RtcpReceiverFrameLogMessage(uint32_t rtp_timestamp); ~RtcpReceiverFrameLogMessage(); - uint32 rtp_timestamp_; + uint32_t rtp_timestamp_; RtcpReceiverEventLogMessages event_log_messages_; // TODO(mikhal): Investigate what's the best way to allow adding @@ -79,9 +79,9 @@ struct RtcpReceiverReferenceTimeReport { RtcpReceiverReferenceTimeReport(); ~RtcpReceiverReferenceTimeReport(); - uint32 remote_ssrc; - uint32 ntp_seconds; - uint32 ntp_fraction; + uint32_t remote_ssrc; + uint32_t ntp_seconds; + uint32_t ntp_fraction; }; inline bool operator==(RtcpReceiverReferenceTimeReport lhs, @@ -107,7 +107,7 @@ struct RtcpEvent { base::TimeDelta delay_delta; // Only set for packet events. - uint16 packet_id; + uint16_t packet_id; }; typedef base::Callback<void(const RtcpCastMessage&)> RtcpCastMessageCallback; @@ -118,16 +118,16 @@ base::Callback<void(const RtcpReceiverLogMessage&)> RtcpLogMessageCallback; // TODO(hubbe): Document members of this struct. struct RtpReceiverStatistics { RtpReceiverStatistics(); - uint8 fraction_lost; - uint32 cumulative_lost; // 24 bits valid. - uint32 extended_high_sequence_number; - uint32 jitter; + uint8_t fraction_lost; + uint32_t cumulative_lost; // 24 bits valid. + uint32_t extended_high_sequence_number; + uint32_t jitter; }; // These are intended to only be created using Rtcp::ConvertToNTPAndSave. struct RtcpTimeData { - uint32 ntp_seconds; - uint32 ntp_fraction; + uint32_t ntp_seconds; + uint32_t ntp_fraction; base::TimeTicks timestamp; }; @@ -136,8 +136,8 @@ struct RtcpTimeData { struct SendRtcpFromRtpReceiver_Params { SendRtcpFromRtpReceiver_Params(); ~SendRtcpFromRtpReceiver_Params(); - uint32 ssrc; - uint32 sender_ssrc; + uint32_t ssrc; + uint32_t sender_ssrc; RtcpTimeData time_data; scoped_ptr<RtcpCastMessage> cast_message; base::TimeDelta target_delay; diff --git a/media/cast/net/rtcp/rtcp_unittest.cc b/media/cast/net/rtcp/rtcp_unittest.cc index 88b7d45..7b85391 100644 --- a/media/cast/net/rtcp/rtcp_unittest.cc +++ b/media/cast/net/rtcp/rtcp_unittest.cc @@ -19,8 +19,8 @@ namespace cast { using testing::_; -static const uint32 kSenderSsrc = 0x10203; -static const uint32 kReceiverSsrc = 0x40506; +static const uint32_t kSenderSsrc = 0x10203; +static const uint32_t kReceiverSsrc = 0x40506; static const int kInitialReceiverClockOffsetSeconds = -5; class FakeRtcpTransport : public PacedPacketSender { @@ -35,7 +35,7 @@ class FakeRtcpTransport : public PacedPacketSender { base::TimeDelta packet_delay() const { return packet_delay_; } void set_packet_delay(base::TimeDelta delay) { packet_delay_ = delay; } - bool SendRtcpPacket(uint32 ssrc, PacketRef packet) final { + bool SendRtcpPacket(uint32_t ssrc, PacketRef packet) final { clock_->Advance(packet_delay_); if (paused_) { packet_queue_.push_back(packet); @@ -143,13 +143,13 @@ TEST_F(RtcpTest, LipSyncGleanedFromSenderReport) { // Initially, expect no lip-sync info receiver-side without having first // received a RTCP packet. base::TimeTicks reference_time; - uint32 rtp_timestamp; + uint32_t rtp_timestamp; ASSERT_FALSE(rtcp_for_receiver_.GetLatestLipSyncTimes(&rtp_timestamp, &reference_time)); // Send a Sender Report to the receiver. const base::TimeTicks reference_time_sent = sender_clock_->NowTicks(); - const uint32 rtp_timestamp_sent = 0xbee5; + const uint32_t rtp_timestamp_sent = 0xbee5; rtcp_for_sender_.SendRtcpFromRtpSender( reference_time_sent, rtp_timestamp_sent, 1, 1); @@ -193,7 +193,7 @@ TEST_F(RtcpTest, RoundTripTimesDeterminedFromReportPingPong) { // Sender --> Receiver base::TimeTicks reference_time_sent = sender_clock_->NowTicks(); - uint32 rtp_timestamp_sent = 0xbee5 + i; + uint32_t rtp_timestamp_sent = 0xbee5 + i; rtcp_for_sender_.SendRtcpFromRtpSender( reference_time_sent, rtp_timestamp_sent, 1, 1); EXPECT_EQ(expected_rtt_according_to_sender, @@ -267,11 +267,11 @@ TEST_F(RtcpTest, NegativeTimeTicks) { // TODO(miu): Find a better home for this test. TEST(MisplacedCastTest, NtpAndTime) { - const int64 kSecondsbetweenYear1900and2010 = INT64_C(40176 * 24 * 60 * 60); - const int64 kSecondsbetweenYear1900and2030 = INT64_C(47481 * 24 * 60 * 60); + const int64_t kSecondsbetweenYear1900and2010 = INT64_C(40176 * 24 * 60 * 60); + const int64_t kSecondsbetweenYear1900and2030 = INT64_C(47481 * 24 * 60 * 60); - uint32 ntp_seconds_1 = 0; - uint32 ntp_fraction_1 = 0; + uint32_t ntp_seconds_1 = 0; + uint32_t ntp_fraction_1 = 0; base::TimeTicks input_time = base::TimeTicks::Now(); ConvertTimeTicksToNtp(input_time, &ntp_seconds_1, &ntp_fraction_1); @@ -285,8 +285,8 @@ TEST(MisplacedCastTest, NtpAndTime) { base::TimeDelta time_delta = base::TimeDelta::FromMilliseconds(1000); input_time += time_delta; - uint32 ntp_seconds_2 = 0; - uint32 ntp_fraction_2 = 0; + uint32_t ntp_seconds_2 = 0; + uint32_t ntp_fraction_2 = 0; ConvertTimeTicksToNtp(input_time, &ntp_seconds_2, &ntp_fraction_2); base::TimeTicks out_2 = ConvertNtpToTimeTicks(ntp_seconds_2, ntp_fraction_2); @@ -300,8 +300,8 @@ TEST(MisplacedCastTest, NtpAndTime) { time_delta = base::TimeDelta::FromMilliseconds(500); input_time += time_delta; - uint32 ntp_seconds_3 = 0; - uint32 ntp_fraction_3 = 0; + uint32_t ntp_seconds_3 = 0; + uint32_t ntp_fraction_3 = 0; ConvertTimeTicksToNtp(input_time, &ntp_seconds_3, &ntp_fraction_3); base::TimeTicks out_3 = ConvertNtpToTimeTicks(ntp_seconds_3, ntp_fraction_3); diff --git a/media/cast/net/rtcp/rtcp_utility.cc b/media/cast/net/rtcp/rtcp_utility.cc index f299258..1ad69eb 100644 --- a/media/cast/net/rtcp/rtcp_utility.cc +++ b/media/cast/net/rtcp/rtcp_utility.cc @@ -24,14 +24,13 @@ const int64_t kUnixEpochInNtpSeconds = INT64_C(2208988800); const double kMagicFractionalUnit = 4.294967296E3; } -RtcpParser::RtcpParser(uint32 local_ssrc, uint32 remote_ssrc) : - local_ssrc_(local_ssrc), - remote_ssrc_(remote_ssrc), - has_sender_report_(false), - has_last_report_(false), - has_cast_message_(false), - has_receiver_reference_time_report_(false) { -} +RtcpParser::RtcpParser(uint32_t local_ssrc, uint32_t remote_ssrc) + : local_ssrc_(local_ssrc), + remote_ssrc_(remote_ssrc), + has_sender_report_(false), + has_last_report_(false), + has_cast_message_(false), + has_receiver_reference_time_report_(false) {} RtcpParser::~RtcpParser() {} @@ -86,7 +85,7 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, // // Common header for all Rtcp packets, 4 octets. - uint8 byte; + uint8_t byte; if (!reader->ReadU8(&byte)) return false; parsed_header->V = byte >> 6; @@ -100,7 +99,7 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, if (!reader->ReadU8(&parsed_header->PT)) return false; - uint16 bytes; + uint16_t bytes; if (!reader->ReadU16(&bytes)) return false; @@ -114,14 +113,14 @@ bool RtcpParser::ParseCommonHeader(base::BigEndianReader* reader, bool RtcpParser::ParseSR(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 sender_ssrc; + uint32_t sender_ssrc; if (!reader->ReadU32(&sender_ssrc)) return false; if (sender_ssrc != remote_ssrc_) return true; - uint32 tmp; + uint32_t tmp; if (!reader->ReadU32(&sender_report_.ntp_seconds) || !reader->ReadU32(&sender_report_.ntp_fraction) || !reader->ReadU32(&sender_report_.rtp_timestamp) || @@ -140,7 +139,7 @@ bool RtcpParser::ParseSR(base::BigEndianReader* reader, bool RtcpParser::ParseRR(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 receiver_ssrc; + uint32_t receiver_ssrc; if (!reader->ReadU32(&receiver_ssrc)) return false; @@ -155,7 +154,7 @@ bool RtcpParser::ParseRR(base::BigEndianReader* reader, } bool RtcpParser::ParseReportBlock(base::BigEndianReader* reader) { - uint32 ssrc, last_report, delay; + uint32_t ssrc, last_report, delay; if (!reader->ReadU32(&ssrc) || !reader->Skip(12) || !reader->ReadU32(&last_report) || @@ -173,8 +172,8 @@ bool RtcpParser::ParseReportBlock(base::BigEndianReader* reader) { bool RtcpParser::ParseApplicationDefined(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 sender_ssrc; - uint32 name; + uint32_t sender_ssrc; + uint32_t name; if (!reader->ReadU32(&sender_ssrc) || !reader->ReadU32(&name)) return false; @@ -198,8 +197,8 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( base::BigEndianReader* reader) { while (reader->remaining()) { - uint32 rtp_timestamp; - uint32 data; + uint32_t rtp_timestamp; + uint32_t data; if (!reader->ReadU32(&rtp_timestamp) || !reader->ReadU32(&data)) return false; @@ -208,19 +207,19 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( base::TimeTicks event_timestamp_base = base::TimeTicks() + base::TimeDelta::FromMilliseconds(data & 0xffffff); - size_t num_events = 1 + static_cast<uint8>(data >> 24); + size_t num_events = 1 + static_cast<uint8_t>(data >> 24); RtcpReceiverFrameLogMessage frame_log(rtp_timestamp); for (size_t event = 0; event < num_events; event++) { - uint16 delay_delta_or_packet_id; - uint16 event_type_and_timestamp_delta; + uint16_t delay_delta_or_packet_id; + uint16_t event_type_and_timestamp_delta; if (!reader->ReadU16(&delay_delta_or_packet_id) || !reader->ReadU16(&event_type_and_timestamp_delta)) return false; RtcpReceiverEventLogMessage event_log; event_log.type = TranslateToLogEventFromWireFormat( - static_cast<uint8>(event_type_and_timestamp_delta >> 12)); + static_cast<uint8_t>(event_type_and_timestamp_delta >> 12)); event_log.event_timestamp = event_timestamp_base + base::TimeDelta::FromMilliseconds( @@ -229,7 +228,7 @@ bool RtcpParser::ParseCastReceiverLogFrameItem( event_log.packet_id = delay_delta_or_packet_id; } else { event_log.delay_delta = base::TimeDelta::FromMilliseconds( - static_cast<int16>(delay_delta_or_packet_id)); + static_cast<int16_t>(delay_delta_or_packet_id)); } frame_log.event_log_messages_.push_back(event_log); } @@ -247,8 +246,8 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, if (header.IC != 15) { return true; } - uint32 remote_ssrc; - uint32 media_ssrc; + uint32_t remote_ssrc; + uint32_t media_ssrc; if (!reader->ReadU32(&remote_ssrc) || !reader->ReadU32(&media_ssrc)) return false; @@ -256,7 +255,7 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, if (remote_ssrc != remote_ssrc_) return true; - uint32 name; + uint32_t name; if (!reader->ReadU32(&name)) return false; @@ -266,8 +265,8 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, cast_message_.media_ssrc = remote_ssrc; - uint8 last_frame_id; - uint8 number_of_lost_fields; + uint8_t last_frame_id; + uint8_t number_of_lost_fields; if (!reader->ReadU8(&last_frame_id) || !reader->ReadU8(&number_of_lost_fields) || !reader->ReadU16(&cast_message_.target_delay_ms)) @@ -277,9 +276,9 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, cast_message_.ack_frame_id = last_frame_id; for (size_t i = 0; i < number_of_lost_fields; i++) { - uint8 frame_id; - uint16 packet_id; - uint8 bitmask; + uint8_t frame_id; + uint16_t packet_id; + uint8_t bitmask; if (!reader->ReadU8(&frame_id) || !reader->ReadU16(&packet_id) || !reader->ReadU8(&bitmask)) @@ -301,7 +300,7 @@ bool RtcpParser::ParseFeedbackCommon(base::BigEndianReader* reader, bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, const RtcpCommonHeader& header) { - uint32 remote_ssrc; + uint32_t remote_ssrc; if (!reader->ReadU32(&remote_ssrc)) return false; @@ -310,8 +309,8 @@ bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, return true; while (reader->remaining()) { - uint8 block_type; - uint16 block_length; + uint8_t block_type; + uint16_t block_length; if (!reader->ReadU8(&block_type) || !reader->Skip(1) || !reader->ReadU16(&block_length)) @@ -338,7 +337,7 @@ bool RtcpParser::ParseExtendedReport(base::BigEndianReader* reader, bool RtcpParser::ParseExtendedReportReceiverReferenceTimeReport( base::BigEndianReader* reader, - uint32 remote_ssrc) { + uint32_t remote_ssrc) { receiver_reference_time_report_.remote_ssrc = remote_ssrc; if(!reader->ReadU32(&receiver_reference_time_report_.ntp_seconds) || !reader->ReadU32(&receiver_reference_time_report_.ntp_fraction)) @@ -351,7 +350,7 @@ bool RtcpParser::ParseExtendedReportReceiverReferenceTimeReport( // Converts a log event type to an integer value. // NOTE: We have only allocated 4 bits to represent the type of event over the // wire. Therefore, this function can only return values from 0 to 15. -uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) { +uint8_t ConvertEventTypeToWireFormat(CastLoggingEvent event) { switch (event) { case FRAME_ACK_SENT: return 11; @@ -366,7 +365,7 @@ uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event) { } } -CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event) { +CastLoggingEvent TranslateToLogEventFromWireFormat(uint8_t event) { // TODO(imcheng): Remove the old mappings once they are no longer used. switch (event) { case 1: // AudioAckSent @@ -407,10 +406,10 @@ void ConvertTimeToFractions(int64_t ntp_time_us, // off the entire system. DCHECK_LT(seconds_component, INT64_C(4263431296)) << "One year left to fix the NTP year 2036 wrap-around issue!"; - *seconds = static_cast<uint32>(seconds_component); + *seconds = static_cast<uint32_t>(seconds_component); *fractions = - static_cast<uint32>((ntp_time_us % base::Time::kMicrosecondsPerSecond) * - kMagicFractionalUnit); + static_cast<uint32_t>((ntp_time_us % base::Time::kMicrosecondsPerSecond) * + kMagicFractionalUnit); } void ConvertTimeTicksToNtp(const base::TimeTicks& time, diff --git a/media/cast/net/rtcp/rtcp_utility.h b/media/cast/net/rtcp/rtcp_utility.h index a0a2abff..4092951 100644 --- a/media/cast/net/rtcp/rtcp_utility.h +++ b/media/cast/net/rtcp/rtcp_utility.h @@ -16,24 +16,24 @@ namespace cast { // RFC 3550 page 44, including end null. static const size_t kRtcpCnameSize = 256; -static const uint32 kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T'; +static const uint32_t kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T'; -static const uint8 kReceiverLogSubtype = 2; +static const uint8_t kReceiverLogSubtype = 2; static const size_t kRtcpMaxReceiverLogMessages = 256; static const size_t kRtcpMaxCastLossFields = 100; struct RtcpCommonHeader { - uint8 V; // Version. + uint8_t V; // Version. bool P; // Padding. - uint8 IC; // Item count / subtype. - uint8 PT; // Packet Type. + uint8_t IC; // Item count / subtype. + uint8_t PT; // Packet Type. size_t length_in_octets; }; class RtcpParser { public: - RtcpParser(uint32 local_ssrc, uint32 remote_ssrc); + RtcpParser(uint32_t local_ssrc, uint32_t remote_ssrc); ~RtcpParser(); bool Parse(base::BigEndianReader* reader); @@ -44,8 +44,8 @@ class RtcpParser { } bool has_last_report() const { return has_last_report_; } - uint32 last_report() const { return last_report_; } - uint32 delay_since_last_report() const { return delay_since_last_report_; } + uint32_t last_report() const { return last_report_; } + uint32_t delay_since_last_report() const { return delay_since_last_report_; } bool has_receiver_log() const { return !receiver_log_.empty(); } const RtcpReceiverLogMessage& receiver_log() const { return receiver_log_; } @@ -80,18 +80,18 @@ class RtcpParser { const RtcpCommonHeader& header); bool ParseExtendedReportReceiverReferenceTimeReport( base::BigEndianReader* reader, - uint32 remote_ssrc); + uint32_t remote_ssrc); bool ParseExtendedReportDelaySinceLastReceiverReport( base::BigEndianReader* reader); - uint32 local_ssrc_; - uint32 remote_ssrc_; + uint32_t local_ssrc_; + uint32_t remote_ssrc_; bool has_sender_report_; RtcpSenderInfo sender_report_; - uint32 last_report_; - uint32 delay_since_last_report_; + uint32_t last_report_; + uint32_t delay_since_last_report_; bool has_last_report_; // |receiver_log_| is a vector vector, no need for has_*. @@ -109,10 +109,10 @@ class RtcpParser { // Converts a log event type to an integer value. // NOTE: We have only allocated 4 bits to represent the type of event over the // wire. Therefore, this function can only return values from 0 to 15. -uint8 ConvertEventTypeToWireFormat(CastLoggingEvent event); +uint8_t ConvertEventTypeToWireFormat(CastLoggingEvent event); // The inverse of |ConvertEventTypeToWireFormat()|. -CastLoggingEvent TranslateToLogEventFromWireFormat(uint8 event); +CastLoggingEvent TranslateToLogEventFromWireFormat(uint8_t event); // Splits an NTP timestamp having a microsecond timebase into the standard two // 32-bit integer wire format. diff --git a/media/cast/net/rtcp/rtcp_utility_unittest.cc b/media/cast/net/rtcp/rtcp_utility_unittest.cc index ec38755..ca68176 100644 --- a/media/cast/net/rtcp/rtcp_utility_unittest.cc +++ b/media/cast/net/rtcp/rtcp_utility_unittest.cc @@ -14,9 +14,9 @@ namespace media { namespace cast { -static const uint32 kSenderSsrc = 0x10203; -static const uint32 kSourceSsrc = 0x40506; -static const uint32 kUnknownSsrc = 0xDEAD; +static const uint32_t kSenderSsrc = 0x10203; +static const uint32_t kSourceSsrc = 0x40506; +static const uint32_t kUnknownSsrc = 0xDEAD; static const base::TimeDelta kTargetDelay = base::TimeDelta::FromMilliseconds(100); @@ -322,9 +322,9 @@ TEST_F(RtcpParserTest, InjectReceiverReportPacketWithCastFeedback) { } TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; - static const uint32 kDelayDeltaMs = 123; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; + static const uint32_t kDelayDeltaMs = 123; base::SimpleTestTickClock testing_clock; testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); @@ -365,8 +365,8 @@ TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationBase) { } TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationMulti) { - static const uint32 kTimeBaseMs = 12345678; - static const uint32 kTimeDelayMs = 10; + static const uint32_t kTimeBaseMs = 12345678; + static const uint32_t kTimeDelayMs = 10; static const int kDelayDeltaMs = 123; // To be varied for every frame. base::SimpleTestTickClock testing_clock; testing_clock.Advance(base::TimeDelta::FromMilliseconds(kTimeBaseMs)); @@ -392,7 +392,7 @@ TEST_F(RtcpParserTest, InjectReceiverReportWithReceiverLogVerificationMulti) { for (int i = 0; i < 100; ++i) { p.AddReceiverFrameLog(kRtpTimestamp, 1, kTimeBaseMs + i * kTimeDelayMs); const int delay = (i - 50) * kDelayDeltaMs; - p.AddReceiverEventLog(static_cast<uint16>(delay), FRAME_ACK_SENT, 0); + p.AddReceiverEventLog(static_cast<uint16_t>(delay), FRAME_ACK_SENT, 0); } RtcpParser parser(kSourceSsrc, kSenderSsrc); diff --git a/media/cast/net/rtcp/test_rtcp_packet_builder.cc b/media/cast/net/rtcp/test_rtcp_packet_builder.cc index 32e1883..382cde4 100644 --- a/media/cast/net/rtcp/test_rtcp_packet_builder.cc +++ b/media/cast/net/rtcp/test_rtcp_packet_builder.cc @@ -15,7 +15,7 @@ TestRtcpPacketBuilder::TestRtcpPacketBuilder() big_endian_writer_(reinterpret_cast<char*>(buffer_), kMaxIpPacketSize), big_endian_reader_(NULL, 0) {} -void TestRtcpPacketBuilder::AddSr(uint32 sender_ssrc, +void TestRtcpPacketBuilder::AddSr(uint32_t sender_ssrc, int number_of_report_blocks) { AddRtcpHeader(200, number_of_report_blocks); big_endian_writer_.WriteU32(sender_ssrc); @@ -26,10 +26,10 @@ void TestRtcpPacketBuilder::AddSr(uint32 sender_ssrc, big_endian_writer_.WriteU32(kSendOctetCount); } -void TestRtcpPacketBuilder::AddSrWithNtp(uint32 sender_ssrc, - uint32 ntp_high, - uint32 ntp_low, - uint32 rtp_timestamp) { +void TestRtcpPacketBuilder::AddSrWithNtp(uint32_t sender_ssrc, + uint32_t ntp_high, + uint32_t ntp_low, + uint32_t rtp_timestamp) { AddRtcpHeader(200, 0); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(ntp_high); @@ -39,13 +39,13 @@ void TestRtcpPacketBuilder::AddSrWithNtp(uint32 sender_ssrc, big_endian_writer_.WriteU32(kSendOctetCount); } -void TestRtcpPacketBuilder::AddRr(uint32 sender_ssrc, +void TestRtcpPacketBuilder::AddRr(uint32_t sender_ssrc, int number_of_report_blocks) { AddRtcpHeader(201, number_of_report_blocks); big_endian_writer_.WriteU32(sender_ssrc); } -void TestRtcpPacketBuilder::AddRb(uint32 rtp_ssrc) { +void TestRtcpPacketBuilder::AddRb(uint32_t rtp_ssrc) { big_endian_writer_.WriteU32(rtp_ssrc); big_endian_writer_.WriteU32(kLoss); big_endian_writer_.WriteU32(kExtendedMax); @@ -54,7 +54,7 @@ void TestRtcpPacketBuilder::AddRb(uint32 rtp_ssrc) { big_endian_writer_.WriteU32(kDelayLastSr); } -void TestRtcpPacketBuilder::AddXrHeader(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrHeader(uint32_t sender_ssrc) { AddRtcpHeader(207, 0); big_endian_writer_.WriteU32(sender_ssrc); } @@ -77,7 +77,7 @@ void TestRtcpPacketBuilder::AddUnknownBlock() { big_endian_writer_.WriteU32(42); } -void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32_t sender_ssrc) { big_endian_writer_.WriteU8(5); // Block type. big_endian_writer_.WriteU8(0); // Reserved. big_endian_writer_.WriteU16(3); // Block length. @@ -88,7 +88,7 @@ void TestRtcpPacketBuilder::AddXrDlrrBlock(uint32 sender_ssrc) { big_endian_writer_.WriteU32(kDelayLastRr); } -void TestRtcpPacketBuilder::AddXrExtendedDlrrBlock(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddXrExtendedDlrrBlock(uint32_t sender_ssrc) { big_endian_writer_.WriteU8(5); // Block type. big_endian_writer_.WriteU8(0); // Reserved. big_endian_writer_.WriteU16(9); // Block length. @@ -113,7 +113,7 @@ void TestRtcpPacketBuilder::AddXrRrtrBlock() { big_endian_writer_.WriteU32(kNtpLow); } -void TestRtcpPacketBuilder::AddNack(uint32 sender_ssrc, uint32 media_ssrc) { +void TestRtcpPacketBuilder::AddNack(uint32_t sender_ssrc, uint32_t media_ssrc) { AddRtcpHeader(205, 1); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(media_ssrc); @@ -121,15 +121,15 @@ void TestRtcpPacketBuilder::AddNack(uint32 sender_ssrc, uint32 media_ssrc) { big_endian_writer_.WriteU16(0); } -void TestRtcpPacketBuilder::AddSendReportRequest(uint32 sender_ssrc, - uint32 media_ssrc) { +void TestRtcpPacketBuilder::AddSendReportRequest(uint32_t sender_ssrc, + uint32_t media_ssrc) { AddRtcpHeader(205, 5); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU32(media_ssrc); } -void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, - uint32 media_ssrc, +void TestRtcpPacketBuilder::AddCast(uint32_t sender_ssrc, + uint32_t media_ssrc, base::TimeDelta target_delay) { AddRtcpHeader(206, 15); big_endian_writer_.WriteU32(sender_ssrc); @@ -152,7 +152,7 @@ void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, big_endian_writer_.WriteU8(0); // Lost packet id mask. } -void TestRtcpPacketBuilder::AddReceiverLog(uint32 sender_ssrc) { +void TestRtcpPacketBuilder::AddReceiverLog(uint32_t sender_ssrc) { AddRtcpHeader(204, 2); big_endian_writer_.WriteU32(sender_ssrc); big_endian_writer_.WriteU8('C'); @@ -161,22 +161,22 @@ void TestRtcpPacketBuilder::AddReceiverLog(uint32 sender_ssrc) { big_endian_writer_.WriteU8('T'); } -void TestRtcpPacketBuilder::AddReceiverFrameLog(uint32 rtp_timestamp, +void TestRtcpPacketBuilder::AddReceiverFrameLog(uint32_t rtp_timestamp, int num_events, - uint32 event_timesamp_base) { + uint32_t event_timesamp_base) { big_endian_writer_.WriteU32(rtp_timestamp); - big_endian_writer_.WriteU8(static_cast<uint8>(num_events - 1)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base >> 16)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base >> 8)); - big_endian_writer_.WriteU8(static_cast<uint8>(event_timesamp_base)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(num_events - 1)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base >> 16)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base >> 8)); + big_endian_writer_.WriteU8(static_cast<uint8_t>(event_timesamp_base)); } -void TestRtcpPacketBuilder::AddReceiverEventLog(uint16 event_data, +void TestRtcpPacketBuilder::AddReceiverEventLog(uint16_t event_data, CastLoggingEvent event, - uint16 event_timesamp_delta) { + uint16_t event_timesamp_delta) { big_endian_writer_.WriteU16(event_data); - uint8 event_id = ConvertEventTypeToWireFormat(event); - uint16 type_and_delta = static_cast<uint16>(event_id) << 12; + uint8_t event_id = ConvertEventTypeToWireFormat(event); + uint16_t type_and_delta = static_cast<uint16_t>(event_id) << 12; type_and_delta += event_timesamp_delta & 0x0fff; big_endian_writer_.WriteU16(type_and_delta); } @@ -187,7 +187,7 @@ scoped_ptr<media::cast::Packet> TestRtcpPacketBuilder::GetPacket() { new media::cast::Packet(buffer_, buffer_ + Length())); } -const uint8* TestRtcpPacketBuilder::Data() { +const uint8_t* TestRtcpPacketBuilder::Data() { PatchLengthField(); return buffer_; } diff --git a/media/cast/net/rtcp/test_rtcp_packet_builder.h b/media/cast/net/rtcp/test_rtcp_packet_builder.h index 948f7a0..04ceb05 100644 --- a/media/cast/net/rtcp/test_rtcp_packet_builder.h +++ b/media/cast/net/rtcp/test_rtcp_packet_builder.h @@ -18,18 +18,18 @@ namespace cast { namespace { // Sender report. -static const uint32 kNtpHigh = 0x01020304; -static const uint32 kNtpLow = 0x05060708; -static const uint32 kRtpTimestamp = 0x10203040; -static const uint32 kSendPacketCount = 987; -static const uint32 kSendOctetCount = 87654; +static const uint32_t kNtpHigh = 0x01020304; +static const uint32_t kNtpLow = 0x05060708; +static const uint32_t kRtpTimestamp = 0x10203040; +static const uint32_t kSendPacketCount = 987; +static const uint32_t kSendOctetCount = 87654; // Report block. static const int kLoss = 0x01000123; static const int kExtendedMax = 0x15678; static const int kTestJitter = 0x10203; -static const uint32 kLastSr = 0x34561234; -static const uint32 kDelayLastSr = 1000; +static const uint32_t kLastSr = 0x34561234; +static const uint32_t kDelayLastSr = 1000; // DLRR block. static const int kLastRr = 0x34561234; @@ -39,9 +39,9 @@ static const int kDelayLastRr = 1000; static const int kMissingPacket = 34567; // CAST. -static const uint32 kAckFrameId = 17; -static const uint32 kLostFrameId = 18; -static const uint32 kFrameIdWithLostPackets = 19; +static const uint32_t kAckFrameId = 17; +static const uint32_t kLostFrameId = 18; +static const uint32_t kFrameIdWithLostPackets = 19; static const int kLostPacketId1 = 3; static const int kLostPacketId2 = 5; static const int kLostPacketId3 = 12; @@ -51,37 +51,37 @@ class TestRtcpPacketBuilder { public: TestRtcpPacketBuilder(); - void AddSr(uint32 sender_ssrc, int number_of_report_blocks); - void AddSrWithNtp(uint32 sender_ssrc, - uint32 ntp_high, - uint32 ntp_low, - uint32 rtp_timestamp); - void AddRr(uint32 sender_ssrc, int number_of_report_blocks); - void AddRb(uint32 rtp_ssrc); - - void AddXrHeader(uint32 sender_ssrc); - void AddXrDlrrBlock(uint32 sender_ssrc); - void AddXrExtendedDlrrBlock(uint32 sender_ssrc); + void AddSr(uint32_t sender_ssrc, int number_of_report_blocks); + void AddSrWithNtp(uint32_t sender_ssrc, + uint32_t ntp_high, + uint32_t ntp_low, + uint32_t rtp_timestamp); + void AddRr(uint32_t sender_ssrc, int number_of_report_blocks); + void AddRb(uint32_t rtp_ssrc); + + void AddXrHeader(uint32_t sender_ssrc); + void AddXrDlrrBlock(uint32_t sender_ssrc); + void AddXrExtendedDlrrBlock(uint32_t sender_ssrc); void AddXrRrtrBlock(); void AddXrUnknownBlock(); void AddUnknownBlock(); - void AddNack(uint32 sender_ssrc, uint32 media_ssrc); - void AddSendReportRequest(uint32 sender_ssrc, uint32 media_ssrc); + void AddNack(uint32_t sender_ssrc, uint32_t media_ssrc); + void AddSendReportRequest(uint32_t sender_ssrc, uint32_t media_ssrc); - void AddCast(uint32 sender_ssrc, - uint32 media_ssrc, + void AddCast(uint32_t sender_ssrc, + uint32_t media_ssrc, base::TimeDelta target_delay); - void AddReceiverLog(uint32 sender_ssrc); - void AddReceiverFrameLog(uint32 rtp_timestamp, + void AddReceiverLog(uint32_t sender_ssrc); + void AddReceiverFrameLog(uint32_t rtp_timestamp, int num_events, - uint32 event_timesamp_base); - void AddReceiverEventLog(uint16 event_data, + uint32_t event_timesamp_base); + void AddReceiverEventLog(uint16_t event_data, CastLoggingEvent event, - uint16 event_timesamp_delta); + uint16_t event_timesamp_delta); scoped_ptr<Packet> GetPacket(); - const uint8* Data(); + const uint8_t* Data(); int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } base::BigEndianReader* Reader(); @@ -91,7 +91,7 @@ class TestRtcpPacketBuilder { // Where the length field of the current packet is. // Note: 0 is not a legal value, it is used for "uninitialized". - uint8 buffer_[kMaxIpPacketSize]; + uint8_t buffer_[kMaxIpPacketSize]; char* ptr_of_length_; base::BigEndianWriter big_endian_writer_; base::BigEndianReader big_endian_reader_; diff --git a/media/cast/net/rtp/cast_message_builder.cc b/media/cast/net/rtp/cast_message_builder.cc index da851ee..0a47887 100644 --- a/media/cast/net/rtp/cast_message_builder.cc +++ b/media/cast/net/rtp/cast_message_builder.cc @@ -31,7 +31,7 @@ CastMessageBuilder::CastMessageBuilder( base::TickClock* clock, RtpPayloadFeedback* incoming_payload_feedback, const Framer* framer, - uint32 media_ssrc, + uint32_t media_ssrc, bool decoder_faster_than_max_frame_rate, int max_unacked_frames) : clock_(clock), @@ -49,8 +49,8 @@ CastMessageBuilder::CastMessageBuilder( CastMessageBuilder::~CastMessageBuilder() {} -void CastMessageBuilder::CompleteFrameReceived(uint32 frame_id) { - DCHECK_GE(static_cast<int32>(frame_id - last_acked_frame_id_), 0); +void CastMessageBuilder::CompleteFrameReceived(uint32_t frame_id) { + DCHECK_GE(static_cast<int32_t>(frame_id - last_acked_frame_id_), 0); VLOG(2) << "CompleteFrameReceived: " << frame_id; if (last_update_time_.is_null()) { // Our first update. @@ -67,7 +67,7 @@ void CastMessageBuilder::CompleteFrameReceived(uint32 frame_id) { cast_feedback_->CastFeedback(cast_msg_); } -bool CastMessageBuilder::UpdateAckMessage(uint32 frame_id) { +bool CastMessageBuilder::UpdateAckMessage(uint32_t frame_id) { if (!decoder_faster_than_max_frame_rate_) { int complete_frame_count = framer_->NumberOfCompleteFrames(); if (complete_frame_count > max_unacked_frames_) { @@ -169,8 +169,8 @@ void CastMessageBuilder::BuildPacketList() { if (framer_->Empty()) return; - uint32 newest_frame_id = framer_->NewestFrameId(); - uint32 next_expected_frame_id = cast_msg_.ack_frame_id + 1; + uint32_t newest_frame_id = framer_->NewestFrameId(); + uint32_t next_expected_frame_id = cast_msg_.ack_frame_id + 1; // Iterate over all frames. for (; !IsNewerFrameId(next_expected_frame_id, newest_frame_id); diff --git a/media/cast/net/rtp/cast_message_builder.h b/media/cast/net/rtp/cast_message_builder.h index ab9b72f..3b956b8 100644 --- a/media/cast/net/rtp/cast_message_builder.h +++ b/media/cast/net/rtp/cast_message_builder.h @@ -19,25 +19,25 @@ namespace cast { class Framer; class RtpPayloadFeedback; -typedef std::map<uint32, base::TimeTicks> TimeLastNackMap; +typedef std::map<uint32_t, base::TimeTicks> TimeLastNackMap; class CastMessageBuilder { public: CastMessageBuilder(base::TickClock* clock, RtpPayloadFeedback* incoming_payload_feedback, const Framer* framer, - uint32 media_ssrc, + uint32_t media_ssrc, bool decoder_faster_than_max_frame_rate, int max_unacked_frames); ~CastMessageBuilder(); - void CompleteFrameReceived(uint32 frame_id); + void CompleteFrameReceived(uint32_t frame_id); bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); void UpdateCastMessage(); void Reset(); private: - bool UpdateAckMessage(uint32 frame_id); + bool UpdateAckMessage(uint32_t frame_id); void BuildPacketList(); bool UpdateCastMessageInternal(RtcpCastMessage* message); @@ -46,7 +46,7 @@ class CastMessageBuilder { // CastMessageBuilder has only const access to the framer. const Framer* const framer_; - const uint32 media_ssrc_; + const uint32_t media_ssrc_; const bool decoder_faster_than_max_frame_rate_; const int max_unacked_frames_; @@ -57,8 +57,8 @@ class CastMessageBuilder { bool slowing_down_ack_; bool acked_last_frame_; - uint32 last_acked_frame_id_; - std::deque<uint32> ack_queue_; + uint32_t last_acked_frame_id_; + std::deque<uint32_t> ack_queue_; DISALLOW_COPY_AND_ASSIGN(CastMessageBuilder); }; diff --git a/media/cast/net/rtp/cast_message_builder_unittest.cc b/media/cast/net/rtp/cast_message_builder_unittest.cc index 166834e..730ecf8 100644 --- a/media/cast/net/rtp/cast_message_builder_unittest.cc +++ b/media/cast/net/rtp/cast_message_builder_unittest.cc @@ -16,12 +16,12 @@ namespace media { namespace cast { namespace { -static const uint32 kSsrc = 0x1234; -static const uint32 kShortTimeIncrementMs = 10; -static const uint32 kLongTimeIncrementMs = 40; -static const int64 kStartMillisecond = INT64_C(12345678900000); +static const uint32_t kSsrc = 0x1234; +static const uint32_t kShortTimeIncrementMs = 10; +static const uint32_t kLongTimeIncrementMs = 40; +static const int64_t kStartMillisecond = INT64_C(12345678900000); -typedef std::map<uint32, size_t> MissingPacketsMap; +typedef std::map<uint32_t, size_t> MissingPacketsMap; class NackFeedbackVerification : public RtpPayloadFeedback { public: @@ -53,7 +53,7 @@ class NackFeedbackVerification : public RtpPayloadFeedback { triggered_ = true; } - size_t num_missing_packets(uint32 frame_id) { + size_t num_missing_packets(uint32_t frame_id) { MissingPacketsMap::iterator it; it = missing_packets_.find(frame_id); if (it == missing_packets_.end()) @@ -69,12 +69,12 @@ class NackFeedbackVerification : public RtpPayloadFeedback { return ret_val; } - uint32 last_frame_acked() { return last_frame_acked_; } + uint32_t last_frame_acked() { return last_frame_acked_; } private: bool triggered_; MissingPacketsMap missing_packets_; // Missing packets per frame. - uint32 last_frame_acked_; + uint32_t last_frame_acked_; DISALLOW_COPY_AND_ASSIGN(NackFeedbackVerification); }; @@ -102,14 +102,14 @@ class CastMessageBuilderTest : public ::testing::Test { ~CastMessageBuilderTest() override {} - void SetFrameIds(uint32 frame_id, uint32 reference_frame_id) { + void SetFrameIds(uint32_t frame_id, uint32_t reference_frame_id) { rtp_header_.frame_id = frame_id; rtp_header_.reference_frame_id = reference_frame_id; } - void SetPacketId(uint16 packet_id) { rtp_header_.packet_id = packet_id; } + void SetPacketId(uint16_t packet_id) { rtp_header_.packet_id = packet_id; } - void SetMaxPacketId(uint16 max_packet_id) { + void SetMaxPacketId(uint16_t max_packet_id) { rtp_header_.max_packet_id = max_packet_id; } @@ -117,7 +117,7 @@ class CastMessageBuilderTest : public ::testing::Test { void InsertPacket() { bool duplicate; - uint8 payload = 0; + uint8_t payload = 0; if (framer_.InsertPacket(&payload, 1, rtp_header_, &duplicate)) { cast_msg_builder_->CompleteFrameReceived(rtp_header_.frame_id); } @@ -391,7 +391,7 @@ TEST_F(CastMessageBuilderTest, SlowDownAck) { SetKeyFrame(true); InsertPacket(); - uint32 frame_id; + uint32_t frame_id; testing_clock_.Advance( base::TimeDelta::FromMilliseconds(kShortTimeIncrementMs)); SetKeyFrame(false); @@ -404,7 +404,7 @@ TEST_F(CastMessageBuilderTest, SlowDownAck) { base::TimeDelta::FromMilliseconds(kShortTimeIncrementMs)); } // We should now have entered the slowdown ACK state. - uint32 expected_frame_id = 1; + uint32_t expected_frame_id = 1; for (; frame_id < 10; ++frame_id) { if (frame_id % 2) { ++expected_frame_id; diff --git a/media/cast/net/rtp/frame_buffer.cc b/media/cast/net/rtp/frame_buffer.cc index 319aad2..facccaa 100644 --- a/media/cast/net/rtp/frame_buffer.cc +++ b/media/cast/net/rtp/frame_buffer.cc @@ -22,7 +22,7 @@ FrameBuffer::FrameBuffer() FrameBuffer::~FrameBuffer() {} -bool FrameBuffer::InsertPacket(const uint8* payload_data, +bool FrameBuffer::InsertPacket(const uint8_t* payload_data, size_t payload_size, const RtpCastHeader& rtp_header) { // Is this the first packet in the frame? @@ -45,7 +45,7 @@ bool FrameBuffer::InsertPacket(const uint8* payload_data, return false; } - std::vector<uint8> data; + std::vector<uint8_t> data; std::pair<PacketMap::iterator, bool> retval = packets_.insert(make_pair(rtp_header.packet_id, data)); diff --git a/media/cast/net/rtp/frame_buffer.h b/media/cast/net/rtp/frame_buffer.h index dedd82e..a558ae8 100644 --- a/media/cast/net/rtp/frame_buffer.h +++ b/media/cast/net/rtp/frame_buffer.h @@ -14,13 +14,13 @@ namespace media { namespace cast { -typedef std::map<uint16, std::vector<uint8> > PacketMap; +typedef std::map<uint16_t, std::vector<uint8_t>> PacketMap; class FrameBuffer { public: FrameBuffer(); ~FrameBuffer(); - bool InsertPacket(const uint8* payload_data, + bool InsertPacket(const uint8_t* payload_data, size_t payload_size, const RtpCastHeader& rtp_header); bool Complete() const; @@ -34,19 +34,21 @@ class FrameBuffer { bool AssembleEncodedFrame(EncodedFrame* frame) const; bool is_key_frame() const { return is_key_frame_; } - uint32 last_referenced_frame_id() const { return last_referenced_frame_id_; } - uint32 frame_id() const { return frame_id_; } + uint32_t last_referenced_frame_id() const { + return last_referenced_frame_id_; + } + uint32_t frame_id() const { return frame_id_; } private: - uint32 frame_id_; - uint16 max_packet_id_; - uint16 num_packets_received_; - uint16 max_seen_packet_id_; - uint16 new_playout_delay_ms_; + uint32_t frame_id_; + uint16_t max_packet_id_; + uint16_t num_packets_received_; + uint16_t max_seen_packet_id_; + uint16_t new_playout_delay_ms_; bool is_key_frame_; size_t total_data_size_; - uint32 last_referenced_frame_id_; - uint32 rtp_timestamp_; + uint32_t last_referenced_frame_id_; + uint32_t rtp_timestamp_; PacketMap packets_; DISALLOW_COPY_AND_ASSIGN(FrameBuffer); diff --git a/media/cast/net/rtp/frame_buffer_unittest.cc b/media/cast/net/rtp/frame_buffer_unittest.cc index f13771a..c910918 100644 --- a/media/cast/net/rtp/frame_buffer_unittest.cc +++ b/media/cast/net/rtp/frame_buffer_unittest.cc @@ -18,7 +18,7 @@ class FrameBufferTest : public ::testing::Test { ~FrameBufferTest() override {} FrameBuffer buffer_; - std::vector<uint8> payload_; + std::vector<uint8_t> payload_; RtpCastHeader rtp_header_; DISALLOW_COPY_AND_ASSIGN(FrameBufferTest); diff --git a/media/cast/net/rtp/framer.cc b/media/cast/net/rtp/framer.cc index a79ce79..2c98ee1 100644 --- a/media/cast/net/rtp/framer.cc +++ b/media/cast/net/rtp/framer.cc @@ -15,7 +15,7 @@ typedef FrameList::const_iterator ConstFrameIterator; Framer::Framer(base::TickClock* clock, RtpPayloadFeedback* incoming_payload_feedback, - uint32 ssrc, + uint32_t ssrc, bool decoder_faster_than_max_frame_rate, int max_unacked_frames) : decoder_faster_than_max_frame_rate_(decoder_faster_than_max_frame_rate), @@ -34,15 +34,15 @@ Framer::Framer(base::TickClock* clock, Framer::~Framer() {} -bool Framer::InsertPacket(const uint8* payload_data, +bool Framer::InsertPacket(const uint8_t* payload_data, size_t payload_size, const RtpCastHeader& rtp_header, bool* duplicate) { *duplicate = false; - uint32 frame_id = rtp_header.frame_id; + uint32_t frame_id = rtp_header.frame_id; if (rtp_header.is_key_frame && waiting_for_key_) { - last_released_frame_ = static_cast<uint32>(frame_id - 1); + last_released_frame_ = static_cast<uint32_t>(frame_id - 1); waiting_for_key_ = false; } @@ -88,7 +88,7 @@ bool Framer::GetEncodedFrame(EncodedFrame* frame, bool* have_multiple_decodable_frames) { *have_multiple_decodable_frames = HaveMultipleDecodableFrames(); - uint32 frame_id; + uint32_t frame_id; // Find frame id. if (NextContinuousFrame(&frame_id)) { // We have our next frame. @@ -112,7 +112,7 @@ bool Framer::GetEncodedFrame(EncodedFrame* frame, return it->second->AssembleEncodedFrame(frame); } -void Framer::AckFrame(uint32 frame_id) { +void Framer::AckFrame(uint32_t frame_id) { VLOG(2) << "ACK frame " << frame_id; cast_msg_builder_->CompleteFrameReceived(frame_id); } @@ -125,7 +125,7 @@ void Framer::Reset() { cast_msg_builder_->Reset(); } -void Framer::ReleaseFrame(uint32 frame_id) { +void Framer::ReleaseFrame(uint32_t frame_id) { RemoveOldFrames(frame_id); frames_.erase(frame_id); @@ -151,7 +151,7 @@ bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { void Framer::SendCastMessage() { cast_msg_builder_->UpdateCastMessage(); } -void Framer::RemoveOldFrames(uint32 frame_id) { +void Framer::RemoveOldFrames(uint32_t frame_id) { FrameList::iterator it = frames_.begin(); while (it != frames_.end()) { @@ -165,9 +165,11 @@ void Framer::RemoveOldFrames(uint32 frame_id) { last_released_frame_ = frame_id; } -uint32 Framer::NewestFrameId() const { return newest_frame_id_; } +uint32_t Framer::NewestFrameId() const { + return newest_frame_id_; +} -bool Framer::NextContinuousFrame(uint32* frame_id) const { +bool Framer::NextContinuousFrame(uint32_t* frame_id) const { FrameList::const_iterator it; for (it = frames_.begin(); it != frames_.end(); ++it) { @@ -195,9 +197,9 @@ bool Framer::HaveMultipleDecodableFrames() const { return false; } -uint32 Framer::LastContinuousFrame() const { - uint32 last_continuous_frame_id = last_released_frame_; - uint32 next_expected_frame = last_released_frame_; +uint32_t Framer::LastContinuousFrame() const { + uint32_t last_continuous_frame_id = last_released_frame_; + uint32_t next_expected_frame = last_released_frame_; FrameList::const_iterator it; @@ -215,7 +217,7 @@ uint32 Framer::LastContinuousFrame() const { return last_continuous_frame_id; } -bool Framer::NextFrameAllowingSkippingFrames(uint32* frame_id) const { +bool Framer::NextFrameAllowingSkippingFrames(uint32_t* frame_id) const { // Find the oldest decodable frame. FrameList::const_iterator it_best_match = frames_.end(); FrameList::const_iterator it; @@ -247,13 +249,13 @@ int Framer::NumberOfCompleteFrames() const { return count; } -bool Framer::FrameExists(uint32 frame_id) const { +bool Framer::FrameExists(uint32_t frame_id) const { return frames_.end() != frames_.find(frame_id); } -void Framer::GetMissingPackets(uint32 frame_id, - bool last_frame, - PacketIdSet* missing_packets) const { +void Framer::GetMissingPackets(uint32_t frame_id, + bool last_frame, + PacketIdSet* missing_packets) const { FrameList::const_iterator it = frames_.find(frame_id); if (it == frames_.end()) return; @@ -265,7 +267,7 @@ bool Framer::ContinuousFrame(FrameBuffer* frame) const { DCHECK(frame); if (waiting_for_key_ && !frame->is_key_frame()) return false; - return static_cast<uint32>(last_released_frame_ + 1) == frame->frame_id(); + return static_cast<uint32_t>(last_released_frame_ + 1) == frame->frame_id(); } bool Framer::DecodableFrame(FrameBuffer* frame) const { diff --git a/media/cast/net/rtp/framer.h b/media/cast/net/rtp/framer.h index e39bafe..b215f7a 100644 --- a/media/cast/net/rtp/framer.h +++ b/media/cast/net/rtp/framer.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/time/tick_clock.h" @@ -20,13 +19,13 @@ namespace media { namespace cast { -typedef std::map<uint32, linked_ptr<FrameBuffer> > FrameList; +typedef std::map<uint32_t, linked_ptr<FrameBuffer>> FrameList; class Framer { public: Framer(base::TickClock* clock, RtpPayloadFeedback* incoming_payload_feedback, - uint32 ssrc, + uint32_t ssrc, bool decoder_faster_than_max_frame_rate, int max_unacked_frames); ~Framer(); @@ -34,7 +33,7 @@ class Framer { // Return true when receiving the last packet in a frame, creating a // complete frame. If a duplicate packet for an already complete frame is // received, the function returns false but sets |duplicate| to true. - bool InsertPacket(const uint8* payload_data, + bool InsertPacket(const uint8_t* payload_data, size_t payload_size, const RtpCastHeader& rtp_header, bool* duplicate); @@ -49,9 +48,9 @@ class Framer { bool* have_multiple_complete_frames); // TODO(hubbe): Move this elsewhere. - void AckFrame(uint32 frame_id); + void AckFrame(uint32_t frame_id); - void ReleaseFrame(uint32 frame_id); + void ReleaseFrame(uint32_t frame_id); // Reset framer state to original state and flush all pending buffers. void Reset(); @@ -59,20 +58,20 @@ class Framer { void SendCastMessage(); bool Empty() const; - bool FrameExists(uint32 frame_id) const; - uint32 NewestFrameId() const; + bool FrameExists(uint32_t frame_id) const; + uint32_t NewestFrameId() const; - void RemoveOldFrames(uint32 frame_id); + void RemoveOldFrames(uint32_t frame_id); // Identifies the next frame to be released (rendered). - bool NextContinuousFrame(uint32* frame_id) const; - uint32 LastContinuousFrame() const; + bool NextContinuousFrame(uint32_t* frame_id) const; + uint32_t LastContinuousFrame() const; - bool NextFrameAllowingSkippingFrames(uint32* frame_id) const; + bool NextFrameAllowingSkippingFrames(uint32_t* frame_id) const; bool HaveMultipleDecodableFrames() const; int NumberOfCompleteFrames() const; - void GetMissingPackets(uint32 frame_id, + void GetMissingPackets(uint32_t frame_id, bool last_frame, PacketIdSet* missing_packets) const; @@ -84,8 +83,8 @@ class Framer { FrameList frames_; scoped_ptr<CastMessageBuilder> cast_msg_builder_; bool waiting_for_key_; - uint32 last_released_frame_; - uint32 newest_frame_id_; + uint32_t last_released_frame_; + uint32_t newest_frame_id_; DISALLOW_COPY_AND_ASSIGN(Framer); }; diff --git a/media/cast/net/rtp/framer_unittest.cc b/media/cast/net/rtp/framer_unittest.cc index c06b1d9..feed3ab 100644 --- a/media/cast/net/rtp/framer_unittest.cc +++ b/media/cast/net/rtp/framer_unittest.cc @@ -24,7 +24,7 @@ class FramerTest : public ::testing::Test { ~FramerTest() override {} - std::vector<uint8> payload_; + std::vector<uint8_t> payload_; RtpCastHeader rtp_header_; MockRtpPayloadFeedback mock_rtp_payload_feedback_; Framer framer_; diff --git a/media/cast/net/rtp/mock_rtp_feedback.h b/media/cast/net/rtp/mock_rtp_feedback.h index 9542081..b5a3a68 100644 --- a/media/cast/net/rtp/mock_rtp_feedback.h +++ b/media/cast/net/rtp/mock_rtp_feedback.h @@ -14,19 +14,20 @@ namespace cast { class MockRtpFeedback : public RtpFeedback { public: MOCK_METHOD4(OnInitializeDecoder, - int32(const int8 payloadType, - const int frequency, - const uint8 channels, - const uint32 rate)); + int32_t(const int8_t payloadType, + const int frequency, + const uint8_t channels, + const uint32_t rate)); - MOCK_METHOD1(OnPacketTimeout, void(const int32 id)); + MOCK_METHOD1(OnPacketTimeout, void(const int32_t id)); MOCK_METHOD2(OnReceivedPacket, - void(const int32 id, const RtpRtcpPacketField packet_type)); + void(const int32_t id, const RtpRtcpPacketField packet_type)); MOCK_METHOD2(OnPeriodicDeadOrAlive, - void(const int32 id, const RTPAliveType alive)); - MOCK_METHOD2(OnIncomingSSRCChanged, void(const int32 id, const uint32 ssrc)); + void(const int32_t id, const RTPAliveType alive)); + MOCK_METHOD2(OnIncomingSSRCChanged, + void(const int32_t id, const uint32_t ssrc)); MOCK_METHOD3(OnIncomingCSRCChanged, - void(const int32 id, const uint32 csrc, const bool added)); + void(const int32_t id, const uint32_t csrc, const bool added)); }; } // namespace cast diff --git a/media/cast/net/rtp/packet_storage.cc b/media/cast/net/rtp/packet_storage.cc index bd242e6..9b124ac 100644 --- a/media/cast/net/rtp/packet_storage.cc +++ b/media/cast/net/rtp/packet_storage.cc @@ -22,7 +22,7 @@ size_t PacketStorage::GetNumberOfStoredFrames() const { return frames_.size() - zombie_count_; } -void PacketStorage::StoreFrame(uint32 frame_id, +void PacketStorage::StoreFrame(uint32_t frame_id, const SendPacketVector& packets) { if (packets.empty()) { NOTREACHED(); @@ -33,7 +33,7 @@ void PacketStorage::StoreFrame(uint32 frame_id, first_frame_id_in_list_ = frame_id; } else { // Make sure frame IDs are consecutive. - DCHECK_EQ(first_frame_id_in_list_ + static_cast<uint32>(frames_.size()), + DCHECK_EQ(first_frame_id_in_list_ + static_cast<uint32_t>(frames_.size()), frame_id); // Make sure we aren't being asked to store more frames than the system's // design limit. @@ -44,9 +44,9 @@ void PacketStorage::StoreFrame(uint32 frame_id, frames_.push_back(packets); } -void PacketStorage::ReleaseFrame(uint32 frame_id) { - const uint32 offset = frame_id - first_frame_id_in_list_; - if (static_cast<int32>(offset) < 0 || offset >= frames_.size() || +void PacketStorage::ReleaseFrame(uint32_t frame_id) { + const uint32_t offset = frame_id - first_frame_id_in_list_; + if (static_cast<int32_t>(offset) < 0 || offset >= frames_.size() || frames_[offset].empty()) { return; } @@ -62,10 +62,10 @@ void PacketStorage::ReleaseFrame(uint32 frame_id) { } } -const SendPacketVector* PacketStorage::GetFrame8(uint8 frame_id_8bits) const { +const SendPacketVector* PacketStorage::GetFrame8(uint8_t frame_id_8bits) const { // The requested frame ID has only 8-bits so convert the first frame ID // in list to match. - uint8 index_8bits = first_frame_id_in_list_ & 0xFF; + uint8_t index_8bits = first_frame_id_in_list_ & 0xFF; index_8bits = frame_id_8bits - index_8bits; if (index_8bits >= frames_.size()) return NULL; diff --git a/media/cast/net/rtp/packet_storage.h b/media/cast/net/rtp/packet_storage.h index e086f8b..370cf5d 100644 --- a/media/cast/net/rtp/packet_storage.h +++ b/media/cast/net/rtp/packet_storage.h @@ -7,7 +7,6 @@ #include <deque> -#include "base/basictypes.h" #include "media/cast/net/pacing/paced_sender.h" namespace media { @@ -19,22 +18,22 @@ class PacketStorage { virtual ~PacketStorage(); // Store all of the packets for a frame. - void StoreFrame(uint32 frame_id, const SendPacketVector& packets); + void StoreFrame(uint32_t frame_id, const SendPacketVector& packets); // Release all of the packets for a frame. - void ReleaseFrame(uint32 frame_id); + void ReleaseFrame(uint32_t frame_id); // Returns a list of packets for a frame indexed by a 8-bits ID. // It is the lowest 8 bits of a frame ID. // Returns NULL if the frame cannot be found. - const SendPacketVector* GetFrame8(uint8 frame_id_8bits) const; + const SendPacketVector* GetFrame8(uint8_t frame_id_8bits) const; // Get the number of stored frames. size_t GetNumberOfStoredFrames() const; private: std::deque<SendPacketVector> frames_; - uint32 first_frame_id_in_list_; + uint32_t first_frame_id_in_list_; // The number of frames whose packets have been released, but the entry in the // |frames_| queue has not yet been popped. diff --git a/media/cast/net/rtp/packet_storage_unittest.cc b/media/cast/net/rtp/packet_storage_unittest.cc index 699368f..29fc415 100644 --- a/media/cast/net/rtp/packet_storage_unittest.cc +++ b/media/cast/net/rtp/packet_storage_unittest.cc @@ -22,7 +22,7 @@ static const size_t kStoredFrames = 10; // Generate |number_of_frames| and store into |*storage|. // First frame has 1 packet, second frame has 2 packets, etc. static void StoreFrames(size_t number_of_frames, - uint32 first_frame_id, + uint32_t first_frame_id, PacketStorage* storage) { const int kSsrc = 1; for (size_t i = 0; i < number_of_frames; ++i) { @@ -33,7 +33,7 @@ static void StoreFrames(size_t number_of_frames, Packet test_packet(1, 0); packets.push_back(std::make_pair( PacedPacketSender::MakePacketKey(PacketKey::RTP, i, kSsrc, - base::checked_cast<uint16>(j)), + base::checked_cast<uint16_t>(j)), new base::RefCountedData<Packet>(test_packet))); } storage->StoreFrame(first_frame_id, packets); @@ -44,8 +44,8 @@ static void StoreFrames(size_t number_of_frames, TEST(PacketStorageTest, NumberOfStoredFrames) { PacketStorage storage; - uint32 frame_id = 0; - frame_id = ~frame_id; // The maximum value of uint32. + uint32_t frame_id = 0; + frame_id = ~frame_id; // The maximum value of uint32_t. StoreFrames(kMaxUnackedFrames / 2, frame_id, &storage); EXPECT_EQ(static_cast<size_t>(kMaxUnackedFrames / 2), storage.GetNumberOfStoredFrames()); @@ -54,14 +54,14 @@ TEST(PacketStorageTest, NumberOfStoredFrames) { TEST(PacketStorageTest, GetFrameWrapAround8bits) { PacketStorage storage; - const uint32 kFirstFrameId = 250; + const uint32_t kFirstFrameId = 250; StoreFrames(kStoredFrames, kFirstFrameId, &storage); EXPECT_EQ(std::min<size_t>(kMaxUnackedFrames, kStoredFrames), storage.GetNumberOfStoredFrames()); // Expect we get the correct frames by looking at the number of // packets. - uint32 frame_id = kFirstFrameId; + uint32_t frame_id = kFirstFrameId; for (size_t i = 0; i < kStoredFrames; ++i) { ASSERT_TRUE(storage.GetFrame8(frame_id)); EXPECT_EQ(i + 1, storage.GetFrame8(frame_id)->size()); @@ -72,15 +72,15 @@ TEST(PacketStorageTest, GetFrameWrapAround8bits) { TEST(PacketStorageTest, GetFrameWrapAround32bits) { PacketStorage storage; - // First frame ID is close to the maximum value of uint32. - uint32 first_frame_id = 0xffffffff - 5; + // First frame ID is close to the maximum value of uint32_t. + uint32_t first_frame_id = 0xffffffff - 5; StoreFrames(kStoredFrames, first_frame_id, &storage); EXPECT_EQ(std::min<size_t>(kMaxUnackedFrames, kStoredFrames), storage.GetNumberOfStoredFrames()); // Expect we get the correct frames by looking at the number of // packets. - uint32 frame_id = first_frame_id; + uint32_t frame_id = first_frame_id; for (size_t i = 0; i < kStoredFrames; ++i) { ASSERT_TRUE(storage.GetFrame8(frame_id)); EXPECT_EQ(i + 1, storage.GetFrame8(frame_id)->size()); @@ -91,12 +91,12 @@ TEST(PacketStorageTest, GetFrameWrapAround32bits) { TEST(PacketStorageTest, FramesReleased) { PacketStorage storage; - const uint32 kFirstFrameId = 0; + const uint32_t kFirstFrameId = 0; StoreFrames(5, kFirstFrameId, &storage); EXPECT_EQ(std::min<size_t>(kMaxUnackedFrames, 5), storage.GetNumberOfStoredFrames()); - for (uint32 frame_id = kFirstFrameId; frame_id < kFirstFrameId + 5; + for (uint32_t frame_id = kFirstFrameId; frame_id < kFirstFrameId + 5; ++frame_id) { EXPECT_TRUE(storage.GetFrame8(frame_id)); } diff --git a/media/cast/net/rtp/receiver_stats.cc b/media/cast/net/rtp/receiver_stats.cc index bceb8add..2238f6a 100644 --- a/media/cast/net/rtp/receiver_stats.cc +++ b/media/cast/net/rtp/receiver_stats.cc @@ -11,7 +11,7 @@ namespace media { namespace cast { -static const uint32 kMaxSequenceNumber = 65536; +static const uint32_t kMaxSequenceNumber = 65536; ReceiverStats::ReceiverStats(base::TickClock* clock) : clock_(clock), @@ -43,7 +43,7 @@ RtpReceiverStatistics ReceiverStats::GetStatistics() { } else { float tmp_ratio = (1 - static_cast<float>(interval_number_packets_) / abs(diff)); - ret.fraction_lost = static_cast<uint8>(256 * tmp_ratio); + ret.fraction_lost = static_cast<uint8_t>(256 * tmp_ratio); } } @@ -63,7 +63,8 @@ RtpReceiverStatistics ReceiverStats::GetStatistics() { ret.extended_high_sequence_number = (sequence_number_cycles_ << 16) + max_sequence_number_; - ret.jitter = static_cast<uint32>(std::abs(jitter_.InMillisecondsRoundedUp())); + ret.jitter = + static_cast<uint32_t>(std::abs(jitter_.InMillisecondsRoundedUp())); // Reset interval values. interval_min_sequence_number_ = 0; @@ -74,7 +75,7 @@ RtpReceiverStatistics ReceiverStats::GetStatistics() { } void ReceiverStats::UpdateStatistics(const RtpCastHeader& header) { - const uint16 new_seq_num = header.sequence_number; + const uint16_t new_seq_num = header.sequence_number; if (interval_number_packets_ == 0) { // First packet in the interval. diff --git a/media/cast/net/rtp/receiver_stats.h b/media/cast/net/rtp/receiver_stats.h index 5ffbb5f..127e04a 100644 --- a/media/cast/net/rtp/receiver_stats.h +++ b/media/cast/net/rtp/receiver_stats.h @@ -24,10 +24,10 @@ class ReceiverStats { base::TickClock* const clock_; // Not owned by this class. // Global metrics. - uint16 min_sequence_number_; - uint16 max_sequence_number_; - uint32 total_number_packets_; - uint16 sequence_number_cycles_; + uint16_t min_sequence_number_; + uint16_t max_sequence_number_; + uint32_t total_number_packets_; + uint16_t sequence_number_cycles_; base::TimeDelta last_received_timestamp_; base::TimeTicks last_received_packet_time_; base::TimeDelta jitter_; diff --git a/media/cast/net/rtp/receiver_stats_unittest.cc b/media/cast/net/rtp/receiver_stats_unittest.cc index 9784b90..a62d95c 100644 --- a/media/cast/net/rtp/receiver_stats_unittest.cc +++ b/media/cast/net/rtp/receiver_stats_unittest.cc @@ -14,8 +14,8 @@ namespace media { namespace cast { -static const int64 kStartMillisecond = INT64_C(12345678900000); -static const uint32 kStdTimeIncrementMs = 33; +static const int64_t kStartMillisecond = INT64_C(12345678900000); +static const uint32_t kStdTimeIncrementMs = 33; class ReceiverStatsTest : public ::testing::Test { protected: @@ -28,7 +28,7 @@ class ReceiverStatsTest : public ::testing::Test { } ~ReceiverStatsTest() override {} - uint32 ExpectedJitter(uint32 const_interval, int num_packets) { + uint32_t ExpectedJitter(uint32_t const_interval, int num_packets) { float jitter = 0; // Assume timestamps have a constant kStdTimeIncrementMs interval. float float_interval = @@ -36,7 +36,7 @@ class ReceiverStatsTest : public ::testing::Test { for (int i = 0; i < num_packets; ++i) { jitter += (float_interval - jitter) / 16; } - return static_cast<uint32>(jitter + 0.5f); + return static_cast<uint32_t>(jitter + 0.5f); } ReceiverStats stats_; @@ -71,7 +71,7 @@ TEST_F(ReceiverStatsTest, LossCount) { EXPECT_EQ(63u, s.fraction_lost); EXPECT_EQ(74u, s.cumulative_lost); // Build extended sequence number. - const uint32 extended_seq_num = rtp_header_.sequence_number - 1; + const uint32_t extended_seq_num = rtp_header_.sequence_number - 1; EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); } @@ -89,12 +89,12 @@ TEST_F(ReceiverStatsTest, NoLossWrap) { EXPECT_EQ(0u, s.fraction_lost); EXPECT_EQ(0u, s.cumulative_lost); // Build extended sequence number (one wrap cycle). - const uint32 extended_seq_num = (1 << 16) + rtp_header_.sequence_number - 1; + const uint32_t extended_seq_num = (1 << 16) + rtp_header_.sequence_number - 1; EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); } TEST_F(ReceiverStatsTest, LossCountWrap) { - const uint32 kStartSequenceNumber = 65500; + const uint32_t kStartSequenceNumber = 65500; rtp_header_.sequence_number = kStartSequenceNumber; for (int i = 0; i < 300; ++i) { if (i % 4) @@ -109,7 +109,7 @@ TEST_F(ReceiverStatsTest, LossCountWrap) { EXPECT_EQ(63u, s.fraction_lost); EXPECT_EQ(74u, s.cumulative_lost); // Build extended sequence number (one wrap cycle). - const uint32 extended_seq_num = (1 << 16) + rtp_header_.sequence_number - 1; + const uint32_t extended_seq_num = (1 << 16) + rtp_header_.sequence_number - 1; EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); } @@ -124,7 +124,7 @@ TEST_F(ReceiverStatsTest, BasicJitter) { EXPECT_FALSE(s.fraction_lost); EXPECT_FALSE(s.cumulative_lost); // Build extended sequence number (one wrap cycle). - const uint32 extended_seq_num = rtp_header_.sequence_number - 1; + const uint32_t extended_seq_num = rtp_header_.sequence_number - 1; EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs, 300), s.jitter); } @@ -143,7 +143,7 @@ TEST_F(ReceiverStatsTest, NonTrivialJitter) { EXPECT_FALSE(s.fraction_lost); EXPECT_FALSE(s.cumulative_lost); // Build extended sequence number (one wrap cycle). - const uint32 extended_seq_num = rtp_header_.sequence_number - 1; + const uint32_t extended_seq_num = rtp_header_.sequence_number - 1; EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs + kAdditionalIncrement, 300), s.jitter); diff --git a/media/cast/net/rtp/rtp_defines.h b/media/cast/net/rtp/rtp_defines.h index 2506190..719fdf4 100644 --- a/media/cast/net/rtp/rtp_defines.h +++ b/media/cast/net/rtp/rtp_defines.h @@ -5,47 +5,46 @@ #ifndef MEDIA_CAST_NET_RTP_RTP_DEFINES_H_ #define MEDIA_CAST_NET_RTP_RTP_DEFINES_H_ -#include "base/basictypes.h" #include "media/cast/net/rtcp/rtcp_defines.h" namespace media { namespace cast { -static const uint16 kRtpHeaderLength = 12; -static const uint16 kCastHeaderLength = 7; +static const uint16_t kRtpHeaderLength = 12; +static const uint16_t kCastHeaderLength = 7; // RTP Header -static const uint8 kRtpExtensionBitMask = 0x10; -static const uint8 kRtpMarkerBitMask = 0x80; -static const uint8 kRtpNumCsrcsMask = 0x0f; +static const uint8_t kRtpExtensionBitMask = 0x10; +static const uint8_t kRtpMarkerBitMask = 0x80; +static const uint8_t kRtpNumCsrcsMask = 0x0f; // Cast Header -static const uint8 kCastKeyFrameBitMask = 0x80; -static const uint8 kCastReferenceFrameIdBitMask = 0x40; -static const uint8 kCastExtensionCountmask = 0x3f; +static const uint8_t kCastKeyFrameBitMask = 0x80; +static const uint8_t kCastReferenceFrameIdBitMask = 0x40; +static const uint8_t kCastExtensionCountmask = 0x3f; // Cast RTP extensions. -static const uint8 kCastRtpExtensionAdaptiveLatency = 1; +static const uint8_t kCastRtpExtensionAdaptiveLatency = 1; struct RtpCastHeader { RtpCastHeader(); // Elements from RTP packet header. bool marker; - uint8 payload_type; - uint16 sequence_number; - uint32 rtp_timestamp; - uint32 sender_ssrc; - uint8 num_csrcs; + uint8_t payload_type; + uint16_t sequence_number; + uint32_t rtp_timestamp; + uint32_t sender_ssrc; + uint8_t num_csrcs; // Elements from Cast header (at beginning of RTP payload). bool is_key_frame; bool is_reference; - uint32 frame_id; - uint16 packet_id; - uint16 max_packet_id; - uint32 reference_frame_id; - uint16 new_playout_delay_ms; - uint8 num_extensions; + uint32_t frame_id; + uint16_t packet_id; + uint16_t max_packet_id; + uint32_t reference_frame_id; + uint16_t new_playout_delay_ms; + uint8_t num_extensions; }; class RtpPayloadFeedback { diff --git a/media/cast/net/rtp/rtp_packet_builder.cc b/media/cast/net/rtp/rtp_packet_builder.cc index 4501dbf..dbeeede 100644 --- a/media/cast/net/rtp/rtp_packet_builder.cc +++ b/media/cast/net/rtp/rtp_packet_builder.cc @@ -24,22 +24,25 @@ RtpPacketBuilder::RtpPacketBuilder() void RtpPacketBuilder::SetKeyFrame(bool is_key) { is_key_ = is_key; } -void RtpPacketBuilder::SetFrameIds(uint32 frame_id, uint32 reference_frame_id) { +void RtpPacketBuilder::SetFrameIds(uint32_t frame_id, + uint32_t reference_frame_id) { frame_id_ = frame_id; reference_frame_id_ = reference_frame_id; } -void RtpPacketBuilder::SetPacketId(uint16 packet_id) { packet_id_ = packet_id; } +void RtpPacketBuilder::SetPacketId(uint16_t packet_id) { + packet_id_ = packet_id; +} -void RtpPacketBuilder::SetMaxPacketId(uint16 max_packet_id) { +void RtpPacketBuilder::SetMaxPacketId(uint16_t max_packet_id) { max_packet_id_ = max_packet_id; } -void RtpPacketBuilder::SetTimestamp(uint32 timestamp) { +void RtpPacketBuilder::SetTimestamp(uint32_t timestamp) { timestamp_ = timestamp; } -void RtpPacketBuilder::SetSequenceNumber(uint16 sequence_number) { +void RtpPacketBuilder::SetSequenceNumber(uint16_t sequence_number) { sequence_number_ = sequence_number; } @@ -49,14 +52,16 @@ void RtpPacketBuilder::SetPayloadType(int payload_type) { payload_type_ = payload_type; } -void RtpPacketBuilder::SetSsrc(uint32 ssrc) { ssrc_ = ssrc; } +void RtpPacketBuilder::SetSsrc(uint32_t ssrc) { + ssrc_ = ssrc; +} -void RtpPacketBuilder::BuildHeader(uint8* data, uint32 data_length) { +void RtpPacketBuilder::BuildHeader(uint8_t* data, uint32_t data_length) { BuildCommonHeader(data, data_length); BuildCastHeader(data + kRtpHeaderLength, data_length - kRtpHeaderLength); } -void RtpPacketBuilder::BuildCastHeader(uint8* data, uint32 data_length) { +void RtpPacketBuilder::BuildCastHeader(uint8_t* data, uint32_t data_length) { // Build header. DCHECK_LE(kCastHeaderLength, data_length); // Set the first 7 bytes to 0. @@ -75,7 +80,7 @@ void RtpPacketBuilder::BuildCastHeader(uint8* data, uint32 data_length) { } } -void RtpPacketBuilder::BuildCommonHeader(uint8* data, uint32 data_length) { +void RtpPacketBuilder::BuildCommonHeader(uint8_t* data, uint32_t data_length) { DCHECK_LE(kRtpHeaderLength, data_length); base::BigEndianWriter big_endian_writer(reinterpret_cast<char*>(data), 96); big_endian_writer.WriteU8(0x80); diff --git a/media/cast/net/rtp/rtp_packet_builder.h b/media/cast/net/rtp/rtp_packet_builder.h index da8efc9..bfed1c3 100644 --- a/media/cast/net/rtp/rtp_packet_builder.h +++ b/media/cast/net/rtp/rtp_packet_builder.h @@ -18,30 +18,30 @@ class RtpPacketBuilder { public: RtpPacketBuilder(); void SetKeyFrame(bool is_key); - void SetFrameIds(uint32 frame_id, uint32 reference_frame_id); - void SetPacketId(uint16 packet_id); - void SetMaxPacketId(uint16 max_packet_id); - void SetTimestamp(uint32 timestamp); - void SetSequenceNumber(uint16 sequence_number); + void SetFrameIds(uint32_t frame_id, uint32_t reference_frame_id); + void SetPacketId(uint16_t packet_id); + void SetMaxPacketId(uint16_t max_packet_id); + void SetTimestamp(uint32_t timestamp); + void SetSequenceNumber(uint16_t sequence_number); void SetMarkerBit(bool marker); void SetPayloadType(int payload_type); - void SetSsrc(uint32 ssrc); - void BuildHeader(uint8* data, uint32 data_length); + void SetSsrc(uint32_t ssrc); + void BuildHeader(uint8_t* data, uint32_t data_length); private: bool is_key_; - uint32 frame_id_; - uint16 packet_id_; - uint16 max_packet_id_; - uint32 reference_frame_id_; - uint32 timestamp_; - uint16 sequence_number_; + uint32_t frame_id_; + uint16_t packet_id_; + uint16_t max_packet_id_; + uint32_t reference_frame_id_; + uint32_t timestamp_; + uint16_t sequence_number_; bool marker_; int payload_type_; - uint32 ssrc_; + uint32_t ssrc_; - void BuildCastHeader(uint8* data, uint32 data_length); - void BuildCommonHeader(uint8* data, uint32 data_length); + void BuildCastHeader(uint8_t* data, uint32_t data_length); + void BuildCommonHeader(uint8_t* data, uint32_t data_length); DISALLOW_COPY_AND_ASSIGN(RtpPacketBuilder); }; diff --git a/media/cast/net/rtp/rtp_packetizer.cc b/media/cast/net/rtp/rtp_packetizer.cc index 6eb3230..81bc6dd 100644 --- a/media/cast/net/rtp/rtp_packetizer.cc +++ b/media/cast/net/rtp/rtp_packetizer.cc @@ -38,14 +38,14 @@ RtpPacketizer::RtpPacketizer(PacedSender* const transport, RtpPacketizer::~RtpPacketizer() {} -uint16 RtpPacketizer::NextSequenceNumber() { +uint16_t RtpPacketizer::NextSequenceNumber() { ++sequence_number_; return sequence_number_ - 1; } void RtpPacketizer::SendFrameAsPackets(const EncodedFrame& frame) { - uint16 rtp_header_length = kRtpHeaderLength + kCastHeaderLength; - uint16 max_length = config_.max_payload_length - rtp_header_length - 1; + uint16_t rtp_header_length = kRtpHeaderLength + kCastHeaderLength; + uint16_t max_length = config_.max_payload_length - rtp_header_length - 1; rtp_timestamp_ = frame.rtp_timestamp; // Split the payload evenly (round number up). @@ -58,7 +58,7 @@ void RtpPacketizer::SendFrameAsPackets(const EncodedFrame& frame) { size_t remaining_size = frame.data.size(); std::string::const_iterator data_iter = frame.data.begin(); - uint8 num_extensions = 0; + uint8_t num_extensions = 0; if (frame.new_playout_delay_ms) num_extensions++; DCHECK_LE(num_extensions, kCastExtensionCountmask); @@ -76,29 +76,28 @@ void RtpPacketizer::SendFrameAsPackets(const EncodedFrame& frame) { // Build Cast header. // TODO(miu): Should we always set the ref frame bit and the ref_frame_id? DCHECK_NE(frame.dependency, EncodedFrame::UNKNOWN_DEPENDENCY); - uint8 byte0 = kCastReferenceFrameIdBitMask; + uint8_t byte0 = kCastReferenceFrameIdBitMask; if (frame.dependency == EncodedFrame::KEY) byte0 |= kCastKeyFrameBitMask; // Extensions only go on the first packet of the frame if (packet_id_ == 0) byte0 |= num_extensions; packet->data.push_back(byte0); - packet->data.push_back(static_cast<uint8>(frame.frame_id)); + packet->data.push_back(static_cast<uint8_t>(frame.frame_id)); size_t start_size = packet->data.size(); packet->data.resize(start_size + 4); base::BigEndianWriter big_endian_writer( reinterpret_cast<char*>(&(packet->data[start_size])), 4); big_endian_writer.WriteU16(packet_id_); - big_endian_writer.WriteU16(static_cast<uint16>(num_packets - 1)); - packet->data.push_back(static_cast<uint8>(frame.referenced_frame_id)); + big_endian_writer.WriteU16(static_cast<uint16_t>(num_packets - 1)); + packet->data.push_back(static_cast<uint8_t>(frame.referenced_frame_id)); // Add extension details only on the first packet of the frame if (packet_id_ == 0 && frame.new_playout_delay_ms) { packet->data.push_back(kCastRtpExtensionAdaptiveLatency << 2); packet->data.push_back(2); // 2 bytes packet->data.push_back( - static_cast<uint8>(frame.new_playout_delay_ms >> 8)); - packet->data.push_back( - static_cast<uint8>(frame.new_playout_delay_ms)); + static_cast<uint8_t>(frame.new_playout_delay_ms >> 8)); + packet->data.push_back(static_cast<uint8_t>(frame.new_playout_delay_ms)); } // Copy payload data. @@ -128,9 +127,9 @@ void RtpPacketizer::SendFrameAsPackets(const EncodedFrame& frame) { void RtpPacketizer::BuildCommonRTPheader(Packet* packet, bool marker_bit, - uint32 time_stamp) { + uint32_t time_stamp) { packet->push_back(0x80); - packet->push_back(static_cast<uint8>(config_.payload_type) | + packet->push_back(static_cast<uint8_t>(config_.payload_type) | (marker_bit ? kRtpMarkerBitMask : 0)); size_t start_size = packet->size(); packet->resize(start_size + 10); diff --git a/media/cast/net/rtp/rtp_packetizer.h b/media/cast/net/rtp/rtp_packetizer.h index 034a74a..e69a80c 100644 --- a/media/cast/net/rtp/rtp_packetizer.h +++ b/media/cast/net/rtp/rtp_packetizer.h @@ -27,8 +27,8 @@ struct RtpPacketizerConfig { // General. int payload_type; - uint16 max_payload_length; - uint16 sequence_number; + uint16_t max_payload_length; + uint16_t sequence_number; // SSRC. unsigned int ssrc; @@ -48,21 +48,23 @@ class RtpPacketizer { // Return the next sequence number, and increment by one. Enables unique // incremental sequence numbers for every packet (including retransmissions). - uint16 NextSequenceNumber(); + uint16_t NextSequenceNumber(); size_t send_packet_count() const { return send_packet_count_; } size_t send_octet_count() const { return send_octet_count_; } private: - void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); + void BuildCommonRTPheader(Packet* packet, + bool marker_bit, + uint32_t time_stamp); RtpPacketizerConfig config_; PacedSender* const transport_; // Not owned by this class. PacketStorage* packet_storage_; - uint16 sequence_number_; - uint32 rtp_timestamp_; - uint16 packet_id_; + uint16_t sequence_number_; + uint32_t rtp_timestamp_; + uint16_t packet_id_; size_t send_packet_count_; size_t send_octet_count_; diff --git a/media/cast/net/rtp/rtp_packetizer_unittest.cc b/media/cast/net/rtp/rtp_packetizer_unittest.cc index 07eb419..29afb09 100644 --- a/media/cast/net/rtp/rtp_packetizer_unittest.cc +++ b/media/cast/net/rtp/rtp_packetizer_unittest.cc @@ -19,8 +19,8 @@ namespace cast { namespace { static const int kPayload = 127; -static const uint32 kTimestampMs = 10; -static const uint16 kSeqNum = 33; +static const uint32_t kTimestampMs = 10; +static const uint16_t kSeqNum = 33; static const int kMaxPacketLength = 1500; static const int kSsrc = 0x12345; static const unsigned int kFrameSize = 5000; @@ -67,7 +67,7 @@ class TestRtpPacketTransport : public PacketSender { ++packets_sent_; RtpParser parser(kSsrc, kPayload); RtpCastHeader rtp_header; - const uint8* payload_data; + const uint8_t* payload_data; size_t payload_size; parser.ParsePacket(&packet->data[0], packet->data.size(), &rtp_header, &payload_data, &payload_size); @@ -77,7 +77,7 @@ class TestRtpPacketTransport : public PacketSender { return true; } - int64 GetBytesSent() final { return 0; } + int64_t GetBytesSent() final { return 0; } size_t number_of_packets_received() const { return packets_sent_; } @@ -85,19 +85,19 @@ class TestRtpPacketTransport : public PacketSender { expected_number_of_packets_ = expected_number_of_packets; } - void set_rtp_timestamp(uint32 rtp_timestamp) { + void set_rtp_timestamp(uint32_t rtp_timestamp) { expected_rtp_timestamp_ = rtp_timestamp; } RtpPacketizerConfig config_; - uint32 sequence_number_; + uint32_t sequence_number_; size_t packets_sent_; size_t number_of_packets_; size_t expected_number_of_packets_; // Assuming packets arrive in sequence. int expected_packet_id_; - uint32 expected_frame_id_; - uint32 expected_rtp_timestamp_; + uint32_t expected_frame_id_; + uint32_t expected_rtp_timestamp_; private: DISALLOW_COPY_AND_ASSIGN(TestRtpPacketTransport); diff --git a/media/cast/net/rtp/rtp_parser.cc b/media/cast/net/rtp/rtp_parser.cc index a59aa99..9dc0243 100644 --- a/media/cast/net/rtp/rtp_parser.cc +++ b/media/cast/net/rtp/rtp_parser.cc @@ -13,25 +13,26 @@ namespace media { namespace cast { // static -bool RtpParser::ParseSsrc(const uint8* packet, +bool RtpParser::ParseSsrc(const uint8_t* packet, size_t length, - uint32* ssrc) { + uint32_t* ssrc) { base::BigEndianReader big_endian_reader( reinterpret_cast<const char*>(packet), length); return big_endian_reader.Skip(8) && big_endian_reader.ReadU32(ssrc); } -RtpParser::RtpParser(uint32 expected_sender_ssrc, uint8 expected_payload_type) +RtpParser::RtpParser(uint32_t expected_sender_ssrc, + uint8_t expected_payload_type) : expected_sender_ssrc_(expected_sender_ssrc), expected_payload_type_(expected_payload_type), frame_id_wrap_helper_(kFirstFrameId - 1) {} RtpParser::~RtpParser() {} -bool RtpParser::ParsePacket(const uint8* packet, +bool RtpParser::ParsePacket(const uint8_t* packet, size_t length, RtpCastHeader* header, - const uint8** payload_data, + const uint8_t** payload_data, size_t* payload_size) { DCHECK(packet); DCHECK(header); @@ -46,10 +47,10 @@ bool RtpParser::ParsePacket(const uint8* packet, // Parse the RTP header. See // http://en.wikipedia.org/wiki/Real-time_Transport_Protocol for an // explanation of the standard RTP packet header. - uint8 bits; + uint8_t bits; if (!reader.ReadU8(&bits)) return false; - const uint8 version = bits >> 6; + const uint8_t version = bits >> 6; if (version != 2) return false; header->num_csrcs = bits & kRtpNumCsrcsMask; @@ -76,7 +77,7 @@ bool RtpParser::ParsePacket(const uint8* packet, return false; header->is_key_frame = !!(bits & kCastKeyFrameBitMask); header->is_reference = !!(bits & kCastReferenceFrameIdBitMask); - uint8 truncated_frame_id; + uint8_t truncated_frame_id; if (!reader.ReadU8(&truncated_frame_id) || !reader.ReadU16(&header->packet_id) || !reader.ReadU16(&header->max_packet_id)) { @@ -85,7 +86,7 @@ bool RtpParser::ParsePacket(const uint8* packet, // Sanity-check: Do the packet ID values make sense w.r.t. each other? if (header->max_packet_id < header->packet_id) return false; - uint8 truncated_reference_frame_id; + uint8_t truncated_reference_frame_id; if (!header->is_reference) { // By default, a key frame only references itself; and non-key frames // reference their direct predecessor. @@ -98,7 +99,7 @@ bool RtpParser::ParsePacket(const uint8* packet, header->num_extensions = bits & kCastExtensionCountmask; for (int i = 0; i < header->num_extensions; i++) { - uint16 type_and_size; + uint16_t type_and_size; if (!reader.ReadU16(&type_and_size)) return false; base::StringPiece tmp; @@ -128,7 +129,7 @@ bool RtpParser::ParsePacket(const uint8* packet, header->reference_frame_id |= truncated_reference_frame_id; // All remaining data in the packet is the payload. - *payload_data = reinterpret_cast<const uint8*>(reader.ptr()); + *payload_data = reinterpret_cast<const uint8_t*>(reader.ptr()); *payload_size = reader.remaining(); return true; diff --git a/media/cast/net/rtp/rtp_parser.h b/media/cast/net/rtp/rtp_parser.h index d9e6ab9..e3f39012 100644 --- a/media/cast/net/rtp/rtp_parser.h +++ b/media/cast/net/rtp/rtp_parser.h @@ -16,7 +16,7 @@ namespace cast { // throughout the media/cast library. class RtpParser { public: - RtpParser(uint32 expected_sender_ssrc, uint8 expected_payload_type); + RtpParser(uint32_t expected_sender_ssrc, uint8_t expected_payload_type); virtual ~RtpParser(); @@ -27,17 +27,17 @@ class RtpParser { // payload data. Returns false if the data appears to be invalid, is not from // the expected sender (as identified by the SSRC field), or is not the // expected payload type. - bool ParsePacket(const uint8* packet, + bool ParsePacket(const uint8_t* packet, size_t length, RtpCastHeader* rtp_header, - const uint8** payload_data, + const uint8_t** payload_data, size_t* payload_size); - static bool ParseSsrc(const uint8* packet, size_t length, uint32* ssrc); + static bool ParseSsrc(const uint8_t* packet, size_t length, uint32_t* ssrc); private: - const uint32 expected_sender_ssrc_; - const uint8 expected_payload_type_; + const uint32_t expected_sender_ssrc_; + const uint8_t expected_payload_type_; FrameIdWrapHelper frame_id_wrap_helper_; DISALLOW_COPY_AND_ASSIGN(RtpParser); diff --git a/media/cast/net/rtp/rtp_parser_unittest.cc b/media/cast/net/rtp/rtp_parser_unittest.cc index 97d0922..4109edf 100644 --- a/media/cast/net/rtp/rtp_parser_unittest.cc +++ b/media/cast/net/rtp/rtp_parser_unittest.cc @@ -14,10 +14,10 @@ namespace cast { static const size_t kPacketLength = 1500; static const int kTestPayloadType = 127; -static const uint32 kTestSsrc = 1234; -static const uint32 kTestTimestamp = 111111; -static const uint16 kTestSeqNum = 4321; -static const uint8 kRefFrameId = 17; +static const uint32_t kTestSsrc = 1234; +static const uint32_t kTestTimestamp = 111111; +static const uint16_t kTestSeqNum = 4321; +static const uint8_t kRefFrameId = 17; class RtpParserTest : public ::testing::Test { protected: @@ -38,7 +38,7 @@ class RtpParserTest : public ::testing::Test { void ExpectParsesPacket() { RtpCastHeader parsed_header; - const uint8* payload = NULL; + const uint8_t* payload = NULL; size_t payload_size = static_cast<size_t>(-1); EXPECT_TRUE(rtp_parser_.ParsePacket( packet_, kPacketLength, &parsed_header, &payload, &payload_size)); @@ -62,14 +62,14 @@ class RtpParserTest : public ::testing::Test { void ExpectDoesNotParsePacket() { RtpCastHeader parsed_header; - const uint8* payload = NULL; + const uint8_t* payload = NULL; size_t payload_size = static_cast<size_t>(-1); EXPECT_FALSE(rtp_parser_.ParsePacket( packet_, kPacketLength, &parsed_header, &payload, &payload_size)); } RtpPacketBuilder packet_builder_; - uint8 packet_[kPacketLength]; + uint8_t packet_[kPacketLength]; RtpParser rtp_parser_; RtpCastHeader cast_header_; }; @@ -164,10 +164,10 @@ TEST_F(RtpParserTest, ParseCastPacketWithSpecificFrameReference) { } TEST_F(RtpParserTest, ParseExpandingFrameIdTo32Bits) { - const uint32 kMaxFrameId = 1000; + const uint32_t kMaxFrameId = 1000; packet_builder_.SetKeyFrame(true); cast_header_.is_key_frame = true; - for (uint32 frame_id = 0; frame_id <= kMaxFrameId; ++frame_id) { + for (uint32_t frame_id = 0; frame_id <= kMaxFrameId; ++frame_id) { packet_builder_.SetFrameIds(frame_id, frame_id); packet_builder_.BuildHeader(packet_, kPacketLength); cast_header_.frame_id = frame_id; @@ -177,13 +177,13 @@ TEST_F(RtpParserTest, ParseExpandingFrameIdTo32Bits) { } TEST_F(RtpParserTest, ParseExpandingReferenceFrameIdTo32Bits) { - const uint32 kMaxFrameId = 1000; - const uint32 kMaxBackReferenceOffset = 10; + const uint32_t kMaxFrameId = 1000; + const uint32_t kMaxBackReferenceOffset = 10; packet_builder_.SetKeyFrame(false); cast_header_.is_key_frame = false; - for (uint32 frame_id = kMaxBackReferenceOffset; - frame_id <= kMaxFrameId; ++frame_id) { - const uint32 reference_frame_id = + for (uint32_t frame_id = kMaxBackReferenceOffset; frame_id <= kMaxFrameId; + ++frame_id) { + const uint32_t reference_frame_id = frame_id - base::RandInt(1, kMaxBackReferenceOffset); packet_builder_.SetFrameIds(frame_id, reference_frame_id); packet_builder_.BuildHeader(packet_, kPacketLength); diff --git a/media/cast/net/rtp/rtp_sender.cc b/media/cast/net/rtp/rtp_sender.cc index bd822e8..22ee314 100644 --- a/media/cast/net/rtp/rtp_sender.cc +++ b/media/cast/net/rtp/rtp_sender.cc @@ -60,7 +60,7 @@ void RtpSender::ResendPackets( it != missing_frames_and_packets.end(); ++it) { SendPacketVector packets_to_resend; - uint8 frame_id = it->first; + uint8_t frame_id = it->first; // Set of packets that the receiver wants us to re-send. // If empty, we need to re-send all packets for this frame. const PacketIdSet& missing_packet_set = it->second; @@ -77,7 +77,7 @@ void RtpSender::ResendPackets( for (SendPacketVector::const_iterator it = stored_packets->begin(); it != stored_packets->end(); ++it) { const PacketKey& packet_key = it->first; - const uint16 packet_id = packet_key.packet_id; + const uint16_t packet_id = packet_key.packet_id; // Should we resend the packet? bool resend = resend_all; @@ -110,8 +110,8 @@ void RtpSender::ResendPackets( } } -void RtpSender::CancelSendingFrames(const std::vector<uint32>& frame_ids) { - for (std::vector<uint32>::const_iterator i = frame_ids.begin(); +void RtpSender::CancelSendingFrames(const std::vector<uint32_t>& frame_ids) { + for (std::vector<uint32_t>::const_iterator i = frame_ids.begin(); i != frame_ids.end(); ++i) { const SendPacketVector* stored_packets = storage_.GetFrame8(*i & 0xFF); if (!stored_packets) @@ -124,7 +124,7 @@ void RtpSender::CancelSendingFrames(const std::vector<uint32>& frame_ids) { } } -void RtpSender::ResendFrameForKickstart(uint32 frame_id, +void RtpSender::ResendFrameForKickstart(uint32_t frame_id, base::TimeDelta dedupe_window) { // Send the last packet of the encoded frame to kick start // retransmission. This gives enough information to the receiver what @@ -147,11 +147,11 @@ void RtpSender::UpdateSequenceNumber(Packet* packet) { static const int kByteOffsetToSequenceNumber = 2; base::BigEndianWriter big_endian_writer( reinterpret_cast<char*>((&packet->front()) + kByteOffsetToSequenceNumber), - sizeof(uint16)); + sizeof(uint16_t)); big_endian_writer.WriteU16(packetizer_->NextSequenceNumber()); } -int64 RtpSender::GetLastByteSentForFrame(uint32 frame_id) { +int64_t RtpSender::GetLastByteSentForFrame(uint32_t frame_id) { const SendPacketVector* stored_packets = storage_.GetFrame8(frame_id & 0xFF); if (!stored_packets) return 0; diff --git a/media/cast/net/rtp/rtp_sender.h b/media/cast/net/rtp/rtp_sender.h index 32083d0..68cb601 100644 --- a/media/cast/net/rtp/rtp_sender.h +++ b/media/cast/net/rtp/rtp_sender.h @@ -49,11 +49,12 @@ class RtpSender { // frame was just sent. // Returns 0 if the frame cannot be found or the frame was only sent // partially. - int64 GetLastByteSentForFrame(uint32 frame_id); + int64_t GetLastByteSentForFrame(uint32_t frame_id); - void CancelSendingFrames(const std::vector<uint32>& frame_ids); + void CancelSendingFrames(const std::vector<uint32_t>& frame_ids); - void ResendFrameForKickstart(uint32 frame_id, base::TimeDelta dedupe_window); + void ResendFrameForKickstart(uint32_t frame_id, + base::TimeDelta dedupe_window); size_t send_packet_count() const { return packetizer_ ? packetizer_->send_packet_count() : 0; @@ -61,7 +62,7 @@ class RtpSender { size_t send_octet_count() const { return packetizer_ ? packetizer_->send_octet_count() : 0; } - uint32 ssrc() const { return config_.ssrc; } + uint32_t ssrc() const { return config_.ssrc; } private: void UpdateSequenceNumber(Packet* packet); diff --git a/media/cast/net/udp_transport.cc b/media/cast/net/udp_transport.cc index 0d77a69..89d2927 100644 --- a/media/cast/net/udp_transport.cc +++ b/media/cast/net/udp_transport.cc @@ -40,7 +40,7 @@ UdpTransport::UdpTransport( const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, const net::IPEndPoint& local_end_point, const net::IPEndPoint& remote_end_point, - int32 send_buffer_size, + int32_t send_buffer_size, const CastTransportStatusCallback& status_callback) : io_thread_proxy_(io_thread_proxy), local_addr_(local_end_point), @@ -257,7 +257,7 @@ bool UdpTransport::SendPacket(PacketRef packet, const base::Closure& cb) { return true; } -int64 UdpTransport::GetBytesSent() { +int64_t UdpTransport::GetBytesSent() { return bytes_sent_; } diff --git a/media/cast/net/udp_transport.h b/media/cast/net/udp_transport.h index c845c5a..a942236 100644 --- a/media/cast/net/udp_transport.h +++ b/media/cast/net/udp_transport.h @@ -40,7 +40,7 @@ class UdpTransport : public PacketSender { const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, const net::IPEndPoint& local_end_point, const net::IPEndPoint& remote_end_point, - int32 send_buffer_size, + int32_t send_buffer_size, const CastTransportStatusCallback& status_callback); ~UdpTransport() final; @@ -59,7 +59,7 @@ class UdpTransport : public PacketSender { // PacketSender implementations. bool SendPacket(PacketRef packet, const base::Closure& cb) final; - int64 GetBytesSent() final; + int64_t GetBytesSent() final; private: // Requests and processes packets from |udp_socket_|. This method is called @@ -88,7 +88,7 @@ class UdpTransport : public PacketSender { scoped_refptr<net::WrappedIOBuffer> recv_buf_; net::IPEndPoint recv_addr_; PacketReceiverCallbackWithStatus packet_receiver_; - int32 send_buffer_size_; + int32_t send_buffer_size_; const CastTransportStatusCallback status_callback_; int bytes_sent_; diff --git a/media/cast/receiver/audio_decoder.cc b/media/cast/receiver/audio_decoder.cc index 1956ace..2f04d5f 100644 --- a/media/cast/receiver/audio_decoder.cc +++ b/media/cast/receiver/audio_decoder.cc @@ -45,7 +45,7 @@ class AudioDecoder::ImplBase "size of frame_id types do not match"); bool is_continuous = true; if (seen_first_frame_) { - const uint32 frames_ahead = encoded_frame->frame_id - last_frame_id_; + const uint32_t frames_ahead = encoded_frame->frame_id - last_frame_id_; if (frames_ahead > 1) { RecoverBecauseFramesWereDropped(); is_continuous = false; @@ -81,7 +81,7 @@ class AudioDecoder::ImplBase virtual void RecoverBecauseFramesWereDropped() {} // Note: Implementation of Decode() is allowed to mutate |data|. - virtual scoped_ptr<AudioBus> Decode(uint8* data, int len) = 0; + virtual scoped_ptr<AudioBus> Decode(uint8_t* data, int len) = 0; const scoped_refptr<CastEnvironment> cast_environment_; const Codec codec_; @@ -92,7 +92,7 @@ class AudioDecoder::ImplBase private: bool seen_first_frame_; - uint32 last_frame_id_; + uint32_t last_frame_id_; DISALLOW_COPY_AND_ASSIGN(ImplBase); }; @@ -106,10 +106,10 @@ class AudioDecoder::OpusImpl : public AudioDecoder::ImplBase { CODEC_AUDIO_OPUS, num_channels, sampling_rate), - decoder_memory_(new uint8[opus_decoder_get_size(num_channels)]), + decoder_memory_(new uint8_t[opus_decoder_get_size(num_channels)]), opus_decoder_(reinterpret_cast<OpusDecoder*>(decoder_memory_.get())), - max_samples_per_frame_( - kOpusMaxFrameDurationMillis * sampling_rate / 1000), + max_samples_per_frame_(kOpusMaxFrameDurationMillis * sampling_rate / + 1000), buffer_(new float[max_samples_per_frame_ * num_channels]) { if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return; @@ -132,7 +132,7 @@ class AudioDecoder::OpusImpl : public AudioDecoder::ImplBase { DCHECK_GE(result, 0); } - scoped_ptr<AudioBus> Decode(uint8* data, int len) final { + scoped_ptr<AudioBus> Decode(uint8_t* data, int len) final { scoped_ptr<AudioBus> audio_bus; const opus_int32 num_samples_decoded = opus_decode_float( opus_decoder_, data, len, buffer_.get(), max_samples_per_frame_, 0); @@ -153,7 +153,7 @@ class AudioDecoder::OpusImpl : public AudioDecoder::ImplBase { return audio_bus.Pass(); } - const scoped_ptr<uint8[]> decoder_memory_; + const scoped_ptr<uint8_t[]> decoder_memory_; OpusDecoder* const opus_decoder_; const int max_samples_per_frame_; const scoped_ptr<float[]> buffer_; @@ -183,21 +183,21 @@ class AudioDecoder::Pcm16Impl : public AudioDecoder::ImplBase { private: ~Pcm16Impl() final {} - scoped_ptr<AudioBus> Decode(uint8* data, int len) final { + scoped_ptr<AudioBus> Decode(uint8_t* data, int len) final { scoped_ptr<AudioBus> audio_bus; - const int num_samples = len / sizeof(int16) / num_channels_; + const int num_samples = len / sizeof(int16_t) / num_channels_; if (num_samples <= 0) return audio_bus.Pass(); - int16* const pcm_data = reinterpret_cast<int16*>(data); + int16_t* const pcm_data = reinterpret_cast<int16_t*>(data); #if defined(ARCH_CPU_LITTLE_ENDIAN) // Convert endianness. const int num_elements = num_samples * num_channels_; for (int i = 0; i < num_elements; ++i) - pcm_data[i] = static_cast<int16>(base::NetToHost16(pcm_data[i])); + pcm_data[i] = static_cast<int16_t>(base::NetToHost16(pcm_data[i])); #endif audio_bus = AudioBus::Create(num_channels_, num_samples).Pass(); - audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16)); + audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16_t)); return audio_bus.Pass(); } diff --git a/media/cast/receiver/audio_decoder_unittest.cc b/media/cast/receiver/audio_decoder_unittest.cc index 2e6a1dc..48dfab6 100644 --- a/media/cast/receiver/audio_decoder_unittest.cc +++ b/media/cast/receiver/audio_decoder_unittest.cc @@ -58,7 +58,7 @@ class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { if (GetParam().codec == CODEC_AUDIO_OPUS) { opus_encoder_memory_.reset( - new uint8[opus_encoder_get_size(GetParam().num_channels)]); + new uint8_t[opus_encoder_get_size(GetParam().num_channels)]); OpusEncoder* const opus_encoder = reinterpret_cast<OpusEncoder*>(opus_encoder_memory_.get()); CHECK_EQ(OPUS_OK, opus_encoder_init(opus_encoder, @@ -90,15 +90,15 @@ class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { // Encode |audio_bus| into |encoded_frame->data|. const int num_elements = audio_bus->channels() * audio_bus->frames(); - std::vector<int16> interleaved(num_elements); - audio_bus->ToInterleaved( - audio_bus->frames(), sizeof(int16), &interleaved.front()); + std::vector<int16_t> interleaved(num_elements); + audio_bus->ToInterleaved(audio_bus->frames(), sizeof(int16_t), + &interleaved.front()); if (GetParam().codec == CODEC_AUDIO_PCM16) { - encoded_frame->data.resize(num_elements * sizeof(int16)); - int16* const pcm_data = - reinterpret_cast<int16*>(encoded_frame->mutable_bytes()); + encoded_frame->data.resize(num_elements * sizeof(int16_t)); + int16_t* const pcm_data = + reinterpret_cast<int16_t*>(encoded_frame->mutable_bytes()); for (size_t i = 0; i < interleaved.size(); ++i) - pcm_data[i] = static_cast<int16>(base::HostToNet16(interleaved[i])); + pcm_data[i] = static_cast<int16_t>(base::HostToNet16(interleaved[i])); } else if (GetParam().codec == CODEC_AUDIO_OPUS) { OpusEncoder* const opus_encoder = reinterpret_cast<OpusEncoder*>(opus_encoder_memory_.get()); @@ -183,9 +183,9 @@ class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { const scoped_refptr<StandaloneCastEnvironment> cast_environment_; scoped_ptr<AudioDecoder> audio_decoder_; scoped_ptr<TestAudioBusFactory> audio_bus_factory_; - uint32 last_frame_id_; + uint32_t last_frame_id_; bool seen_a_decoded_frame_; - scoped_ptr<uint8[]> opus_encoder_memory_; + scoped_ptr<uint8_t[]> opus_encoder_memory_; base::Lock lock_; base::ConditionVariable cond_; diff --git a/media/cast/receiver/cast_receiver_impl.cc b/media/cast/receiver/cast_receiver_impl.cc index 83d8bf7..c9aeefb 100644 --- a/media/cast/receiver/cast_receiver_impl.cc +++ b/media/cast/receiver/cast_receiver_impl.cc @@ -46,7 +46,7 @@ void CastReceiverImpl::ReceivePacket(scoped_ptr<Packet> packet) { const uint8_t* const data = &packet->front(); const size_t length = packet->size(); - uint32 ssrc_of_sender; + uint32_t ssrc_of_sender; if (Rtcp::IsRtcpPacket(data, length)) { ssrc_of_sender = Rtcp::GetSsrcOfSender(data, length); } else if (!RtpParser::ParseSsrc(data, length, &ssrc_of_sender)) { @@ -123,8 +123,8 @@ void CastReceiverImpl::DecodeEncodedAudioFrame( audio_sampling_rate_, audio_codec_)); } - const uint32 frame_id = encoded_frame->frame_id; - const uint32 rtp_timestamp = encoded_frame->rtp_timestamp; + const uint32_t frame_id = encoded_frame->frame_id; + const uint32_t rtp_timestamp = encoded_frame->rtp_timestamp; const base::TimeTicks playout_time = encoded_frame->reference_time; audio_decoder_->DecodeFrame( encoded_frame.Pass(), @@ -155,8 +155,8 @@ void CastReceiverImpl::DecodeEncodedVideoFrame( if (!video_decoder_) video_decoder_.reset(new VideoDecoder(cast_environment_, video_codec_)); - const uint32 frame_id = encoded_frame->frame_id; - const uint32 rtp_timestamp = encoded_frame->rtp_timestamp; + const uint32_t frame_id = encoded_frame->frame_id; + const uint32_t rtp_timestamp = encoded_frame->rtp_timestamp; const base::TimeTicks playout_time = encoded_frame->reference_time; video_decoder_->DecodeFrame( encoded_frame.Pass(), @@ -172,8 +172,8 @@ void CastReceiverImpl::DecodeEncodedVideoFrame( void CastReceiverImpl::EmitDecodedAudioFrame( const scoped_refptr<CastEnvironment>& cast_environment, const AudioFrameDecodedCallback& callback, - uint32 frame_id, - uint32 rtp_timestamp, + uint32_t frame_id, + uint32_t rtp_timestamp, const base::TimeTicks& playout_time, scoped_ptr<AudioBus> audio_bus, bool is_continuous) { @@ -199,8 +199,8 @@ void CastReceiverImpl::EmitDecodedAudioFrame( void CastReceiverImpl::EmitDecodedVideoFrame( const scoped_refptr<CastEnvironment>& cast_environment, const VideoFrameDecodedCallback& callback, - uint32 frame_id, - uint32 rtp_timestamp, + uint32_t frame_id, + uint32_t rtp_timestamp, const base::TimeTicks& playout_time, const scoped_refptr<VideoFrame>& video_frame, bool is_continuous) { diff --git a/media/cast/receiver/cast_receiver_impl.h b/media/cast/receiver/cast_receiver_impl.h index 6a6592a..f94735c 100644 --- a/media/cast/receiver/cast_receiver_impl.h +++ b/media/cast/receiver/cast_receiver_impl.h @@ -62,8 +62,8 @@ class CastReceiverImpl : public CastReceiver { static void EmitDecodedAudioFrame( const scoped_refptr<CastEnvironment>& cast_environment, const AudioFrameDecodedCallback& callback, - uint32 frame_id, - uint32 rtp_timestamp, + uint32_t frame_id, + uint32_t rtp_timestamp, const base::TimeTicks& playout_time, scoped_ptr<AudioBus> audio_bus, bool is_continuous); @@ -76,8 +76,8 @@ class CastReceiverImpl : public CastReceiver { static void EmitDecodedVideoFrame( const scoped_refptr<CastEnvironment>& cast_environment, const VideoFrameDecodedCallback& callback, - uint32 frame_id, - uint32 rtp_timestamp, + uint32_t frame_id, + uint32_t rtp_timestamp, const base::TimeTicks& playout_time, const scoped_refptr<VideoFrame>& video_frame, bool is_continuous); @@ -88,8 +88,8 @@ class CastReceiverImpl : public CastReceiver { // Used by DispatchReceivedPacket() to direct packets to the appropriate frame // receiver. - const uint32 ssrc_of_audio_sender_; - const uint32 ssrc_of_video_sender_; + const uint32_t ssrc_of_audio_sender_; + const uint32_t ssrc_of_video_sender_; // Parameters for the decoders that are created on-demand. The values here // might be nonsense if the client of CastReceiverImpl never intends to use diff --git a/media/cast/receiver/frame_receiver.cc b/media/cast/receiver/frame_receiver.cc index b9d5a6e..303a718 100644 --- a/media/cast/receiver/frame_receiver.cc +++ b/media/cast/receiver/frame_receiver.cc @@ -81,7 +81,7 @@ bool FrameReceiver::ProcessPacket(scoped_ptr<Packet> packet) { rtcp_.IncomingRtcpPacket(&packet->front(), packet->size()); } else { RtpCastHeader rtp_header; - const uint8* payload_data; + const uint8_t* payload_data; size_t payload_size; if (!packet_parser_.ParsePacket(&packet->front(), packet->size(), @@ -105,7 +105,7 @@ bool FrameReceiver::ProcessPacket(scoped_ptr<Packet> packet) { } void FrameReceiver::ProcessParsedPacket(const RtpCastHeader& rtp_header, - const uint8* payload_data, + const uint8_t* payload_data, size_t payload_size) { DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); @@ -155,7 +155,7 @@ void FrameReceiver::ProcessParsedPacket(const RtpCastHeader& rtp_header, lip_sync_reference_time_ = fresh_sync_reference; } else { lip_sync_reference_time_ += RtpDeltaToTimeDelta( - static_cast<int32>(fresh_sync_rtp - lip_sync_rtp_timestamp_), + static_cast<int32_t>(fresh_sync_rtp - lip_sync_rtp_timestamp_), rtp_timebase_); } lip_sync_rtp_timestamp_ = fresh_sync_rtp; @@ -302,12 +302,11 @@ base::TimeTicks FrameReceiver::GetPlayoutTime(const EncodedFrame& frame) const { target_playout_delay = base::TimeDelta::FromMilliseconds( frame.new_playout_delay_ms); } - return lip_sync_reference_time_ + - lip_sync_drift_.Current() + - RtpDeltaToTimeDelta( - static_cast<int32>(frame.rtp_timestamp - lip_sync_rtp_timestamp_), - rtp_timebase_) + - target_playout_delay; + return lip_sync_reference_time_ + lip_sync_drift_.Current() + + RtpDeltaToTimeDelta(static_cast<int32_t>(frame.rtp_timestamp - + lip_sync_rtp_timestamp_), + rtp_timebase_) + + target_playout_delay; } void FrameReceiver::ScheduleNextCastMessage() { diff --git a/media/cast/receiver/frame_receiver.h b/media/cast/receiver/frame_receiver.h index ec3175f..6bb96e1 100644 --- a/media/cast/receiver/frame_receiver.h +++ b/media/cast/receiver/frame_receiver.h @@ -69,7 +69,7 @@ class FrameReceiver : public RtpPayloadFeedback, friend class FrameReceiverTest; // Invokes ProcessParsedPacket(). void ProcessParsedPacket(const RtpCastHeader& rtp_header, - const uint8* payload_data, + const uint8_t* payload_data, size_t payload_size); // RtpPayloadFeedback implementation. diff --git a/media/cast/receiver/frame_receiver_unittest.cc b/media/cast/receiver/frame_receiver_unittest.cc index 6e6a3915..6386631 100644 --- a/media/cast/receiver/frame_receiver_unittest.cc +++ b/media/cast/receiver/frame_receiver_unittest.cc @@ -28,7 +28,7 @@ namespace cast { namespace { const int kPacketSize = 1500; -const uint32 kFirstFrameId = 1234; +const uint32_t kFirstFrameId = 1234; const int kPlayoutDelayMillis = 100; class FakeFrameClient { @@ -36,7 +36,7 @@ class FakeFrameClient { FakeFrameClient() : num_called_(0) {} virtual ~FakeFrameClient() {} - void AddExpectedResult(uint32 expected_frame_id, + void AddExpectedResult(uint32_t expected_frame_id, const base::TimeTicks& expected_playout_time) { expected_results_.push_back( std::make_pair(expected_frame_id, expected_playout_time)); @@ -56,7 +56,7 @@ class FakeFrameClient { int number_times_called() const { return num_called_; } private: - std::deque<std::pair<uint32, base::TimeTicks> > expected_results_; + std::deque<std::pair<uint32_t, base::TimeTicks>> expected_results_; int num_called_; DISALLOW_COPY_AND_ASSIGN(FakeFrameClient); @@ -119,21 +119,20 @@ class FrameReceiverTest : public ::testing::Test { void FeedLipSyncInfoIntoReceiver() { const base::TimeTicks now = testing_clock_->NowTicks(); - const int64 rtp_timestamp = (now - start_time_) * - config_.rtp_timebase / base::TimeDelta::FromSeconds(1); + const int64_t rtp_timestamp = (now - start_time_) * config_.rtp_timebase / + base::TimeDelta::FromSeconds(1); CHECK_LE(0, rtp_timestamp); - uint32 ntp_seconds; - uint32 ntp_fraction; + uint32_t ntp_seconds; + uint32_t ntp_fraction; ConvertTimeTicksToNtp(now, &ntp_seconds, &ntp_fraction); TestRtcpPacketBuilder rtcp_packet; - rtcp_packet.AddSrWithNtp(config_.sender_ssrc, - ntp_seconds, ntp_fraction, - static_cast<uint32>(rtp_timestamp)); + rtcp_packet.AddSrWithNtp(config_.sender_ssrc, ntp_seconds, ntp_fraction, + static_cast<uint32_t>(rtp_timestamp)); ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket().Pass())); } FrameReceiverConfig config_; - std::vector<uint8> payload_; + std::vector<uint8_t> payload_; RtpCastHeader rtp_header_; base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. base::TimeTicks start_time_; @@ -217,7 +216,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesSkippingWhenAppropriate) { EXPECT_CALL(mock_transport_, SendRtcpFromRtpReceiver(_, _, _, _, _, _, _)) .WillRepeatedly(testing::Return()); - const uint32 rtp_advance_per_frame = + const uint32_t rtp_advance_per_frame = config_.rtp_timebase / config_.target_frame_rate; const base::TimeDelta time_advance_per_frame = base::TimeDelta::FromSeconds(1) / config_.target_frame_rate; @@ -320,7 +319,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesRefusingToSkipAny) { EXPECT_CALL(mock_transport_, SendRtcpFromRtpReceiver(_, _, _, _, _, _, _)) .WillRepeatedly(testing::Return()); - const uint32 rtp_advance_per_frame = + const uint32_t rtp_advance_per_frame = config_.rtp_timebase / config_.target_frame_rate; const base::TimeDelta time_advance_per_frame = base::TimeDelta::FromSeconds(1) / config_.target_frame_rate; diff --git a/media/cast/receiver/video_decoder.cc b/media/cast/receiver/video_decoder.cc index e942380..96ec359 100644 --- a/media/cast/receiver/video_decoder.cc +++ b/media/cast/receiver/video_decoder.cc @@ -49,7 +49,7 @@ class VideoDecoder::ImplBase "size of frame_id types do not match"); bool is_continuous = true; if (seen_first_frame_) { - const uint32 frames_ahead = encoded_frame->frame_id - last_frame_id_; + const uint32_t frames_ahead = encoded_frame->frame_id - last_frame_id_; if (frames_ahead > 1) { RecoverBecauseFramesWereDropped(); is_continuous = false; @@ -84,7 +84,7 @@ class VideoDecoder::ImplBase virtual void RecoverBecauseFramesWereDropped() {} // Note: Implementation of Decode() is allowed to mutate |data|. - virtual scoped_refptr<VideoFrame> Decode(uint8* data, int len) = 0; + virtual scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) = 0; const scoped_refptr<CastEnvironment> cast_environment_; const Codec codec_; @@ -97,7 +97,7 @@ class VideoDecoder::ImplBase private: bool seen_first_frame_; - uint32 last_frame_id_; + uint32_t last_frame_id_; DISALLOW_COPY_AND_ASSIGN(ImplBase); }; @@ -131,7 +131,7 @@ class VideoDecoder::Vp8Impl : public VideoDecoder::ImplBase { CHECK_EQ(VPX_CODEC_OK, vpx_codec_destroy(&context_)); } - scoped_refptr<VideoFrame> Decode(uint8* data, int len) final { + scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final { if (len <= 0 || vpx_codec_decode(&context_, data, static_cast<unsigned int>(len), @@ -193,7 +193,7 @@ class VideoDecoder::FakeImpl : public VideoDecoder::ImplBase { private: ~FakeImpl() final {} - scoped_refptr<VideoFrame> Decode(uint8* data, int len) final { + scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final { // Make sure this is a JSON string. if (!len || data[0] != '{') return NULL; diff --git a/media/cast/receiver/video_decoder_unittest.cc b/media/cast/receiver/video_decoder_unittest.cc index fad2db5..6cb3d49 100644 --- a/media/cast/receiver/video_decoder_unittest.cc +++ b/media/cast/receiver/video_decoder_unittest.cc @@ -153,7 +153,7 @@ class VideoDecoderTest : public ::testing::TestWithParam<Codec> { scoped_ptr<VideoDecoder> video_decoder_; gfx::Size next_frame_size_; base::TimeDelta next_frame_timestamp_; - uint32 last_frame_id_; + uint32_t last_frame_id_; bool seen_a_decoded_frame_; Vp8Encoder vp8_encoder_; diff --git a/media/cast/sender/audio_encoder.cc b/media/cast/sender/audio_encoder.cc index bf18118..aaf84d1 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); }; diff --git a/media/cast/sender/audio_encoder_unittest.cc b/media/cast/sender/audio_encoder_unittest.cc index 48ebdc1..b96a553 100644 --- a/media/cast/sender/audio_encoder_unittest.cc +++ b/media/cast/sender/audio_encoder_unittest.cc @@ -46,7 +46,7 @@ class TestEncodedAudioFrameReceiver { void FrameEncoded(scoped_ptr<SenderEncodedFrame> encoded_frame, int samples_skipped) { EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY); - EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff), + EXPECT_EQ(static_cast<uint8_t>(frames_received_ & 0xff), encoded_frame->frame_id); EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id); // RTP timestamps should be monotonically increasing and integer multiples @@ -68,7 +68,7 @@ class TestEncodedAudioFrameReceiver { private: int frames_received_; - uint32 rtp_lower_bound_; + uint32_t rtp_lower_bound_; int samples_per_frame_; base::TimeTicks lower_bound_; base::TimeTicks upper_bound_; @@ -77,10 +77,10 @@ class TestEncodedAudioFrameReceiver { }; struct TestScenario { - const int64* durations_in_ms; + const int64_t* durations_in_ms; size_t num_durations; - TestScenario(const int64* d, size_t n) + TestScenario(const int64_t* d, size_t n) : durations_in_ms(d), num_durations(n) {} std::string ToString() const { @@ -191,38 +191,38 @@ TEST_P(AudioEncoderTest, EncodeAac) { } #endif -static const int64 kOneCall_3Millis[] = {3}; -static const int64 kOneCall_10Millis[] = {10}; -static const int64 kOneCall_13Millis[] = {13}; -static const int64 kOneCall_20Millis[] = {20}; - -static const int64 kTwoCalls_3Millis[] = {3, 3}; -static const int64 kTwoCalls_10Millis[] = {10, 10}; -static const int64 kTwoCalls_Mixed1[] = {3, 10}; -static const int64 kTwoCalls_Mixed2[] = {10, 3}; -static const int64 kTwoCalls_Mixed3[] = {3, 17}; -static const int64 kTwoCalls_Mixed4[] = {17, 3}; - -static const int64 kManyCalls_3Millis[] = {3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3}; -static const int64 kManyCalls_10Millis[] = {10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10}; -static const int64 kManyCalls_Mixed1[] = {3, 10, 3, 10, 3, 10, 3, 10, 3, - 10, 3, 10, 3, 10, 3, 10, 3, 10}; -static const int64 kManyCalls_Mixed2[] = {10, 3, 10, 3, 10, 3, 10, 3, 10, 3, - 10, 3, 10, 3, 10, 3, 10, 3, 10, 3}; -static const int64 kManyCalls_Mixed3[] = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, - 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4}; -static const int64 kManyCalls_Mixed4[] = {31, 4, 15, 9, 26, 53, 5, 8, 9, - 7, 9, 32, 38, 4, 62, 64, 3}; -static const int64 kManyCalls_Mixed5[] = {3, 14, 15, 9, 26, 53, 58, 9, 7, - 9, 3, 23, 8, 4, 6, 2, 6, 43}; - -static const int64 kOneBigUnderrun[] = {10, 10, 10, 10, -1000, 10, 10, 10}; -static const int64 kTwoBigUnderruns[] = {10, 10, 10, 10, -712, 10, 10, 10, - -1311, 10, 10, 10}; -static const int64 kMixedUnderruns[] = {31, -64, 4, 15, 9, 26, -53, 5, 8, -9, - 7, 9, 32, 38, -4, 62, -64, 3}; +static const int64_t kOneCall_3Millis[] = {3}; +static const int64_t kOneCall_10Millis[] = {10}; +static const int64_t kOneCall_13Millis[] = {13}; +static const int64_t kOneCall_20Millis[] = {20}; + +static const int64_t kTwoCalls_3Millis[] = {3, 3}; +static const int64_t kTwoCalls_10Millis[] = {10, 10}; +static const int64_t kTwoCalls_Mixed1[] = {3, 10}; +static const int64_t kTwoCalls_Mixed2[] = {10, 3}; +static const int64_t kTwoCalls_Mixed3[] = {3, 17}; +static const int64_t kTwoCalls_Mixed4[] = {17, 3}; + +static const int64_t kManyCalls_3Millis[] = {3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3}; +static const int64_t kManyCalls_10Millis[] = {10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10}; +static const int64_t kManyCalls_Mixed1[] = {3, 10, 3, 10, 3, 10, 3, 10, 3, + 10, 3, 10, 3, 10, 3, 10, 3, 10}; +static const int64_t kManyCalls_Mixed2[] = {10, 3, 10, 3, 10, 3, 10, 3, 10, 3, + 10, 3, 10, 3, 10, 3, 10, 3, 10, 3}; +static const int64_t kManyCalls_Mixed3[] = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, + 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4}; +static const int64_t kManyCalls_Mixed4[] = {31, 4, 15, 9, 26, 53, 5, 8, 9, + 7, 9, 32, 38, 4, 62, 64, 3}; +static const int64_t kManyCalls_Mixed5[] = {3, 14, 15, 9, 26, 53, 58, 9, 7, + 9, 3, 23, 8, 4, 6, 2, 6, 43}; + +static const int64_t kOneBigUnderrun[] = {10, 10, 10, 10, -1000, 10, 10, 10}; +static const int64_t kTwoBigUnderruns[] = {10, 10, 10, 10, -712, 10, + 10, 10, -1311, 10, 10, 10}; +static const int64_t kMixedUnderruns[] = {31, -64, 4, 15, 9, 26, -53, 5, 8, + -9, 7, 9, 32, 38, -4, 62, -64, 3}; INSTANTIATE_TEST_CASE_P( AudioEncoderTestScenarios, diff --git a/media/cast/sender/audio_sender_unittest.cc b/media/cast/sender/audio_sender_unittest.cc index edbee2e..f866b51 100644 --- a/media/cast/sender/audio_sender_unittest.cc +++ b/media/cast/sender/audio_sender_unittest.cc @@ -53,7 +53,7 @@ class TestPacketSender : public PacketSender { return true; } - int64 GetBytesSent() final { return 0; } + int64_t GetBytesSent() final { return 0; } int number_of_rtp_packets() const { return number_of_rtp_packets_; } diff --git a/media/cast/sender/congestion_control.cc b/media/cast/sender/congestion_control.cc index 0c37056..c5b91f5 100644 --- a/media/cast/sender/congestion_control.cc +++ b/media/cast/sender/congestion_control.cc @@ -38,10 +38,10 @@ class AdaptiveCongestionControl : public CongestionControl { // CongestionControl implementation. void UpdateRtt(base::TimeDelta rtt) final; void UpdateTargetPlayoutDelay(base::TimeDelta delay) final; - void SendFrameToTransport(uint32 frame_id, + void SendFrameToTransport(uint32_t frame_id, size_t frame_size_in_bits, base::TimeTicks when) final; - void AckFrame(uint32 frame_id, base::TimeTicks when) final; + void AckFrame(uint32_t frame_id, base::TimeTicks when) final; int GetBitrate(base::TimeTicks playout_time, base::TimeDelta playout_delay, int soft_max_bitrate) final; @@ -61,7 +61,7 @@ class AdaptiveCongestionControl : public CongestionControl { static base::TimeDelta DeadTime(const FrameStats& a, const FrameStats& b); // Get the FrameStats for a given |frame_id|. Never returns nullptr. // Note: Older FrameStats will be removed automatically. - FrameStats* GetFrameStats(uint32 frame_id); + FrameStats* GetFrameStats(uint32_t frame_id); // Discard old FrameStats. void PruneFrameStats(); // Calculate a safe bitrate. This is based on how much we've been @@ -71,7 +71,7 @@ class AdaptiveCongestionControl : public CongestionControl { // Estimate when the transport will start sending the data for a given frame. // |estimated_bitrate| is the current estimated transmit bitrate in bits per // second. - base::TimeTicks EstimatedSendingTime(uint32 frame_id, + base::TimeTicks EstimatedSendingTime(uint32_t frame_id, double estimated_bitrate); base::TickClock* const clock_; // Not owned by this class. @@ -79,9 +79,9 @@ class AdaptiveCongestionControl : public CongestionControl { const int min_bitrate_configured_; const double max_frame_rate_; std::deque<FrameStats> frame_stats_; - uint32 last_frame_stats_; - uint32 last_acked_frame_; - uint32 last_enqueued_frame_; + uint32_t last_frame_stats_; + uint32_t last_acked_frame_; + uint32_t last_enqueued_frame_; base::TimeDelta rtt_; size_t history_size_; size_t acked_bits_in_history_; @@ -98,10 +98,10 @@ class FixedCongestionControl : public CongestionControl { // CongestionControl implementation. void UpdateRtt(base::TimeDelta rtt) final {} void UpdateTargetPlayoutDelay(base::TimeDelta delay) final {} - void SendFrameToTransport(uint32 frame_id, + void SendFrameToTransport(uint32_t frame_id, size_t frame_size_in_bits, base::TimeTicks when) final {} - void AckFrame(uint32 frame_id, base::TimeTicks when) final {} + void AckFrame(uint32_t frame_id, base::TimeTicks when) final {} int GetBitrate(base::TimeTicks playout_time, base::TimeDelta playout_delay, int soft_max_bitrate) final { @@ -143,18 +143,17 @@ static const size_t kHistorySize = 100; AdaptiveCongestionControl::FrameStats::FrameStats() : frame_size_in_bits(0) { } -AdaptiveCongestionControl::AdaptiveCongestionControl( - base::TickClock* clock, - int max_bitrate_configured, - int min_bitrate_configured, - double max_frame_rate) +AdaptiveCongestionControl::AdaptiveCongestionControl(base::TickClock* clock, + int max_bitrate_configured, + int min_bitrate_configured, + double max_frame_rate) : clock_(clock), max_bitrate_configured_(max_bitrate_configured), min_bitrate_configured_(min_bitrate_configured), max_frame_rate_(max_frame_rate), - last_frame_stats_(static_cast<uint32>(-1)), - last_acked_frame_(static_cast<uint32>(-1)), - last_enqueued_frame_(static_cast<uint32>(-1)), + last_frame_stats_(static_cast<uint32_t>(-1)), + last_acked_frame_(static_cast<uint32_t>(-1)), + last_enqueued_frame_(static_cast<uint32_t>(-1)), history_size_(kHistorySize), acked_bits_in_history_(0) { DCHECK_GE(max_bitrate_configured, min_bitrate_configured) << "Invalid config"; @@ -205,10 +204,10 @@ double AdaptiveCongestionControl::CalculateSafeBitrate() { return acked_bits_in_history_ / std::max(transmit_time, 1E-3); } -AdaptiveCongestionControl::FrameStats* -AdaptiveCongestionControl::GetFrameStats(uint32 frame_id) { - int32 offset = static_cast<int32>(frame_id - last_frame_stats_); - DCHECK_LT(offset, static_cast<int32>(kHistorySize)); +AdaptiveCongestionControl::FrameStats* AdaptiveCongestionControl::GetFrameStats( + uint32_t frame_id) { + int32_t offset = static_cast<int32_t>(frame_id - last_frame_stats_); + DCHECK_LT(offset, static_cast<int32_t>(kHistorySize)); if (offset > 0) { frame_stats_.resize(frame_stats_.size() + offset); last_frame_stats_ += offset; @@ -218,7 +217,7 @@ AdaptiveCongestionControl::GetFrameStats(uint32 frame_id) { offset += frame_stats_.size() - 1; // TODO(miu): Change the following to DCHECK once crash fix is confirmed. // http://crbug.com/517145 - CHECK(offset >= 0 && offset < static_cast<int32>(frame_stats_.size())); + CHECK(offset >= 0 && offset < static_cast<int32_t>(frame_stats_.size())); return &frame_stats_[offset]; } @@ -235,7 +234,7 @@ void AdaptiveCongestionControl::PruneFrameStats() { } } -void AdaptiveCongestionControl::AckFrame(uint32 frame_id, +void AdaptiveCongestionControl::AckFrame(uint32_t frame_id, base::TimeTicks when) { FrameStats* frame_stats = GetFrameStats(last_acked_frame_); while (IsNewerFrameId(frame_id, last_acked_frame_)) { @@ -255,7 +254,7 @@ void AdaptiveCongestionControl::AckFrame(uint32 frame_id, } } -void AdaptiveCongestionControl::SendFrameToTransport(uint32 frame_id, +void AdaptiveCongestionControl::SendFrameToTransport(uint32_t frame_id, size_t frame_size_in_bits, base::TimeTicks when) { last_enqueued_frame_ = frame_id; @@ -265,7 +264,7 @@ void AdaptiveCongestionControl::SendFrameToTransport(uint32 frame_id, } base::TimeTicks AdaptiveCongestionControl::EstimatedSendingTime( - uint32 frame_id, + uint32_t frame_id, double estimated_bitrate) { const base::TimeTicks now = clock_->NowTicks(); @@ -277,7 +276,7 @@ base::TimeTicks AdaptiveCongestionControl::EstimatedSendingTime( // be in-flight; and therefore it is common for the |estimated_sending_time| // for those frames to be before |now|. base::TimeTicks estimated_sending_time; - for (uint32 f = last_acked_frame_; IsNewerFrameId(frame_id, f); ++f) { + for (uint32_t f = last_acked_frame_; IsNewerFrameId(frame_id, f); ++f) { FrameStats* const stats = GetFrameStats(f); // |estimated_ack_time| is the local time when the sender receives the ACK, diff --git a/media/cast/sender/congestion_control.h b/media/cast/sender/congestion_control.h index 8e17134..3951f99 100644 --- a/media/cast/sender/congestion_control.h +++ b/media/cast/sender/congestion_control.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ #define MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/time/tick_clock.h" #include "base/time/time.h" @@ -24,12 +23,12 @@ class CongestionControl { virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) = 0; // Called when an encoded frame is enqueued for transport. - virtual void SendFrameToTransport(uint32 frame_id, + virtual void SendFrameToTransport(uint32_t frame_id, size_t frame_size_in_bits, base::TimeTicks when) = 0; // Called when we receive an ACK for a frame. - virtual void AckFrame(uint32 frame_id, base::TimeTicks when) = 0; + virtual void AckFrame(uint32_t frame_id, base::TimeTicks when) = 0; // Returns the bitrate we should use for the next frame. |soft_max_bitrate| // is a soft upper-bound applied to the computed target bitrate before the diff --git a/media/cast/sender/congestion_control_unittest.cc b/media/cast/sender/congestion_control_unittest.cc index b435b9a..e1c0251 100644 --- a/media/cast/sender/congestion_control_unittest.cc +++ b/media/cast/sender/congestion_control_unittest.cc @@ -15,9 +15,9 @@ namespace cast { static const int kMaxBitrateConfigured = 5000000; static const int kMinBitrateConfigured = 500000; -static const int64 kFrameDelayMs = 33; +static const int64_t kFrameDelayMs = 33; static const double kMaxFrameRate = 1000.0 / kFrameDelayMs; -static const int64 kStartMillisecond = INT64_C(12345678900000); +static const int64_t kStartMillisecond = INT64_C(12345678900000); static const double kTargetEmptyBufferFraction = 0.9; class CongestionControlTest : public ::testing::Test { @@ -36,11 +36,11 @@ class CongestionControlTest : public ::testing::Test { congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay); } - void AckFrame(uint32 frame_id) { + void AckFrame(uint32_t frame_id) { congestion_control_->AckFrame(frame_id, testing_clock_.NowTicks()); } - void Run(uint32 frames, + void Run(uint32_t frames, size_t frame_size, base::TimeDelta rtt, base::TimeDelta frame_delay, @@ -61,7 +61,7 @@ class CongestionControlTest : public ::testing::Test { base::SimpleTestTickClock testing_clock_; scoped_ptr<CongestionControl> congestion_control_; scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; - uint32 frame_id_; + uint32_t frame_id_; DISALLOW_COPY_AND_ASSIGN(CongestionControlTest); }; @@ -70,7 +70,7 @@ class CongestionControlTest : public ::testing::Test { // estimations of network bandwidth and how much is in-flight (i.e, using the // "target buffer fill" model). TEST_F(CongestionControlTest, SimpleRun) { - uint32 frame_size = 10000 * 8; + uint32_t frame_size = 10000 * 8; Run(500, frame_size, base::TimeDelta::FromMilliseconds(10), @@ -83,11 +83,10 @@ TEST_F(CongestionControlTest, SimpleRun) { // the underlying computations. const int soft_max_bitrate = std::numeric_limits<int>::max(); - uint32 safe_bitrate = frame_size * 1000 / kFrameDelayMs; - uint32 bitrate = congestion_control_->GetBitrate( + uint32_t safe_bitrate = frame_size * 1000 / kFrameDelayMs; + uint32_t bitrate = congestion_control_->GetBitrate( testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300), - base::TimeDelta::FromMilliseconds(300), - soft_max_bitrate); + base::TimeDelta::FromMilliseconds(300), soft_max_bitrate); EXPECT_NEAR( safe_bitrate / kTargetEmptyBufferFraction, bitrate, safe_bitrate * 0.05); diff --git a/media/cast/sender/external_video_encoder.cc b/media/cast/sender/external_video_encoder.cc index 11484c0..f716a55 100644 --- a/media/cast/sender/external_video_encoder.cc +++ b/media/cast/sender/external_video_encoder.cc @@ -102,7 +102,7 @@ class ExternalVideoEncoder::VEAClientImpl void Initialize(const gfx::Size& frame_size, VideoCodecProfile codec_profile, int start_bit_rate, - uint32 first_frame_id) { + uint32_t first_frame_id) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); requested_bit_rate_ = start_bit_rate; @@ -185,12 +185,12 @@ class ExternalVideoEncoder::VEAClientImpl // Encoder has encoded a frame and it's available in one of the output // buffers. Package the result in a media::cast::EncodedFrame and post it // to the Cast MAIN thread via the supplied callback. - void BitstreamBufferReady(int32 bitstream_buffer_id, + void BitstreamBufferReady(int32_t bitstream_buffer_id, size_t payload_size, bool key_frame) final { DCHECK(task_runner_->RunsTasksOnCurrentThread()); if (bitstream_buffer_id < 0 || - bitstream_buffer_id >= static_cast<int32>(output_buffers_.size())) { + bitstream_buffer_id >= static_cast<int32_t>(output_buffers_.size())) { NOTREACHED(); VLOG(1) << "BitstreamBufferReady(): invalid bitstream_buffer_id=" << bitstream_buffer_id; @@ -263,11 +263,11 @@ class ExternalVideoEncoder::VEAClientImpl if (key_frame || key_frame_quantizer_parsable_) { if (codec_profile_ == media::VP8PROFILE_ANY) { quantizer = ParseVp8HeaderQuantizer( - reinterpret_cast<const uint8*>(encoded_frame->data.data()), + reinterpret_cast<const uint8_t*>(encoded_frame->data.data()), encoded_frame->data.size()); } else if (codec_profile_ == media::H264PROFILE_MAIN) { quantizer = GetH264FrameQuantizer( - reinterpret_cast<const uint8*>(encoded_frame->data.data()), + reinterpret_cast<const uint8_t*>(encoded_frame->data.data()), encoded_frame->data.size()); } else { NOTIMPLEMENTED(); @@ -375,7 +375,7 @@ class ExternalVideoEncoder::VEAClientImpl // Immediately provide all output buffers to the VEA. for (size_t i = 0; i < output_buffers_.size(); ++i) { video_encode_accelerator_->UseOutputBitstreamBuffer( - media::BitstreamBuffer(static_cast<int32>(i), + media::BitstreamBuffer(static_cast<int32_t>(i), output_buffers_[i]->handle(), output_buffers_[i]->mapped_size())); } @@ -383,7 +383,7 @@ class ExternalVideoEncoder::VEAClientImpl // Parse H264 SPS, PPS, and Slice header, and return the averaged frame // quantizer in the range of [0, 51], or -1 on parse error. - double GetH264FrameQuantizer(const uint8* encoded_data, off_t size) { + double GetH264FrameQuantizer(const uint8_t* encoded_data, off_t size) { DCHECK(encoded_data); if (!size) return -1; @@ -447,7 +447,7 @@ class ExternalVideoEncoder::VEAClientImpl const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_; scoped_ptr<media::VideoEncodeAccelerator> video_encode_accelerator_; bool encoder_active_; - uint32 next_frame_id_; + uint32_t next_frame_id_; bool key_frame_encountered_; std::string stream_header_; VideoCodecProfile codec_profile_; @@ -491,7 +491,7 @@ ExternalVideoEncoder::ExternalVideoEncoder( const scoped_refptr<CastEnvironment>& cast_environment, const VideoSenderConfig& video_config, const gfx::Size& frame_size, - uint32 first_frame_id, + uint32_t first_frame_id, const StatusChangeCallback& status_change_cb, const CreateVideoEncodeAcceleratorCallback& create_vea_cb, const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) @@ -559,7 +559,7 @@ void ExternalVideoEncoder::GenerateKeyFrame() { void ExternalVideoEncoder::OnCreateVideoEncodeAccelerator( const VideoSenderConfig& video_config, - uint32 first_frame_id, + uint32_t first_frame_id, const StatusChangeCallback& status_change_cb, scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner, scoped_ptr<media::VideoEncodeAccelerator> vea) { @@ -655,7 +655,7 @@ double QuantizerEstimator::EstimateForKeyFrame(const VideoFrame& frame) { const int rows_in_subset = std::max(1, size.height() * FRAME_SAMPLING_PERCENT / 100); if (last_frame_size_ != size || !last_frame_pixel_buffer_) { - last_frame_pixel_buffer_.reset(new uint8[size.width() * rows_in_subset]); + last_frame_pixel_buffer_.reset(new uint8_t[size.width() * rows_in_subset]); last_frame_size_ = size; } @@ -667,11 +667,11 @@ double QuantizerEstimator::EstimateForKeyFrame(const VideoFrame& frame) { const int row_skip = size.height() / rows_in_subset; int y = 0; for (int i = 0; i < rows_in_subset; ++i, y += row_skip) { - const uint8* const row_begin = frame.visible_data(VideoFrame::kYPlane) + - y * frame.stride(VideoFrame::kYPlane); - const uint8* const row_end = row_begin + size.width(); + const uint8_t* const row_begin = frame.visible_data(VideoFrame::kYPlane) + + y * frame.stride(VideoFrame::kYPlane); + const uint8_t* const row_end = row_begin + size.width(); int left_hand_pixel_value = static_cast<int>(*row_begin); - for (const uint8* p = row_begin + 1; p < row_end; ++p) { + for (const uint8_t* p = row_begin + 1; p < row_end; ++p) { const int right_hand_pixel_value = static_cast<int>(*p); const int difference = right_hand_pixel_value - left_hand_pixel_value; const int histogram_index = difference + 255; @@ -714,12 +714,12 @@ double QuantizerEstimator::EstimateForDeltaFrame(const VideoFrame& frame) { const int row_skip = size.height() / rows_in_subset; int y = 0; for (int i = 0; i < rows_in_subset; ++i, y += row_skip) { - const uint8* const row_begin = frame.visible_data(VideoFrame::kYPlane) + - y * frame.stride(VideoFrame::kYPlane); - const uint8* const row_end = row_begin + size.width(); - uint8* const last_frame_row_begin = + const uint8_t* const row_begin = frame.visible_data(VideoFrame::kYPlane) + + y * frame.stride(VideoFrame::kYPlane); + const uint8_t* const row_end = row_begin + size.width(); + uint8_t* const last_frame_row_begin = last_frame_pixel_buffer_.get() + i * size.width(); - for (const uint8* p = row_begin, *q = last_frame_row_begin; p < row_end; + for (const uint8_t *p = row_begin, *q = last_frame_row_begin; p < row_end; ++p, ++q) { const int difference = static_cast<int>(*p) - static_cast<int>(*q); const int histogram_index = difference + 255; diff --git a/media/cast/sender/external_video_encoder.h b/media/cast/sender/external_video_encoder.h index 23e50e5..9ff1c1f 100644 --- a/media/cast/sender/external_video_encoder.h +++ b/media/cast/sender/external_video_encoder.h @@ -29,7 +29,7 @@ class ExternalVideoEncoder : public VideoEncoder { const scoped_refptr<CastEnvironment>& cast_environment, const VideoSenderConfig& video_config, const gfx::Size& frame_size, - uint32 first_frame_id, + uint32_t first_frame_id, const StatusChangeCallback& status_change_cb, const CreateVideoEncodeAcceleratorCallback& create_vea_cb, const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb); @@ -52,7 +52,7 @@ class ExternalVideoEncoder : public VideoEncoder { // |client_| holds a reference to the new VEAClientImpl. void OnCreateVideoEncodeAccelerator( const VideoSenderConfig& video_config, - uint32 first_frame_id, + uint32_t first_frame_id, const StatusChangeCallback& status_change_cb, scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner, scoped_ptr<media::VideoEncodeAccelerator> vea); @@ -149,7 +149,7 @@ class QuantizerEstimator { // A cache of a subset of rows of pixels from the last frame examined. This // is used to compute the entropy of the difference between frames, which in // turn is used to compute the entropy and quantizer. - scoped_ptr<uint8[]> last_frame_pixel_buffer_; + scoped_ptr<uint8_t[]> last_frame_pixel_buffer_; gfx::Size last_frame_size_; DISALLOW_COPY_AND_ASSIGN(QuantizerEstimator); diff --git a/media/cast/sender/external_video_encoder_unittest.cc b/media/cast/sender/external_video_encoder_unittest.cc index 78359f3..1004ba5 100644 --- a/media/cast/sender/external_video_encoder_unittest.cc +++ b/media/cast/sender/external_video_encoder_unittest.cc @@ -13,7 +13,7 @@ namespace cast { namespace { -scoped_refptr<VideoFrame> CreateFrame(const uint8* y_plane_data, +scoped_refptr<VideoFrame> CreateFrame(const uint8_t* y_plane_data, const gfx::Size& size) { scoped_refptr<VideoFrame> result = VideoFrame::CreateFrame(PIXEL_FORMAT_I420, size, @@ -35,7 +35,8 @@ TEST(QuantizerEstimator, EstimatesForTrivialFrames) { QuantizerEstimator qe; const gfx::Size frame_size(320, 180); - const scoped_ptr<uint8[]> black_frame_data(new uint8[frame_size.GetArea()]); + const scoped_ptr<uint8_t[]> black_frame_data( + new uint8_t[frame_size.GetArea()]); memset(black_frame_data.get(), 0, frame_size.GetArea()); const scoped_refptr<VideoFrame> black_frame = CreateFrame(black_frame_data.get(), frame_size); @@ -48,8 +49,8 @@ TEST(QuantizerEstimator, EstimatesForTrivialFrames) { for (int i = 0; i < 3; ++i) EXPECT_EQ(4.0, qe.EstimateForDeltaFrame(*black_frame)); - const scoped_ptr<uint8[]> checkerboard_frame_data( - new uint8[frame_size.GetArea()]); + const scoped_ptr<uint8_t[]> checkerboard_frame_data( + new uint8_t[frame_size.GetArea()]); for (int i = 0, end = frame_size.GetArea(); i < end; ++i) checkerboard_frame_data.get()[i] = (((i % 2) == 0) ? 0 : 255); const scoped_refptr<VideoFrame> checkerboard_frame = @@ -65,11 +66,11 @@ TEST(QuantizerEstimator, EstimatesForTrivialFrames) { // results in high quantizer estimates. for (int i = 0; i < 3; ++i) { int rand_seed = 0xdeadbeef + i; - const scoped_ptr<uint8[]> random_frame_data( - new uint8[frame_size.GetArea()]); + const scoped_ptr<uint8_t[]> random_frame_data( + new uint8_t[frame_size.GetArea()]); for (int j = 0, end = frame_size.GetArea(); j < end; ++j) { rand_seed = (1103515245 * rand_seed + 12345) % (1 << 31); - random_frame_data.get()[j] = static_cast<uint8>(rand_seed & 0xff); + random_frame_data.get()[j] = static_cast<uint8_t>(rand_seed & 0xff); } const scoped_refptr<VideoFrame> random_frame = CreateFrame(random_frame_data.get(), frame_size); diff --git a/media/cast/sender/fake_software_video_encoder.cc b/media/cast/sender/fake_software_video_encoder.cc index 3c33152..57fe249 100644 --- a/media/cast/sender/fake_software_video_encoder.cc +++ b/media/cast/sender/fake_software_video_encoder.cc @@ -70,7 +70,7 @@ void FakeSoftwareVideoEncoder::Encode( } } -void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) { +void FakeSoftwareVideoEncoder::UpdateRates(uint32_t new_bitrate) { frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; } diff --git a/media/cast/sender/fake_software_video_encoder.h b/media/cast/sender/fake_software_video_encoder.h index 39c0344..d6a6f54 100644 --- a/media/cast/sender/fake_software_video_encoder.h +++ b/media/cast/sender/fake_software_video_encoder.h @@ -22,14 +22,14 @@ class FakeSoftwareVideoEncoder : public SoftwareVideoEncoder { void Encode(const scoped_refptr<media::VideoFrame>& video_frame, const base::TimeTicks& reference_time, SenderEncodedFrame* encoded_frame) final; - void UpdateRates(uint32 new_bitrate) final; + void UpdateRates(uint32_t new_bitrate) final; void GenerateKeyFrame() final; private: VideoSenderConfig video_config_; gfx::Size last_frame_size_; bool next_frame_is_key_; - uint32 frame_id_; + uint32_t frame_id_; int frame_size_; }; diff --git a/media/cast/sender/h264_vt_encoder.cc b/media/cast/sender/h264_vt_encoder.cc index c9f9330..30f968f 100644 --- a/media/cast/sender/h264_vt_encoder.cc +++ b/media/cast/sender/h264_vt_encoder.cc @@ -725,7 +725,7 @@ void H264VideoToolboxEncoder::CompressionCallback(void* encoder_opaque, // Increment the encoder-scoped frame id and assign the new value to this // frame. VideoToolbox calls the output callback serially, so this is safe. - const uint32 frame_id = ++encoder->last_frame_id_; + const uint32_t frame_id = ++encoder->last_frame_id_; scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); encoded_frame->frame_id = frame_id; diff --git a/media/cast/sender/h264_vt_encoder.h b/media/cast/sender/h264_vt_encoder.h index a152b0a..15318bf 100644 --- a/media/cast/sender/h264_vt_encoder.h +++ b/media/cast/sender/h264_vt_encoder.h @@ -112,7 +112,7 @@ class H264VideoToolboxEncoder : public VideoEncoder, scoped_refptr<VideoFrameFactoryImpl> video_frame_factory_; // The ID of the last frame that was emitted. - uint32 last_frame_id_; + uint32_t last_frame_id_; // Force next frame to be a keyframe. bool encode_next_frame_as_keyframe_; diff --git a/media/cast/sender/h264_vt_encoder_unittest.cc b/media/cast/sender/h264_vt_encoder_unittest.cc index 19dd3d1..fac070d 100644 --- a/media/cast/sender/h264_vt_encoder_unittest.cc +++ b/media/cast/sender/h264_vt_encoder_unittest.cc @@ -84,9 +84,9 @@ class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> { int count_frames_delivered() const { return count_frames_delivered_; } - void PushExpectation(uint32 expected_frame_id, - uint32 expected_last_referenced_frame_id, - uint32 expected_rtp_timestamp, + void PushExpectation(uint32_t expected_frame_id, + uint32_t expected_last_referenced_frame_id, + uint32_t expected_rtp_timestamp, const base::TimeTicks& expected_reference_time) { expectations_.push(Expectation{expected_frame_id, expected_last_referenced_frame_id, @@ -120,9 +120,9 @@ class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> { int count_frames_delivered_; struct Expectation { - uint32 expected_frame_id; - uint32 expected_last_referenced_frame_id; - uint32 expected_rtp_timestamp; + uint32_t expected_frame_id; + uint32_t expected_last_referenced_frame_id; + uint32_t expected_rtp_timestamp; base::TimeTicks expected_reference_time; }; std::queue<Expectation> expectations_; @@ -292,7 +292,7 @@ TEST_F(H264VideoToolboxEncoderTest, CheckFrameMetadataSequence) { EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb)); message_loop_.RunUntilIdle(); - for (uint32 frame_id = 1; frame_id < 10; ++frame_id) { + for (uint32_t frame_id = 1; frame_id < 10; ++frame_id) { AdvanceClockAndVideoFrameTimestamp(); metadata_recorder->PushExpectation( frame_id, frame_id - 1, @@ -317,7 +317,7 @@ TEST_F(H264VideoToolboxEncoderTest, CheckFramesAreDecodable) { VideoEncoder::FrameEncodedCallback cb = base::Bind(&EndToEndFrameChecker::EncodeDone, checker.get()); - for (uint32 frame_id = 0; frame_id < 6; ++frame_id) { + for (uint32_t frame_id = 0; frame_id < 6; ++frame_id) { checker->PushExpectation(frame_); EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb)); AdvanceClockAndVideoFrameTimestamp(); diff --git a/media/cast/sender/performance_metrics_overlay.cc b/media/cast/sender/performance_metrics_overlay.cc index 842bdf1..dfa2f21 100644 --- a/media/cast/sender/performance_metrics_overlay.cc +++ b/media/cast/sender/performance_metrics_overlay.cc @@ -29,7 +29,7 @@ const int kPlane = 0; // Y-plane in YUV formats. // different value than it did before. |p_ul| is a pointer to the pixel at // coordinate (0,0) in a single-channel 8bpp bitmap. |stride| is the number of // bytes per row in the output bitmap. -void DivergePixels(const gfx::Rect& rect, uint8* p_ul, int stride) { +void DivergePixels(const gfx::Rect& rect, uint8_t* p_ul, int stride) { DCHECK(p_ul); DCHECK_GT(stride, 0); @@ -52,14 +52,14 @@ void DivergePixels(const gfx::Rect& rect, uint8* p_ul, int stride) { const int left = rect.x() * kScale; const int right = rect.right() * kScale; for (int y = top; y < bottom; ++y) { - uint8* const p_l = p_ul + y * stride; + uint8_t* const p_l = p_ul + y * stride; for (int x = left; x < right; ++x) { int intensity = p_l[x]; if (intensity >= kDivergeDownThreshold) intensity = std::max(kMinIntensity, intensity - kDivergeDownAmount); else intensity += kDivergeUpAmount; - p_l[x] = static_cast<uint8>(intensity); + p_l[x] = static_cast<uint8_t>(intensity); } } } @@ -84,7 +84,7 @@ void RenderLineOfText(const std::string& line, int top, VideoFrame* frame) { // Compute the pointer to the pixel at the upper-left corner of the first // character to be rendered. const int stride = frame->stride(kPlane); - uint8* p_ul = + uint8_t* p_ul = // Start at the first pixel in the first row... frame->visible_data(kPlane) + (stride * top) // ...now move to the right edge of the visible part of the frame... diff --git a/media/cast/sender/size_adaptable_video_encoder_base.h b/media/cast/sender/size_adaptable_video_encoder_base.h index 237e3ab..a450a99 100644 --- a/media/cast/sender/size_adaptable_video_encoder_base.h +++ b/media/cast/sender/size_adaptable_video_encoder_base.h @@ -52,9 +52,7 @@ class SizeAdaptableVideoEncoderBase : public VideoEncoder { const gfx::Size& frame_size() const { return frame_size_; } - uint32 last_frame_id() const { - return last_frame_id_; - } + uint32_t last_frame_id() const { return last_frame_id_; } // Returns a callback that calls OnEncoderStatusChange(). The callback is // canceled by invalidating its bound weak pointer just before a replacement @@ -106,7 +104,7 @@ class SizeAdaptableVideoEncoderBase : public VideoEncoder { int frames_in_encoder_; // The ID of the last frame that was emitted from |encoder_|. - uint32 last_frame_id_; + uint32_t last_frame_id_; // NOTE: Weak pointers must be invalidated before all other member variables. base::WeakPtrFactory<SizeAdaptableVideoEncoderBase> weak_factory_; diff --git a/media/cast/sender/software_video_encoder.h b/media/cast/sender/software_video_encoder.h index 98cdf4b..acf96e3 100644 --- a/media/cast/sender/software_video_encoder.h +++ b/media/cast/sender/software_video_encoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CAST_SENDER_SOFTWARE_VIDEO_ENCODER_H_ #define MEDIA_CAST_SENDER_SOFTWARE_VIDEO_ENCODER_H_ -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/cast/sender/sender_encoded_frame.h" @@ -34,7 +33,7 @@ class SoftwareVideoEncoder { SenderEncodedFrame* encoded_frame) = 0; // Update the encoder with a new target bit rate. - virtual void UpdateRates(uint32 new_bitrate) = 0; + virtual void UpdateRates(uint32_t new_bitrate) = 0; // Set the next frame to be a key frame. virtual void GenerateKeyFrame() = 0; diff --git a/media/cast/sender/video_encoder_unittest.cc b/media/cast/sender/video_encoder_unittest.cc index e308fc4..63f694e 100644 --- a/media/cast/sender/video_encoder_unittest.cc +++ b/media/cast/sender/video_encoder_unittest.cc @@ -165,8 +165,8 @@ class VideoEncoderTest // encoder rejected the request. bool EncodeAndCheckDelivery( const scoped_refptr<media::VideoFrame>& video_frame, - uint32 frame_id, - uint32 reference_frame_id) { + uint32_t frame_id, + uint32_t reference_frame_id) { return video_encoder_->EncodeVideoFrame( video_frame, Now(), @@ -213,12 +213,11 @@ class VideoEncoderTest // Checks that |encoded_frame| matches expected values. This is the method // bound in the callback returned from EncodeAndCheckDelivery(). - void DeliverEncodedVideoFrame( - uint32 expected_frame_id, - uint32 expected_last_referenced_frame_id, - uint32 expected_rtp_timestamp, - const base::TimeTicks& expected_reference_time, - scoped_ptr<SenderEncodedFrame> encoded_frame) { + void DeliverEncodedVideoFrame(uint32_t expected_frame_id, + uint32_t expected_last_referenced_frame_id, + uint32_t expected_rtp_timestamp, + const base::TimeTicks& expected_reference_time, + scoped_ptr<SenderEncodedFrame> encoded_frame) { EXPECT_TRUE(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); EXPECT_EQ(expected_frame_id, encoded_frame->frame_id); @@ -285,8 +284,8 @@ TEST_P(VideoEncoderTest, GeneratesKeyFrameThenOnlyDeltaFrames) { EXPECT_EQ(0, count_frames_delivered()); ExpectVEAResponsesForExternalVideoEncoder(0, 0); - uint32 frame_id = 0; - uint32 reference_frame_id = 0; + uint32_t frame_id = 0; + uint32_t reference_frame_id = 0; const gfx::Size frame_size(1280, 720); // Some encoders drop one or more frames initially while the encoder @@ -337,7 +336,7 @@ TEST_P(VideoEncoderTest, EncodesVariedFrameSizes) { frame_sizes.push_back(gfx::Size(322, 182)); // Grow the other dimension. frame_sizes.push_back(gfx::Size(1920, 1080)); // Grow both dimensions again. - uint32 frame_id = 0; + uint32_t frame_id = 0; // Encode one frame at each size. For encoders with a resize delay, except no // frames to be delivered since each frame size change will sprun diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc index be77ec3..0209962 100644 --- a/media/cast/sender/video_sender.cc +++ b/media/cast/sender/video_sender.cc @@ -288,7 +288,7 @@ int VideoSender::GetNumberOfFramesInEncoder() const { base::TimeDelta VideoSender::GetInFlightMediaDuration() const { if (GetUnacknowledgedFrameCount() > 0) { - const uint32 oldest_unacked_frame_id = latest_acked_frame_id_ + 1; + const uint32_t oldest_unacked_frame_id = latest_acked_frame_id_ + 1; return last_enqueued_frame_reference_time_ - GetRecordedReferenceTime(oldest_unacked_frame_id); } else { @@ -328,7 +328,7 @@ int VideoSender::GetMaximumTargetBitrateForFrame( static_cast<int>(sqrt(resolution.GetArea() * 9.0 / 16.0)); // Linearly translate from |lines_of_resolution| to a maximum target bitrate. - int64 result = lines_of_resolution - STANDARD_RESOLUTION_LINES; + int64_t result = lines_of_resolution - STANDARD_RESOLUTION_LINES; result *= BITRATE_FOR_HIGH_RESOLUTION - BITRATE_FOR_STANDARD_RESOLUTION; result /= HIGH_RESOLUTION_LINES - STANDARD_RESOLUTION_LINES; result += BITRATE_FOR_STANDARD_RESOLUTION; diff --git a/media/cast/sender/video_sender_unittest.cc b/media/cast/sender/video_sender_unittest.cc index 60f15a5..af271da 100644 --- a/media/cast/sender/video_sender_unittest.cc +++ b/media/cast/sender/video_sender_unittest.cc @@ -30,7 +30,7 @@ namespace media { namespace cast { namespace { -static const uint8 kPixelValue = 123; +static const uint8_t kPixelValue = 123; static const int kWidth = 320; static const int kHeight = 240; @@ -73,7 +73,7 @@ class TestPacketSender : public PacketSender { return true; } - int64 GetBytesSent() final { return 0; } + int64_t GetBytesSent() final { return 0; } int number_of_rtp_packets() const { return number_of_rtp_packets_; } @@ -126,12 +126,8 @@ class PeerVideoSender : public VideoSender { scoped_refptr<VideoFrame> CreateFakeFrame(const gfx::Size& resolution, bool high_frame_rate_in_metadata) { const scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalData( - PIXEL_FORMAT_I420, - resolution, - gfx::Rect(resolution), - resolution, - static_cast<uint8*>(nullptr) + 1, - resolution.GetArea() * 3 / 2, + PIXEL_FORMAT_I420, resolution, gfx::Rect(resolution), resolution, + static_cast<uint8_t*>(nullptr) + 1, resolution.GetArea() * 3 / 2, base::TimeDelta()); const double frame_rate = high_frame_rate_in_metadata ? 60.0 : 30.0; frame->metadata()->SetTimeDelta( diff --git a/media/cast/sender/vp8_encoder.cc b/media/cast/sender/vp8_encoder.cc index a7298e7..bcb1378 100644 --- a/media/cast/sender/vp8_encoder.cc +++ b/media/cast/sender/vp8_encoder.cc @@ -229,8 +229,8 @@ void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame, TimeDeltaToRtpDelta(video_frame->timestamp(), kVideoFrequency); encoded_frame->reference_time = reference_time; encoded_frame->data.assign( - static_cast<const uint8*>(pkt->data.frame.buf), - static_cast<const uint8*>(pkt->data.frame.buf) + pkt->data.frame.sz); + static_cast<const uint8_t*>(pkt->data.frame.buf), + static_cast<const uint8_t*>(pkt->data.frame.buf) + pkt->data.frame.sz); break; // Done, since all data is provided in one CX_FRAME_PKT packet. } DCHECK(!encoded_frame->data.empty()) @@ -291,13 +291,13 @@ void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame, } } -void Vp8Encoder::UpdateRates(uint32 new_bitrate) { +void Vp8Encoder::UpdateRates(uint32_t new_bitrate) { DCHECK(thread_checker_.CalledOnValidThread()); if (!is_initialized()) return; - uint32 new_bitrate_kbit = new_bitrate / 1000; + uint32_t new_bitrate_kbit = new_bitrate / 1000; if (config_.rc_target_bitrate == new_bitrate_kbit) return; diff --git a/media/cast/sender/vp8_encoder.h b/media/cast/sender/vp8_encoder.h index c3d985f..ffb95e22 100644 --- a/media/cast/sender/vp8_encoder.h +++ b/media/cast/sender/vp8_encoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ #define MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "media/cast/cast_config.h" @@ -31,7 +30,7 @@ class Vp8Encoder : public SoftwareVideoEncoder { void Encode(const scoped_refptr<media::VideoFrame>& video_frame, const base::TimeTicks& reference_time, SenderEncodedFrame* encoded_frame) final; - void UpdateRates(uint32 new_bitrate) final; + void UpdateRates(uint32_t new_bitrate) final; void GenerateKeyFrame() final; private: @@ -66,7 +65,7 @@ class Vp8Encoder : public SoftwareVideoEncoder { base::TimeDelta last_frame_timestamp_; // The last encoded frame's ID. - uint32 last_encoded_frame_id_; + uint32_t last_encoded_frame_id_; // This is bound to the thread where Initialize() is called. base::ThreadChecker thread_checker_; diff --git a/media/cast/sender/vp8_quantizer_parser.cc b/media/cast/sender/vp8_quantizer_parser.cc index 167e7cc..0646efd 100644 --- a/media/cast/sender/vp8_quantizer_parser.cc +++ b/media/cast/sender/vp8_quantizer_parser.cc @@ -19,7 +19,7 @@ namespace { // necessary parts being exported. class Vp8BitReader { public: - Vp8BitReader(const uint8* data, size_t size) + Vp8BitReader(const uint8_t* data, size_t size) : encoded_data_(data), encoded_data_end_(data + size) { Vp8DecoderReadBytes(); } @@ -34,8 +34,8 @@ class Vp8BitReader { // Read new bytes frome the encoded data buffer until |bit_count_| > 0. void Vp8DecoderReadBytes(); - const uint8* encoded_data_; // Current byte to decode. - const uint8* const encoded_data_end_; // The end of the byte to decode. + const uint8_t* encoded_data_; // Current byte to decode. + const uint8_t* const encoded_data_end_; // The end of the byte to decode. // The following two variables are maintained by the decoder. // General decoding rule: // If |value_| is in the range of 0 to half of |range_|, output 0. @@ -53,7 +53,7 @@ class Vp8BitReader { }; // The number of bits to be left-shifted to make the variable range_ over 128. -const uint8 vp8_shift[128] = { +const uint8_t vp8_shift[128] = { 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, @@ -62,7 +62,7 @@ const uint8 vp8_shift[128] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // Mapping from the q_index(0-127) to the quantizer value(0-63). -const uint8 vp8_quantizer_lookup[128] = { +const uint8_t vp8_quantizer_lookup[128] = { 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, @@ -167,7 +167,7 @@ void ParseFilterHeader(Vp8BitReader* bit_reader) { } } // unnamed namespace -int ParseVp8HeaderQuantizer(const uint8* encoded_data, size_t size) { +int ParseVp8HeaderQuantizer(const uint8_t* encoded_data, size_t size) { DCHECK(encoded_data); if (size <= 3) { return -1; @@ -198,7 +198,7 @@ int ParseVp8HeaderQuantizer(const uint8* encoded_data, size_t size) { // Parse the number of coefficient data partitions. bit_reader.DecodeValue(2); // Parse the base q_index. - uint8 q_index = static_cast<uint8>(bit_reader.DecodeValue(7)); + uint8_t q_index = static_cast<uint8_t>(bit_reader.DecodeValue(7)); if (q_index > 127) { return 63; } diff --git a/media/cast/sender/vp8_quantizer_parser.h b/media/cast/sender/vp8_quantizer_parser.h index abd0d5e..09b222b 100644 --- a/media/cast/sender/vp8_quantizer_parser.h +++ b/media/cast/sender/vp8_quantizer_parser.h @@ -12,7 +12,7 @@ namespace cast { // Partially parse / skip data in the header and the first partition, // and return the base quantizer in the range [0,63], or -1 on parse error. -int ParseVp8HeaderQuantizer(const uint8* data, size_t size); +int ParseVp8HeaderQuantizer(const uint8_t* data, size_t size); } // namespace cast } // namespace media diff --git a/media/cast/sender/vp8_quantizer_parser_unittest.cc b/media/cast/sender/vp8_quantizer_parser_unittest.cc index f028264..1c83cb1 100644 --- a/media/cast/sender/vp8_quantizer_parser_unittest.cc +++ b/media/cast/sender/vp8_quantizer_parser_unittest.cc @@ -84,14 +84,14 @@ class Vp8QuantizerParserTest : public ::testing::Test { TEST_F(Vp8QuantizerParserTest, InsufficientData) { for (int i = 0; i < 3; ++i) { scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); - const uint8* encoded_data = - reinterpret_cast<const uint8*>(encoded_frame->data.data()); + const uint8_t* encoded_data = + reinterpret_cast<const uint8_t*>(encoded_frame->data.data()); // Null input. int decoded_quantizer = ParseVp8HeaderQuantizer(encoded_data, encoded_frame->data.size()); EXPECT_EQ(-1, decoded_quantizer); EncodeOneFrame(encoded_frame.get()); - encoded_data = reinterpret_cast<const uint8*>(encoded_frame->data.data()); + encoded_data = reinterpret_cast<const uint8_t*>(encoded_frame->data.data()); // Zero bytes should not be enough to decode the quantizer value. decoded_quantizer = ParseVp8HeaderQuantizer(encoded_data, 0); EXPECT_EQ(-1, decoded_quantizer); @@ -136,7 +136,7 @@ TEST_F(Vp8QuantizerParserTest, VariedQuantizer) { scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); EncodeOneFrame(encoded_frame.get()); decoded_quantizer = ParseVp8HeaderQuantizer( - reinterpret_cast<const uint8*>(encoded_frame->data.data()), + reinterpret_cast<const uint8_t*>(encoded_frame->data.data()), encoded_frame->data.size()); EXPECT_EQ(qp, decoded_quantizer); } diff --git a/media/cast/test/cast_benchmarks.cc b/media/cast/test/cast_benchmarks.cc index 19d5edf..81d0263 100644 --- a/media/cast/test/cast_benchmarks.cc +++ b/media/cast/test/cast_benchmarks.cc @@ -67,7 +67,7 @@ namespace cast { namespace { -static const int64 kStartMillisecond = INT64_C(1245); +static const int64_t kStartMillisecond = INT64_C(1245); static const int kTargetPlayoutDelayMs = 400; void UpdateCastTransportStatus(CastTransportStatus status) { @@ -95,8 +95,8 @@ class CastTransportSenderWrapper : public CastTransportSender { public: // Takes ownership of |transport|. void Init(CastTransportSender* transport, - uint64* encoded_video_bytes, - uint64* encoded_audio_bytes) { + uint64_t* encoded_video_bytes, + uint64_t* encoded_audio_bytes) { transport_.reset(transport); encoded_video_bytes_ = encoded_video_bytes; encoded_audio_bytes_ = encoded_audio_bytes; @@ -116,7 +116,7 @@ class CastTransportSenderWrapper : public CastTransportSender { transport_->InitializeVideo(config, cast_message_cb, rtt_cb); } - void InsertFrame(uint32 ssrc, const EncodedFrame& frame) final { + void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final { if (ssrc == audio_ssrc_) { *encoded_audio_bytes_ += frame.data.size(); } else if (ssrc == video_ssrc_) { @@ -125,20 +125,20 @@ class CastTransportSenderWrapper : public CastTransportSender { transport_->InsertFrame(ssrc, frame); } - void SendSenderReport(uint32 ssrc, + void SendSenderReport(uint32_t ssrc, base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp) final { + uint32_t current_time_as_rtp_timestamp) final { transport_->SendSenderReport(ssrc, current_time, current_time_as_rtp_timestamp); } - void CancelSendingFrames(uint32 ssrc, - const std::vector<uint32>& frame_ids) final { + void CancelSendingFrames(uint32_t ssrc, + const std::vector<uint32_t>& frame_ids) final { transport_->CancelSendingFrames(ssrc, frame_ids); } - void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) final { + void ResendFrameForKickstart(uint32_t ssrc, uint32_t frame_id) final { transport_->ResendFrameForKickstart(ssrc, frame_id); } @@ -146,13 +146,13 @@ class CastTransportSenderWrapper : public CastTransportSender { return transport_->PacketReceiverForTesting(); } - void AddValidSsrc(uint32 ssrc) final { + void AddValidSsrc(uint32_t ssrc) final { return transport_->AddValidSsrc(ssrc); } void SendRtcpFromRtpReceiver( - uint32 ssrc, - uint32 sender_ssrc, + uint32_t ssrc, + uint32_t sender_ssrc, const RtcpTimeData& time_data, const RtcpCastMessage* cast_message, base::TimeDelta target_delay, @@ -169,9 +169,9 @@ class CastTransportSenderWrapper : public CastTransportSender { private: scoped_ptr<CastTransportSender> transport_; - uint32 audio_ssrc_, video_ssrc_; - uint64* encoded_video_bytes_; - uint64* encoded_audio_bytes_; + uint32_t audio_ssrc_, video_ssrc_; + uint64_t* encoded_video_bytes_; + uint64_t* encoded_audio_bytes_; }; struct MeasuringPoint { @@ -490,8 +490,8 @@ class RunOneBenchmark { LoopBackTransport sender_to_receiver_; CastTransportSenderWrapper transport_sender_; scoped_ptr<CastTransportSender> transport_receiver_; - uint64 video_bytes_encoded_; - uint64 audio_bytes_encoded_; + uint64_t video_bytes_encoded_; + uint64_t audio_bytes_encoded_; scoped_ptr<CastReceiver> cast_receiver_; scoped_ptr<CastSender> cast_sender_; diff --git a/media/cast/test/end2end_unittest.cc b/media/cast/test/end2end_unittest.cc index 3228075..015833d 100644 --- a/media/cast/test/end2end_unittest.cc +++ b/media/cast/test/end2end_unittest.cc @@ -47,7 +47,7 @@ namespace cast { namespace { -static const int64 kStartMillisecond = INT64_C(1245); +static const int64_t kStartMillisecond = INT64_C(1245); static const int kAudioChannels = 2; static const double kSoundFrequency = 314.15926535897; // Freq of sine wave. static const float kSoundVolume = 0.5f; @@ -87,7 +87,7 @@ std::string ConvertFromBase16String(const std::string& base_16) { DCHECK_EQ(base_16.size() % 2, 0u) << "Must be a multiple of 2"; compressed.reserve(base_16.size() / 2); - std::vector<uint8> v; + std::vector<uint8_t> v; if (!base::HexStringToBytes(base_16, &v)) { NOTREACHED(); } @@ -135,13 +135,13 @@ std::map<RtpTimestamp, LoggingEventCounts> GetEventCountForFrameEvents( // Constructs a map from each packet (Packet ID) to counts of each event // type logged for that packet. -std::map<uint16, LoggingEventCounts> GetEventCountForPacketEvents( +std::map<uint16_t, LoggingEventCounts> GetEventCountForPacketEvents( const std::vector<PacketEvent>& packet_events) { - std::map<uint16, LoggingEventCounts> event_counter_for_packet; + std::map<uint16_t, LoggingEventCounts> event_counter_for_packet; for (std::vector<PacketEvent>::const_iterator it = packet_events.begin(); it != packet_events.end(); ++it) { - std::map<uint16, LoggingEventCounts>::iterator map_it = + std::map<uint16_t, LoggingEventCounts>::iterator map_it = event_counter_for_packet.find(it->packet_id); if (map_it == event_counter_for_packet.end()) { LoggingEventCounts new_counter; @@ -210,7 +210,7 @@ class LoopBackTransport : public PacketSender { bytes_sent_ += packet->data.size(); if (drop_packets_belonging_to_odd_frames_) { - uint32 frame_id = packet->data[13]; + uint32_t frame_id = packet->data[13]; if (frame_id % 2 == 1) return true; } @@ -220,7 +220,7 @@ class LoopBackTransport : public PacketSender { return true; } - int64 GetBytesSent() final { return bytes_sent_; } + int64_t GetBytesSent() final { return bytes_sent_; } void SetSendPackets(bool send_packets) { send_packets_ = send_packets; } @@ -239,7 +239,7 @@ class LoopBackTransport : public PacketSender { bool drop_packets_belonging_to_odd_frames_; scoped_refptr<CastEnvironment> cast_environment_; scoped_ptr<test::PacketPipe> packet_pipe_; - int64 bytes_sent_; + int64_t bytes_sent_; }; // Class that verifies the audio frames coming out of the receiver. @@ -316,20 +316,20 @@ class TestReceiverAudioCallback // Note: Just peeking here. Will delegate to CheckAudioFrame() to pop. // We need to "decode" the encoded audio frame. The codec is simply to - // swizzle the bytes of each int16 from host-->network-->host order to get - // interleaved int16 PCM. Then, make an AudioBus out of that. - const int num_elements = audio_frame->data.size() / sizeof(int16); + // swizzle the bytes of each int16_t from host-->network-->host order to get + // interleaved int16_t PCM. Then, make an AudioBus out of that. + const int num_elements = audio_frame->data.size() / sizeof(int16_t); ASSERT_EQ(expected_audio_frame.audio_bus->channels() * expected_audio_frame.audio_bus->frames(), num_elements); - int16* const pcm_data = - reinterpret_cast<int16*>(audio_frame->mutable_bytes()); + int16_t* const pcm_data = + reinterpret_cast<int16_t*>(audio_frame->mutable_bytes()); for (int i = 0; i < num_elements; ++i) - pcm_data[i] = static_cast<int16>(base::NetToHost16(pcm_data[i])); + pcm_data[i] = static_cast<int16_t>(base::NetToHost16(pcm_data[i])); scoped_ptr<AudioBus> audio_bus( AudioBus::Create(expected_audio_frame.audio_bus->channels(), expected_audio_frame.audio_bus->frames())); - audio_bus->FromInterleaved(pcm_data, audio_bus->frames(), sizeof(int16)); + audio_bus->FromInterleaved(pcm_data, audio_bus->frames(), sizeof(int16_t)); // Delegate the checking from here... CheckAudioFrame(audio_bus.Pass(), audio_frame->reference_time, true); @@ -1129,14 +1129,13 @@ TEST_F(End2EndTest, VideoLogging) { // Packet logging. // Verify that all packet related events were logged. event_subscriber_sender_.GetPacketEventsAndReset(&packet_events_); - std::map<uint16, LoggingEventCounts> event_count_for_packet = + std::map<uint16_t, LoggingEventCounts> event_count_for_packet = GetEventCountForPacketEvents(packet_events_); // Verify that each packet have the expected types of events logged. - for (std::map<uint16, LoggingEventCounts>::iterator map_it = + for (std::map<uint16_t, LoggingEventCounts>::iterator map_it = event_count_for_packet.begin(); - map_it != event_count_for_packet.end(); - ++map_it) { + map_it != event_count_for_packet.end(); ++map_it) { int total_event_count_for_packet = 0; for (int i = 0; i <= kNumOfLoggingEvents; ++i) { total_event_count_for_packet += map_it->second.counter[i]; @@ -1432,8 +1431,8 @@ TEST_F(End2EndTest, TestSetPlayoutDelay) { RunTasks(100 * kFrameTimerMs + 1); // Empty the pipeline. size_t jump = 0; for (size_t i = 1; i < video_ticks_.size(); i++) { - int64 delta = (video_ticks_[i].second - - video_ticks_[i-1].second).InMilliseconds(); + int64_t delta = + (video_ticks_[i].second - video_ticks_[i - 1].second).InMilliseconds(); if (delta > 100) { EXPECT_EQ(kNewDelay - kTargetPlayoutDelayMs + kFrameTimerMs, delta); EXPECT_EQ(0u, jump); diff --git a/media/cast/test/fake_media_source.cc b/media/cast/test/fake_media_source.cc index 24327d0..3c7a8e0 100644 --- a/media/cast/test/fake_media_source.cc +++ b/media/cast/test/fake_media_source.cc @@ -45,14 +45,13 @@ void AVFreeFrame(AVFrame* frame) { av_frame_free(&frame); } -base::TimeDelta PtsToTimeDelta(int64 pts, const AVRational& time_base) { +base::TimeDelta PtsToTimeDelta(int64_t pts, const AVRational& time_base) { return pts * base::TimeDelta::FromSeconds(1) * time_base.num / time_base.den; } -int64 TimeDeltaToPts(base::TimeDelta delta, const AVRational& time_base) { - return static_cast<int64>( - delta.InSecondsF() * time_base.den / time_base.num + - 0.5 /* rounding */); +int64_t TimeDeltaToPts(base::TimeDelta delta, const AVRational& time_base) { + return static_cast<int64_t>( + delta.InSecondsF() * time_base.den / time_base.num + 0.5 /* rounding */); } } // namespace @@ -542,7 +541,7 @@ void FakeMediaSource::DecodeVideo(ScopedAVPacket packet) { const AVRational& frame_rate = av_video_stream()->r_frame_rate; timestamp = last_video_frame_timestamp_ + (base::TimeDelta::FromSeconds(1) * frame_rate.den / frame_rate.num); - const int64 adjustment_pts = TimeDeltaToPts(timestamp, time_base); + const int64_t adjustment_pts = TimeDeltaToPts(timestamp, time_base); video_first_pts_ = avframe->pkt_pts - adjustment_pts; } diff --git a/media/cast/test/fake_media_source.h b/media/cast/test/fake_media_source.h index 3ca55a0..af100aa 100644 --- a/media/cast/test/fake_media_source.h +++ b/media/cast/test/fake_media_source.h @@ -121,7 +121,7 @@ class FakeMediaSource : public media::AudioConverter::InputCallback { base::TimeTicks next_frame_size_change_time_; scoped_refptr<AudioFrameInput> audio_frame_input_; scoped_refptr<VideoFrameInput> video_frame_input_; - uint8 synthetic_count_; + uint8_t synthetic_count_; base::TickClock* const clock_; // Not owned by this class. // Time when the stream starts. @@ -156,7 +156,7 @@ class FakeMediaSource : public media::AudioConverter::InputCallback { std::queue<scoped_refptr<VideoFrame> > video_frame_queue_; std::queue<scoped_refptr<VideoFrame> > inserted_video_frame_queue_; - int64 video_first_pts_; + int64_t video_first_pts_; bool video_first_pts_set_; base::TimeDelta last_video_frame_timestamp_; diff --git a/media/cast/test/fake_single_thread_task_runner.h b/media/cast/test/fake_single_thread_task_runner.h index c6fb02e..bae0507 100644 --- a/media/cast/test/fake_single_thread_task_runner.h +++ b/media/cast/test/fake_single_thread_task_runner.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/single_thread_task_runner.h" #include "base/test/simple_test_tick_clock.h" #include "base/test/test_pending_task.h" diff --git a/media/cast/test/loopback_transport.cc b/media/cast/test/loopback_transport.cc index 7c71d58..fe1b78a8 100644 --- a/media/cast/test/loopback_transport.cc +++ b/media/cast/test/loopback_transport.cc @@ -53,7 +53,7 @@ bool LoopBackTransport::SendPacket(PacketRef packet, return true; } -int64 LoopBackTransport::GetBytesSent() { +int64_t LoopBackTransport::GetBytesSent() { return bytes_sent_; } diff --git a/media/cast/test/loopback_transport.h b/media/cast/test/loopback_transport.h index 478004c..52eeb47 100644 --- a/media/cast/test/loopback_transport.h +++ b/media/cast/test/loopback_transport.h @@ -31,7 +31,7 @@ class LoopBackTransport : public PacketSender { bool SendPacket(PacketRef packet, const base::Closure& cb) final; - int64 GetBytesSent() final; + int64_t GetBytesSent() final; // Initiailize this loopback transport. // Establish a flow of packets from |pipe| to |packet_receiver|. @@ -50,7 +50,7 @@ class LoopBackTransport : public PacketSender { private: const scoped_refptr<CastEnvironment> cast_environment_; scoped_ptr<test::PacketPipe> packet_pipe_; - int64 bytes_sent_; + int64_t bytes_sent_; DISALLOW_COPY_AND_ASSIGN(LoopBackTransport); }; diff --git a/media/cast/test/receiver.cc b/media/cast/test/receiver.cc index ed069b6..94eb86c 100644 --- a/media/cast/test/receiver.cc +++ b/media/cast/test/receiver.cc @@ -65,14 +65,14 @@ const char* kVideoWindowWidth = "1280"; const char* kVideoWindowHeight = "720"; #endif // defined(USE_X11) -void GetPorts(uint16* tx_port, uint16* rx_port) { +void GetPorts(uint16_t* tx_port, uint16_t* rx_port) { test::InputBuilder tx_input( "Enter send port.", DEFAULT_SEND_PORT, 1, 65535); - *tx_port = static_cast<uint16>(tx_input.GetIntInput()); + *tx_port = static_cast<uint16_t>(tx_input.GetIntInput()); test::InputBuilder rx_input( "Enter receive port.", DEFAULT_RECEIVE_PORT, 1, 65535); - *rx_port = static_cast<uint16>(rx_input.GetIntInput()); + *rx_port = static_cast<uint16_t>(rx_input.GetIntInput()); } std::string GetIpAddress(const std::string& display_text) { @@ -273,10 +273,10 @@ class NaivePlayer : public InProcessReceiver, << "Video: Discontinuity in received frames."; video_playout_queue_.push_back(std::make_pair(playout_time, video_frame)); ScheduleVideoPlayout(); - uint16 frame_no; + uint16_t frame_no; if (media::cast::test::DecodeBarcode(video_frame, &frame_no)) { video_play_times_.insert( - std::pair<uint16, base::TimeTicks>(frame_no, playout_time)); + std::pair<uint16_t, base::TimeTicks>(frame_no, playout_time)); } else { VLOG(2) << "Barcode decode failed!"; } @@ -289,7 +289,7 @@ class NaivePlayer : public InProcessReceiver, LOG_IF(WARNING, !is_continuous) << "Audio: Discontinuity in received frames."; base::AutoLock auto_lock(audio_lock_); - uint16 frame_no; + uint16_t frame_no; if (media::cast::DecodeTimestamp(audio_frame->channel(0), audio_frame->frames(), &frame_no)) { @@ -299,7 +299,7 @@ class NaivePlayer : public InProcessReceiver, // that we already missed the first one. if (is_continuous && frame_no == last_audio_frame_no_ + 1) { audio_play_times_.insert( - std::pair<uint16, base::TimeTicks>(frame_no, playout_time)); + std::pair<uint16_t, base::TimeTicks>(frame_no, playout_time)); } last_audio_frame_no_ = frame_no; } else { @@ -476,7 +476,7 @@ class NaivePlayer : public InProcessReceiver, audio_play_times_.size() > 30) { size_t num_events = 0; base::TimeDelta delta; - std::map<uint16, base::TimeTicks>::iterator audio_iter, video_iter; + std::map<uint16_t, base::TimeTicks>::iterator audio_iter, video_iter; for (video_iter = video_play_times_.begin(); video_iter != video_play_times_.end(); ++video_iter) { @@ -517,7 +517,7 @@ class NaivePlayer : public InProcessReceiver, VideoQueueEntry; std::deque<VideoQueueEntry> video_playout_queue_; base::TimeTicks last_popped_video_playout_time_; - int64 num_video_frames_processed_; + int64_t num_video_frames_processed_; base::OneShotTimer video_playout_timer_; @@ -526,15 +526,15 @@ class NaivePlayer : public InProcessReceiver, typedef std::pair<base::TimeTicks, AudioBus*> AudioQueueEntry; std::deque<AudioQueueEntry> audio_playout_queue_; base::TimeTicks last_popped_audio_playout_time_; - int64 num_audio_frames_processed_; + int64_t num_audio_frames_processed_; // These must only be used on the audio thread calling OnMoreData(). scoped_ptr<AudioBus> currently_playing_audio_frame_; int currently_playing_audio_frame_start_; - std::map<uint16, base::TimeTicks> audio_play_times_; - std::map<uint16, base::TimeTicks> video_play_times_; - int32 last_audio_frame_no_; + std::map<uint16_t, base::TimeTicks> audio_play_times_; + std::map<uint16_t, base::TimeTicks> video_play_times_; + int32_t last_audio_frame_no_; }; } // namespace cast @@ -560,7 +560,7 @@ int main(int argc, char** argv) { media::cast::GetVideoReceiverConfig(); // Determine local and remote endpoints. - uint16 remote_port, local_port; + uint16_t remote_port, local_port; media::cast::GetPorts(&remote_port, &local_port); if (!local_port) { LOG(ERROR) << "Invalid local port."; diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc index 5791ffe..6f46222 100644 --- a/media/cast/test/sender.cc +++ b/media/cast/test/sender.cc @@ -76,7 +76,7 @@ void QuitLoopOnInitializationResult(media::cast::OperationalStatus result) { base::MessageLoop::current()->QuitWhenIdle(); } -net::IPEndPoint CreateUDPAddress(const std::string& ip_str, uint16 port) { +net::IPEndPoint CreateUDPAddress(const std::string& ip_str, uint16_t port) { net::IPAddressNumber ip_number; CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number)); return net::IPEndPoint(ip_number, port); @@ -202,7 +202,7 @@ int main(int argc, char** argv) { // Running transport on the main thread. // Setting up transport config. net::IPEndPoint remote_endpoint = - CreateUDPAddress(remote_ip_address, static_cast<uint16>(remote_port)); + CreateUDPAddress(remote_ip_address, static_cast<uint16_t>(remote_port)); // Enable raw event and stats logging. // Running transport on the main thread. diff --git a/media/cast/test/simulator.cc b/media/cast/test/simulator.cc index f63a797..b486648 100644 --- a/media/cast/test/simulator.cc +++ b/media/cast/test/simulator.cc @@ -528,9 +528,9 @@ void RunSimulation(const base::FilePath& source_path, int encoded_video_frames = 0; int dropped_video_frames = 0; int late_video_frames = 0; - int64 total_delay_of_late_frames_ms = 0; - int64 encoded_size = 0; - int64 target_bitrate = 0; + int64_t total_delay_of_late_frames_ms = 0; + int64_t encoded_size = 0; + int64_t target_bitrate = 0; for (size_t i = 0; i < video_frame_events.size(); ++i) { const media::cast::proto::AggregatedFrameEvent& event = *video_frame_events[i]; diff --git a/media/cast/test/skewed_single_thread_task_runner.h b/media/cast/test/skewed_single_thread_task_runner.h index 666a348..b3b0c92 100644 --- a/media/cast/test/skewed_single_thread_task_runner.h +++ b/media/cast/test/skewed_single_thread_task_runner.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/single_thread_task_runner.h" #include "base/test/simple_test_tick_clock.h" #include "base/test/test_pending_task.h" diff --git a/media/cast/test/utility/audio_utility.cc b/media/cast/test/utility/audio_utility.cc index 41ecd15..348b692 100644 --- a/media/cast/test/utility/audio_utility.cc +++ b/media/cast/test/utility/audio_utility.cc @@ -4,7 +4,6 @@ #include <cmath> -#include "base/basictypes.h" #include "base/logging.h" #include "base/time/time.h" #include "media/base/audio_bus.h" @@ -93,7 +92,7 @@ const size_t kSamplesToAnalyze = kSamplingFrequency / kBaseFrequency; const double kSenseFrequency = kBaseFrequency * (kNumBits + 1); const double kMinSense = 1.5; -bool EncodeTimestamp(uint16 timestamp, +bool EncodeTimestamp(uint16_t timestamp, size_t sample_offset, size_t length, float* samples) { @@ -147,7 +146,7 @@ double DecodeOneFrequency(const float* samples, // each of the bits. Each frequency must have a strength that is similar to // the sense frequency or to zero, or the decoding fails. If it fails, we // move head by 60 samples and try again until we run out of samples. -bool DecodeTimestamp(const float* samples, size_t length, uint16* timestamp) { +bool DecodeTimestamp(const float* samples, size_t length, uint16_t* timestamp) { for (size_t start = 0; start + kSamplesToAnalyze <= length; start += kSamplesToAnalyze / 4) { @@ -156,7 +155,7 @@ bool DecodeTimestamp(const float* samples, size_t length, uint16* timestamp) { kSenseFrequency); if (sense < kMinSense) continue; bool success = true; - uint16 gray_coded = 0; + uint16_t gray_coded = 0; for (size_t bit = 0; success && bit < kNumBits; bit++) { double signal_strength = DecodeOneFrequency( &samples[start], @@ -174,7 +173,7 @@ bool DecodeTimestamp(const float* samples, size_t length, uint16* timestamp) { } if (success) { // Convert from gray-coded number to binary. - uint16 mask; + uint16_t mask; for (mask = gray_coded >> 1; mask != 0; mask = mask >> 1) { gray_coded = gray_coded ^ mask; } diff --git a/media/cast/test/utility/audio_utility.h b/media/cast/test/utility/audio_utility.h index 36ef858..f2362e6 100644 --- a/media/cast/test/utility/audio_utility.h +++ b/media/cast/test/utility/audio_utility.h @@ -67,14 +67,14 @@ int CountZeroCrossings(const float* samples, int length); // contain how many samples has been encoded so far, so that we can make smooth // transitions between encoded chunks. // See audio_utility.cc for details on how the encoding is done. -bool EncodeTimestamp(uint16 timestamp, +bool EncodeTimestamp(uint16_t timestamp, size_t sample_offset, size_t length, float* samples); // Decode a timestamp encoded with EncodeTimestamp. Returns true if a // timestamp was found in |samples|. -bool DecodeTimestamp(const float* samples, size_t length, uint16* timestamp); +bool DecodeTimestamp(const float* samples, size_t length, uint16_t* timestamp); } // namespace cast } // namespace media diff --git a/media/cast/test/utility/audio_utility_unittest.cc b/media/cast/test/utility/audio_utility_unittest.cc index 951d676..47d1ad0 100644 --- a/media/cast/test/utility/audio_utility_unittest.cc +++ b/media/cast/test/utility/audio_utility_unittest.cc @@ -13,9 +13,9 @@ namespace { TEST(AudioTimestampTest, Small) { std::vector<float> samples(480); - for (int32 in_timestamp = 0; in_timestamp < 65536; in_timestamp += 177) { + for (int32_t in_timestamp = 0; in_timestamp < 65536; in_timestamp += 177) { EncodeTimestamp(in_timestamp, 0, samples.size(), &samples.front()); - uint16 out_timestamp; + uint16_t out_timestamp; EXPECT_TRUE( DecodeTimestamp(&samples.front(), samples.size(), &out_timestamp)); ASSERT_EQ(in_timestamp, out_timestamp); @@ -24,7 +24,7 @@ TEST(AudioTimestampTest, Small) { TEST(AudioTimestampTest, Negative) { std::vector<float> samples(480); - uint16 out_timestamp; + uint16_t out_timestamp; EXPECT_FALSE( DecodeTimestamp(&samples.front(), samples.size(), &out_timestamp)); } @@ -33,7 +33,7 @@ TEST(AudioTimestampTest, CheckPhase) { std::vector<float> samples(4800); EncodeTimestamp(4711, 0, samples.size(), &samples.front()); while (samples.size() > 240) { - uint16 out_timestamp; + uint16_t out_timestamp; EXPECT_TRUE( DecodeTimestamp(&samples.front(), samples.size(), &out_timestamp)); ASSERT_EQ(4711, out_timestamp); diff --git a/media/cast/test/utility/generate_barcode_video.cc b/media/cast/test/utility/generate_barcode_video.cc index e917ecd..774706d 100644 --- a/media/cast/test/utility/generate_barcode_video.cc +++ b/media/cast/test/utility/generate_barcode_video.cc @@ -29,11 +29,11 @@ int main(int argc, char **argv) { int width = atoi(argv[1]); int height = atoi(argv[2]); int fps = atoi(argv[3]); - uint16 wanted_frames = atoi(argv[4]); + uint16_t wanted_frames = atoi(argv[4]); scoped_refptr<media::VideoFrame> frame = media::VideoFrame::CreateBlackFrame(gfx::Size(width, height)); printf("YUV4MPEG2 W%d H%d F%d:1 Ip C420mpeg2\n", width, height, fps); - for (uint16 frame_id = 1; frame_id <= wanted_frames; frame_id++) { + for (uint16_t frame_id = 1; frame_id <= wanted_frames; frame_id++) { CHECK(media::cast::test::EncodeBarcode(frame_id, frame)); printf("FRAME\n"); DumpPlane(frame, media::VideoFrame::kYPlane); diff --git a/media/cast/test/utility/net_utility.cc b/media/cast/test/utility/net_utility.cc index c146d9a..9515f1d 100644 --- a/media/cast/test/utility/net_utility.cc +++ b/media/cast/test/utility/net_utility.cc @@ -4,7 +4,6 @@ #include "media/cast/test/utility/net_utility.h" -#include "base/basictypes.h" #include "net/base/net_errors.h" #include "net/udp/udp_server_socket.h" diff --git a/media/cast/test/utility/tap_proxy.cc b/media/cast/test/utility/tap_proxy.cc index 7bd696b..43125f5 100644 --- a/media/cast/test/utility/tap_proxy.cc +++ b/media/cast/test/utility/tap_proxy.cc @@ -151,16 +151,16 @@ class ByteCounter { return packets / time_range().InSecondsF(); } - void Increment(uint64 x) { + void Increment(uint64_t x) { bytes_ += x; packets_ ++; } private: - uint64 bytes_; - uint64 packets_; - std::deque<uint64> byte_data_; - std::deque<uint64> packet_data_; + uint64_t bytes_; + uint64_t packets_; + std::deque<uint64_t> byte_data_; + std::deque<uint64_t> packet_data_; std::deque<base::TimeTicks> time_data_; }; diff --git a/media/cast/test/utility/udp_proxy.cc b/media/cast/test/utility/udp_proxy.cc index 19191ed..088ebc9 100644 --- a/media/cast/test/utility/udp_proxy.cc +++ b/media/cast/test/utility/udp_proxy.cc @@ -72,7 +72,7 @@ class Buffer : public PacketPipe { last_schedule_ = clock_->NowTicks(); double megabits = buffer_.front()->size() * 8 / 1000000.0; double seconds = megabits / max_megabits_per_second_; - int64 microseconds = static_cast<int64>(seconds * 1E6); + int64_t microseconds = static_cast<int64_t>(seconds * 1E6); task_runner_->PostDelayedTask( FROM_HERE, base::Bind(&Buffer::ProcessBuffer, weak_factory_.GetWeakPtr()), @@ -80,14 +80,14 @@ class Buffer : public PacketPipe { } void ProcessBuffer() { - int64 bytes_to_send = static_cast<int64>( + int64_t bytes_to_send = static_cast<int64_t>( (clock_->NowTicks() - last_schedule_).InSecondsF() * max_megabits_per_second_ * 1E6 / 8); - if (bytes_to_send < static_cast<int64>(buffer_.front()->size())) { + if (bytes_to_send < static_cast<int64_t>(buffer_.front()->size())) { bytes_to_send = buffer_.front()->size(); } while (!buffer_.empty() && - static_cast<int64>(buffer_.front()->size()) <= bytes_to_send) { + static_cast<int64_t>(buffer_.front()->size()) <= bytes_to_send) { CHECK(!buffer_.empty()); scoped_ptr<Packet> packet(buffer_.front().release()); bytes_to_send -= packet->size(); @@ -140,10 +140,9 @@ class SimpleDelayBase : public PacketPipe { double seconds = GetDelay(); task_runner_->PostDelayedTask( FROM_HERE, - base::Bind(&SimpleDelayBase::SendInternal, - weak_factory_.GetWeakPtr(), + base::Bind(&SimpleDelayBase::SendInternal, weak_factory_.GetWeakPtr(), base::Passed(&packet)), - base::TimeDelta::FromMicroseconds(static_cast<int64>(seconds * 1E6))); + base::TimeDelta::FromMicroseconds(static_cast<int64_t>(seconds * 1E6))); } protected: virtual double GetDelay() = 0; @@ -239,7 +238,7 @@ class RandomSortedDelay : public PacketPipe { private: void ScheduleExtraDelay(double mult) { double seconds = seconds_between_extra_delay_ * mult * base::RandDouble(); - int64 microseconds = static_cast<int64>(seconds * 1E6); + int64_t microseconds = static_cast<int64_t>(seconds * 1E6); task_runner_->PostDelayedTask( FROM_HERE, base::Bind(&RandomSortedDelay::CauseExtraDelay, @@ -249,9 +248,8 @@ class RandomSortedDelay : public PacketPipe { void CauseExtraDelay() { next_send_ = std::max<base::TimeTicks>( - clock_->NowTicks() + - base::TimeDelta::FromMicroseconds( - static_cast<int64>(extra_delay_ * 1E6)), + clock_->NowTicks() + base::TimeDelta::FromMicroseconds( + static_cast<int64_t>(extra_delay_ * 1E6)), next_send_); // An extra delay just happened, wait up to seconds_between_extra_delay_*2 // before scheduling another one to make the average equal to @@ -324,7 +322,7 @@ class NetworkGlitchPipe : public PacketPipe { works_ = !works_; double seconds = base::RandDouble() * (works_ ? max_work_time_ : max_outage_time_); - int64 microseconds = static_cast<int64>(seconds * 1E6); + int64_t microseconds = static_cast<int64_t>(seconds * 1E6); task_runner_->PostDelayedTask( FROM_HERE, base::Bind(&NetworkGlitchPipe::Flip, weak_factory_.GetWeakPtr()), @@ -415,7 +413,7 @@ InterruptedPoissonProcess::InterruptedPoissonProcess( const std::vector<double>& average_rates, double coef_burstiness, double coef_variance, - uint32 rand_seed) + uint32_t rand_seed) : clock_(NULL), average_rates_(average_rates), coef_burstiness_(coef_burstiness), @@ -462,7 +460,7 @@ base::TimeDelta InterruptedPoissonProcess::NextEvent(double rate) { double InterruptedPoissonProcess::RandDouble() { // Generate a 64-bits random number from MT19937 and then convert // it to double. - uint64 rand = mt_rand_.genrand_int32(); + uint64_t rand = mt_rand_.genrand_int32(); rand <<= 32; rand |= mt_rand_.genrand_int32(); return base::BitsToOpenEndedUnitInterval(rand); diff --git a/media/cast/test/utility/udp_proxy.h b/media/cast/test/utility/udp_proxy.h index bf95341..7fda438 100644 --- a/media/cast/test/utility/udp_proxy.h +++ b/media/cast/test/utility/udp_proxy.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -54,11 +53,10 @@ class PacketPipe { // The rate above is the average rate of a poisson distribution. class InterruptedPoissonProcess { public: - InterruptedPoissonProcess( - const std::vector<double>& average_rates, - double coef_burstiness, - double coef_variance, - uint32 rand_seed); + InterruptedPoissonProcess(const std::vector<double>& average_rates, + double coef_burstiness, + double coef_variance, + uint32_t rand_seed); ~InterruptedPoissonProcess(); scoped_ptr<PacketPipe> NewBuffer(size_t size); diff --git a/media/cast/test/utility/udp_proxy_main.cc b/media/cast/test/utility/udp_proxy_main.cc index 439b079..8c2e7cf4 100644 --- a/media/cast/test/utility/udp_proxy_main.cc +++ b/media/cast/test/utility/udp_proxy_main.cc @@ -48,16 +48,16 @@ class ByteCounter { return packets / time_range().InSecondsF(); } - void Increment(uint64 x) { + void Increment(uint64_t x) { bytes_ += x; packets_ ++; } private: - uint64 bytes_; - uint64 packets_; - std::deque<uint64> byte_data_; - std::deque<uint64> packet_data_; + uint64_t bytes_; + uint64_t packets_; + std::deque<uint64_t> byte_data_; + std::deque<uint64_t> packet_data_; std::deque<base::TimeTicks> time_data_; }; @@ -161,9 +161,9 @@ int main(int argc, char** argv) { exit(1); } net::IPEndPoint remote_endpoint(remote_ip_number, - static_cast<uint16>(remote_port)); + static_cast<uint16_t>(remote_port)); net::IPEndPoint local_endpoint(local_ip_number, - static_cast<uint16>(local_port)); + static_cast<uint16_t>(local_port)); scoped_ptr<media::cast::test::PacketPipe> in_pipe, out_pipe; scoped_ptr<media::cast::test::InterruptedPoissonProcess> ipp( media::cast::test::DefaultInterruptedPoissonProcess()); diff --git a/media/cast/test/utility/video_utility.cc b/media/cast/test/utility/video_utility.cc index a11de5f..a63d7cf 100644 --- a/media/cast/test/utility/video_utility.cc +++ b/media/cast/test/utility/video_utility.cc @@ -66,12 +66,12 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) { // Set Y. const int height = frame_size.height(); const int stride_y = frame->stride(VideoFrame::kYPlane); - uint8* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->data(VideoFrame::kYPlane); for (int j = 0; j < height; ++j) { const int stripe_j = (j / stripe_size) * stripe_size; for (int i = 0; i < stride_y; ++i) { const int stripe_i = (i / stripe_size) * stripe_size; - *y_plane = static_cast<uint8>(start_value + stripe_i + stripe_j); + *y_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j); ++y_plane; } } @@ -79,7 +79,7 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) { const int half_height = (height + 1) / 2; if (frame->format() == PIXEL_FORMAT_NV12) { const int stride_uv = frame->stride(VideoFrame::kUVPlane); - uint8* uv_plane = frame->data(VideoFrame::kUVPlane); + uint8_t* uv_plane = frame->data(VideoFrame::kUVPlane); // Set U and V. for (int j = 0; j < half_height; ++j) { @@ -87,7 +87,7 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) { for (int i = 0; i < stride_uv; i += 2) { const int stripe_i = (i / stripe_size) * stripe_size; *uv_plane = *(uv_plane + 1) = - static_cast<uint8>(start_value + stripe_i + stripe_j); + static_cast<uint8_t>(start_value + stripe_i + stripe_j); uv_plane += 2; } } @@ -96,15 +96,15 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) { frame->format() == PIXEL_FORMAT_YV12); const int stride_u = frame->stride(VideoFrame::kUPlane); const int stride_v = frame->stride(VideoFrame::kVPlane); - uint8* u_plane = frame->data(VideoFrame::kUPlane); - uint8* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->data(VideoFrame::kVPlane); // Set U. for (int j = 0; j < half_height; ++j) { const int stripe_j = (j / stripe_size) * stripe_size; for (int i = 0; i < stride_u; ++i) { const int stripe_i = (i / stripe_size) * stripe_size; - *u_plane = static_cast<uint8>(start_value + stripe_i + stripe_j); + *u_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j); ++u_plane; } } @@ -114,7 +114,7 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) { const int stripe_j = (j / stripe_size) * stripe_size; for (int i = 0; i < stride_v; ++i) { const int stripe_i = (i / stripe_size) * stripe_size; - *v_plane = static_cast<uint8>(start_value + stripe_i + stripe_j); + *v_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j); ++v_plane; } } @@ -127,9 +127,9 @@ void PopulateVideoFrameWithNoise(VideoFrame* frame) { const int stride_u = frame->stride(VideoFrame::kUPlane); const int stride_v = frame->stride(VideoFrame::kVPlane); const int half_height = (height + 1) / 2; - uint8* const y_plane = frame->data(VideoFrame::kYPlane); - uint8* const u_plane = frame->data(VideoFrame::kUPlane); - uint8* const v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* const y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* const u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* const v_plane = frame->data(VideoFrame::kVPlane); base::RandBytes(y_plane, height * stride_y); base::RandBytes(u_plane, half_height * stride_u); @@ -142,11 +142,11 @@ bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file) { const int half_width = (width + 1) / 2; const int half_height = (height + 1) / 2; const size_t frame_size = width * height + 2 * half_width * half_height; - uint8* const y_plane = frame->data(VideoFrame::kYPlane); - uint8* const u_plane = frame->data(VideoFrame::kUPlane); - uint8* const v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* const y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* const u_plane = frame->data(VideoFrame::kUPlane); + uint8_t* const v_plane = frame->data(VideoFrame::kVPlane); - uint8* const raw_data = new uint8[frame_size]; + uint8_t* const raw_data = new uint8_t[frame_size]; const size_t count = fread(raw_data, 1, frame_size, video_file); if (count != frame_size) return false; diff --git a/media/cdm/aes_decryptor.h b/media/cdm/aes_decryptor.h index 2b5a49e..56330ef 100644 --- a/media/cdm/aes_decryptor.h +++ b/media/cdm/aes_decryptor.h @@ -9,7 +9,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index 2373cd8..edda82d 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc @@ -5,7 +5,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/debug/leak_annotations.h" #include "base/json/json_reader.h" @@ -44,17 +43,16 @@ MATCHER(IsJSONDictionary, "") { namespace media { -const uint8 kOriginalData[] = "Original subsample data."; +const uint8_t kOriginalData[] = "Original subsample data."; const int kOriginalDataSize = 24; // In the examples below, 'k'(key) has to be 16 bytes, and will always require // 2 bytes of padding. 'kid'(keyid) is variable length, and may require 0, 1, // or 2 bytes of padding. -const uint8 kKeyId[] = { +const uint8_t kKeyId[] = { // base64 equivalent is AAECAw - 0x00, 0x01, 0x02, 0x03 -}; + 0x00, 0x01, 0x02, 0x03}; // Key is 0x0405060708090a0b0c0d0e0f10111213, // base64 equivalent is BAUGBwgJCgsMDQ4PEBESEw. @@ -108,40 +106,30 @@ const char kWrongSizedKeyAsJWK[] = " ]" "}"; -const uint8 kIv[] = { - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; +const uint8_t kIv[] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // kOriginalData encrypted with kKey and kIv but without any subsamples (or // equivalently using kSubsampleEntriesCypherOnly). -const uint8 kEncryptedData[] = { - 0x2f, 0x03, 0x09, 0xef, 0x71, 0xaf, 0x31, 0x16, - 0xfa, 0x9d, 0x18, 0x43, 0x1e, 0x96, 0x71, 0xb5, - 0xbf, 0xf5, 0x30, 0x53, 0x9a, 0x20, 0xdf, 0x95 -}; +const uint8_t kEncryptedData[] = { + 0x2f, 0x03, 0x09, 0xef, 0x71, 0xaf, 0x31, 0x16, 0xfa, 0x9d, 0x18, 0x43, + 0x1e, 0x96, 0x71, 0xb5, 0xbf, 0xf5, 0x30, 0x53, 0x9a, 0x20, 0xdf, 0x95}; // kOriginalData encrypted with kSubsampleKey and kSubsampleIv using // kSubsampleEntriesNormal. -const uint8 kSubsampleEncryptedData[] = { - 0x4f, 0x72, 0x09, 0x16, 0x09, 0xe6, 0x79, 0xad, - 0x70, 0x73, 0x75, 0x62, 0x09, 0xbb, 0x83, 0x1d, - 0x4d, 0x08, 0xd7, 0x78, 0xa4, 0xa7, 0xf1, 0x2e -}; +const uint8_t kSubsampleEncryptedData[] = { + 0x4f, 0x72, 0x09, 0x16, 0x09, 0xe6, 0x79, 0xad, 0x70, 0x73, 0x75, 0x62, + 0x09, 0xbb, 0x83, 0x1d, 0x4d, 0x08, 0xd7, 0x78, 0xa4, 0xa7, 0xf1, 0x2e}; -const uint8 kOriginalData2[] = "Changed Original data."; +const uint8_t kOriginalData2[] = "Changed Original data."; -const uint8 kIv2[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; +const uint8_t kIv2[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -const uint8 kKeyId2[] = { +const uint8_t kKeyId2[] = { // base64 equivalent is AAECAwQFBgcICQoLDA0ODxAREhM= - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13 -}; + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13}; const char kKey2AsJWK[] = "{" @@ -157,11 +145,9 @@ const char kKey2AsJWK[] = // 'k' in bytes is x14x15x16x17x18x19x1ax1bx1cx1dx1ex1fx20x21x22x23 -const uint8 kEncryptedData2[] = { - 0x57, 0x66, 0xf4, 0x12, 0x1a, 0xed, 0xb5, 0x79, - 0x1c, 0x8e, 0x25, 0xd7, 0x17, 0xe7, 0x5e, 0x16, - 0xe3, 0x40, 0x08, 0x27, 0x11, 0xe9 -}; +const uint8_t kEncryptedData2[] = { + 0x57, 0x66, 0xf4, 0x12, 0x1a, 0xed, 0xb5, 0x79, 0x1c, 0x8e, 0x25, + 0xd7, 0x17, 0xe7, 0x5e, 0x16, 0xe3, 0x40, 0x08, 0x27, 0x11, 0xe9}; // Subsample entries for testing. The sum of |cypher_bytes| and |clear_bytes| of // all entries must be equal to kOriginalDataSize to make the subsample entries @@ -198,9 +184,9 @@ const SubsampleEntry kSubsampleEntriesCypherOnly[] = { }; static scoped_refptr<DecoderBuffer> CreateEncryptedBuffer( - const std::vector<uint8>& data, - const std::vector<uint8>& key_id, - const std::vector<uint8>& iv, + const std::vector<uint8_t>& data, + const std::vector<uint8_t>& key_id, + const std::vector<uint8_t>& iv, const std::vector<SubsampleEntry>& subsample_entries) { DCHECK(!data.empty()); scoped_refptr<DecoderBuffer> encrypted_buffer(new DecoderBuffer(data.size())); @@ -298,7 +284,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { void OnReject(ExpectedResult expected_result, MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { EXPECT_EQ(expected_result, REJECTED) << "Unexpectedly rejected with message: " << error_message; @@ -329,7 +315,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { } // Creates a new session using |key_id|. Returns the session ID. - std::string CreateSession(const std::vector<uint8>& key_id) { + std::string CreateSession(const std::vector<uint8_t>& key_id) { DCHECK(!key_id.empty()); EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsJSONDictionary(), GURL::EmptyGURL())); @@ -387,11 +373,12 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { EXPECT_CALL(*this, OnSessionKeysChangeCalled(_, _)).Times(0); } - cdm_->UpdateSession(session_id, std::vector<uint8>(key.begin(), key.end()), + cdm_->UpdateSession(session_id, + std::vector<uint8_t>(key.begin(), key.end()), CreatePromise(expected_result)); } - bool KeysInfoContains(std::vector<uint8> expected) { + bool KeysInfoContains(std::vector<uint8_t> expected) { for (const auto& key_id : keys_info_) { if (key_id->key_id == expected) return true; @@ -411,7 +398,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { }; void DecryptAndExpect(const scoped_refptr<DecoderBuffer>& encrypted, - const std::vector<uint8>& plain_text, + const std::vector<uint8_t>& plain_text, DecryptExpectation result) { scoped_refptr<DecoderBuffer> decrypted; @@ -439,7 +426,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { decryptor_->Decrypt(Decryptor::kVideo, encrypted, decrypt_cb_); } - std::vector<uint8> decrypted_text; + std::vector<uint8_t> decrypted_text; if (decrypted.get() && decrypted->data_size()) { decrypted_text.assign( decrypted->data(), decrypted->data() + decrypted->data_size()); @@ -466,7 +453,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { MOCK_METHOD4(OnSessionMessage, void(const std::string& session_id, MediaKeys::MessageType message_type, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& legacy_destination_url)); MOCK_METHOD1(OnSessionClosed, void(const std::string& session_id)); MOCK_METHOD4(OnLegacySessionError, @@ -490,11 +477,11 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> { base::MessageLoop message_loop_; // Constants for testing. - const std::vector<uint8> original_data_; - const std::vector<uint8> encrypted_data_; - const std::vector<uint8> subsample_encrypted_data_; - const std::vector<uint8> key_id_; - const std::vector<uint8> iv_; + const std::vector<uint8_t> original_data_; + const std::vector<uint8_t> encrypted_data_; + const std::vector<uint8_t> subsample_encrypted_data_; + const std::vector<uint8_t> key_id_; + const std::vector<uint8_t> iv_; const std::vector<SubsampleEntry> normal_subsample_entries_; const std::vector<SubsampleEntry> no_subsample_entries_; }; @@ -503,32 +490,32 @@ TEST_P(AesDecryptorTest, CreateSessionWithNullInitData) { EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( - MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, std::vector<uint8>(), - CreateSessionPromise(RESOLVED)); + MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, + std::vector<uint8_t>(), CreateSessionPromise(RESOLVED)); } TEST_P(AesDecryptorTest, MultipleCreateSession) { EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( - MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, std::vector<uint8>(), - CreateSessionPromise(RESOLVED)); + MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, + std::vector<uint8_t>(), CreateSessionPromise(RESOLVED)); EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( - MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, std::vector<uint8>(), - CreateSessionPromise(RESOLVED)); + MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, + std::vector<uint8_t>(), CreateSessionPromise(RESOLVED)); EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsEmpty(), GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( - MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, std::vector<uint8>(), - CreateSessionPromise(RESOLVED)); + MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, + std::vector<uint8_t>(), CreateSessionPromise(RESOLVED)); } TEST_P(AesDecryptorTest, CreateSessionWithCencInitData) { - const uint8 init_data[] = { + const uint8_t init_data[] = { 0x00, 0x00, 0x00, 0x44, // size = 68 0x70, 0x73, 0x73, 0x68, // 'pssh' 0x01, // version @@ -548,12 +535,12 @@ TEST_P(AesDecryptorTest, CreateSessionWithCencInitData) { GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( MediaKeys::TEMPORARY_SESSION, EmeInitDataType::CENC, - std::vector<uint8>(init_data, init_data + arraysize(init_data)), + std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), CreateSessionPromise(RESOLVED)); #else cdm_->CreateSessionAndGenerateRequest( MediaKeys::TEMPORARY_SESSION, EmeInitDataType::CENC, - std::vector<uint8>(init_data, init_data + arraysize(init_data)), + std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), CreateSessionPromise(REJECTED)); #endif } @@ -566,7 +553,7 @@ TEST_P(AesDecryptorTest, CreateSessionWithKeyIdsInitData) { GURL::EmptyGURL())); cdm_->CreateSessionAndGenerateRequest( MediaKeys::TEMPORARY_SESSION, EmeInitDataType::KEYIDS, - std::vector<uint8>(init_data, init_data + arraysize(init_data) - 1), + std::vector<uint8_t>(init_data, init_data + arraysize(init_data) - 1), CreateSessionPromise(RESOLVED)); } @@ -581,7 +568,7 @@ TEST_P(AesDecryptorTest, NormalDecryption) { TEST_P(AesDecryptorTest, UnencryptedFrame) { // An empty iv string signals that the frame is unencrypted. scoped_refptr<DecoderBuffer> encrypted_buffer = CreateEncryptedBuffer( - original_data_, key_id_, std::vector<uint8>(), no_subsample_entries_); + original_data_, key_id_, std::vector<uint8_t>(), no_subsample_entries_); DecryptAndExpect(encrypted_buffer, original_data_, SUCCESS); } @@ -635,15 +622,15 @@ TEST_P(AesDecryptorTest, MultipleKeysAndFrames) { // The second key is also available. encrypted_buffer = CreateEncryptedBuffer( - std::vector<uint8>(kEncryptedData2, - kEncryptedData2 + arraysize(kEncryptedData2)), - std::vector<uint8>(kKeyId2, kKeyId2 + arraysize(kKeyId2)), - std::vector<uint8>(kIv2, kIv2 + arraysize(kIv2)), + std::vector<uint8_t>(kEncryptedData2, + kEncryptedData2 + arraysize(kEncryptedData2)), + std::vector<uint8_t>(kKeyId2, kKeyId2 + arraysize(kKeyId2)), + std::vector<uint8_t>(kIv2, kIv2 + arraysize(kIv2)), no_subsample_entries_); ASSERT_NO_FATAL_FAILURE(DecryptAndExpect( encrypted_buffer, - std::vector<uint8>(kOriginalData2, - kOriginalData2 + arraysize(kOriginalData2) - 1), + std::vector<uint8_t>(kOriginalData2, + kOriginalData2 + arraysize(kOriginalData2) - 1), SUCCESS)); } @@ -651,7 +638,7 @@ TEST_P(AesDecryptorTest, CorruptedIv) { std::string session_id = CreateSession(key_id_); UpdateSessionAndExpect(session_id, kKeyAsJWK, RESOLVED, true); - std::vector<uint8> bad_iv = iv_; + std::vector<uint8_t> bad_iv = iv_; bad_iv[1]++; scoped_refptr<DecoderBuffer> encrypted_buffer = CreateEncryptedBuffer( @@ -664,7 +651,7 @@ TEST_P(AesDecryptorTest, CorruptedData) { std::string session_id = CreateSession(key_id_); UpdateSessionAndExpect(session_id, kKeyAsJWK, RESOLVED, true); - std::vector<uint8> bad_data = encrypted_data_; + std::vector<uint8_t> bad_data = encrypted_data_; bad_data[1]++; scoped_refptr<DecoderBuffer> encrypted_buffer = CreateEncryptedBuffer( @@ -676,7 +663,7 @@ TEST_P(AesDecryptorTest, EncryptedAsUnencryptedFailure) { std::string session_id = CreateSession(key_id_); UpdateSessionAndExpect(session_id, kKeyAsJWK, RESOLVED, true); scoped_refptr<DecoderBuffer> encrypted_buffer = CreateEncryptedBuffer( - encrypted_data_, key_id_, std::vector<uint8>(), no_subsample_entries_); + encrypted_data_, key_id_, std::vector<uint8_t>(), no_subsample_entries_); DecryptAndExpect(encrypted_buffer, original_data_, DATA_MISMATCH); } @@ -977,8 +964,8 @@ TEST_P(AesDecryptorTest, JWKKey) { } TEST_P(AesDecryptorTest, GetKeyIds) { - std::vector<uint8> key_id1(kKeyId, kKeyId + arraysize(kKeyId)); - std::vector<uint8> key_id2(kKeyId2, kKeyId2 + arraysize(kKeyId2)); + std::vector<uint8_t> key_id1(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id2(kKeyId2, kKeyId2 + arraysize(kKeyId2)); std::string session_id = CreateSession(key_id_); EXPECT_FALSE(KeysInfoContains(key_id1)); @@ -996,7 +983,7 @@ TEST_P(AesDecryptorTest, GetKeyIds) { } TEST_P(AesDecryptorTest, NoKeysChangeForSameKey) { - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); std::string session_id = CreateSession(key_id_); EXPECT_FALSE(KeysInfoContains(key_id)); diff --git a/media/cdm/cdm_adapter.cc b/media/cdm/cdm_adapter.cc index 2a20680..0bce8b5 100644 --- a/media/cdm/cdm_adapter.cc +++ b/media/cdm/cdm_adapter.cc @@ -256,10 +256,10 @@ void ToCdmInputBuffer(const scoped_refptr<DecoderBuffer>& encrypted_buffer, const DecryptConfig* decrypt_config = encrypted_buffer->decrypt_config(); input_buffer->key_id = - reinterpret_cast<const uint8*>(decrypt_config->key_id().data()); + reinterpret_cast<const uint8_t*>(decrypt_config->key_id().data()); input_buffer->key_id_size = decrypt_config->key_id().size(); input_buffer->iv = - reinterpret_cast<const uint8*>(decrypt_config->iv().data()); + reinterpret_cast<const uint8_t*>(decrypt_config->iv().data()); input_buffer->iv_size = decrypt_config->iv().size(); DCHECK(subsamples->empty()); @@ -772,7 +772,7 @@ void CdmAdapter::OnSessionMessage(const char* session_id, verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. } - const uint8_t* message_ptr = reinterpret_cast<const uint8*>(message); + const uint8_t* message_ptr = reinterpret_cast<const uint8_t*>(message); session_message_cb_.Run( std::string(session_id, session_id_size), ToMediaMessageType(message_type), diff --git a/media/cdm/cdm_adapter_unittest.cc b/media/cdm/cdm_adapter_unittest.cc index efeac87..bc11ad5 100644 --- a/media/cdm/cdm_adapter_unittest.cc +++ b/media/cdm/cdm_adapter_unittest.cc @@ -29,7 +29,7 @@ MATCHER(IsNotEmpty, "") { namespace media { // Random key ID used to create a session. -const uint8 kKeyId[] = { +const uint8_t kKeyId[] = { // base64 equivalent is AQIDBAUGBwgJCgsMDQ4PEA 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, @@ -37,7 +37,7 @@ const uint8 kKeyId[] = { const char kKeyIdAsJWK[] = "{\"kids\": [\"AQIDBAUGBwgJCgsMDQ4PEA\"]}"; -const uint8 kKeyIdAsPssh[] = { +const uint8_t kKeyIdAsPssh[] = { 0x00, 0x00, 0x00, 0x00, 'p', 's', 's', 'h', // size = 0 0x01, // version = 1 0x00, 0x00, 0x00, // flags @@ -97,7 +97,7 @@ class CdmAdapterTest : public testing::Test { // when the promise is resolved. |expected_result| tests that // CreateSessionAndGenerateRequest() succeeds or generates an error. void CreateSessionAndExpect(EmeInitDataType data_type, - const std::vector<uint8>& key_id, + const std::vector<uint8_t>& key_id, ExpectedResult expected_result) { DCHECK(!key_id.empty()); @@ -141,7 +141,7 @@ class CdmAdapterTest : public testing::Test { } adapter_->UpdateSession(session_id, - std::vector<uint8>(key.begin(), key.end()), + std::vector<uint8_t>(key.begin(), key.end()), CreatePromise(expected_result)); RunUntilIdle(); } @@ -203,7 +203,7 @@ class CdmAdapterTest : public testing::Test { MOCK_METHOD1(OnResolveWithSession, void(const std::string& session_id)); MOCK_METHOD3(OnReject, void(MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message)); // Methods used for the events possibly generated by CdmAdapater. @@ -257,7 +257,7 @@ TEST_F(CdmAdapterTest, BadLibraryPath) { TEST_F(CdmAdapterTest, CreateWebmSession) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); } @@ -265,16 +265,16 @@ TEST_F(CdmAdapterTest, CreateKeyIdsSession) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); // Don't include the trailing /0 from the string in the data passed in. - std::vector<uint8> key_id(kKeyIdAsJWK, - kKeyIdAsJWK + arraysize(kKeyIdAsJWK) - 1); + std::vector<uint8_t> key_id(kKeyIdAsJWK, + kKeyIdAsJWK + arraysize(kKeyIdAsJWK) - 1); CreateSessionAndExpect(EmeInitDataType::KEYIDS, key_id, SUCCESS); } TEST_F(CdmAdapterTest, CreateCencSession) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); - std::vector<uint8> key_id(kKeyIdAsPssh, - kKeyIdAsPssh + arraysize(kKeyIdAsPssh)); + std::vector<uint8_t> key_id(kKeyIdAsPssh, + kKeyIdAsPssh + arraysize(kKeyIdAsPssh)); #if defined(USE_PROPRIETARY_CODECS) CreateSessionAndExpect(EmeInitDataType::CENC, key_id, SUCCESS); #else @@ -286,7 +286,7 @@ TEST_F(CdmAdapterTest, CreateSessionWithBadData) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); // Use |kKeyId| but specify KEYIDS format. - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); CreateSessionAndExpect(EmeInitDataType::KEYIDS, key_id, FAILURE); } @@ -294,14 +294,14 @@ TEST_F(CdmAdapterTest, LoadSession) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); // LoadSession() is not supported by AesDecryptor. - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); CreateSessionAndExpect(EmeInitDataType::KEYIDS, key_id, FAILURE); } TEST_F(CdmAdapterTest, UpdateSession) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); UpdateSessionAndExpect(SessionId(), kKeyAsJWK, SUCCESS, true); @@ -310,7 +310,7 @@ TEST_F(CdmAdapterTest, UpdateSession) { TEST_F(CdmAdapterTest, UpdateSessionWithBadData) { InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); - std::vector<uint8> key_id(kKeyId, kKeyId + arraysize(kKeyId)); + std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true); diff --git a/media/cdm/cdm_helpers.h b/media/cdm/cdm_helpers.h index a058f43..538b4e8 100644 --- a/media/cdm/cdm_helpers.h +++ b/media/cdm/cdm_helpers.h @@ -5,7 +5,7 @@ #ifndef MEDIA_CDM_CDM_HELPERS_H_ #define MEDIA_CDM_CDM_HELPERS_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "media/cdm/api/content_decryption_module.h" namespace media { diff --git a/media/cdm/cdm_wrapper.h b/media/cdm/cdm_wrapper.h index eafd3d7..8ba71a7 100644 --- a/media/cdm/cdm_wrapper.h +++ b/media/cdm/cdm_wrapper.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "media/cdm/api/content_decryption_module.h" #include "media/cdm/supported_cdm_versions.h" diff --git a/media/cdm/cenc_utils.h b/media/cdm/cenc_utils.h index 59142e7..17f844e 100644 --- a/media/cdm/cenc_utils.h +++ b/media/cdm/cenc_utils.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/cdm/json_web_key.h" diff --git a/media/cdm/json_web_key.cc b/media/cdm/json_web_key.cc index eba4d6a..ded017a 100644 --- a/media/cdm/json_web_key.cc +++ b/media/cdm/json_web_key.cc @@ -44,9 +44,9 @@ static std::string ShortenTo64Characters(const std::string& input) { } static scoped_ptr<base::DictionaryValue> CreateJSONDictionary( - const uint8* key, + const uint8_t* key, int key_length, - const uint8* key_id, + const uint8_t* key_id, int key_id_length) { std::string key_string, key_id_string; base::Base64UrlEncode( @@ -63,8 +63,10 @@ static scoped_ptr<base::DictionaryValue> CreateJSONDictionary( return jwk.Pass(); } -std::string GenerateJWKSet(const uint8* key, int key_length, - const uint8* key_id, int key_id_length) { +std::string GenerateJWKSet(const uint8_t* key, + int key_length, + const uint8_t* key_id, + int key_id_length) { // Create the JWK, and wrap it into a JWK Set. scoped_ptr<base::ListValue> list(new base::ListValue()); list->Append( @@ -84,9 +86,9 @@ std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys, scoped_ptr<base::ListValue> list(new base::ListValue()); for (const auto& key_pair : keys) { list->Append(CreateJSONDictionary( - reinterpret_cast<const uint8*>(key_pair.second.data()), + reinterpret_cast<const uint8_t*>(key_pair.second.data()), key_pair.second.length(), - reinterpret_cast<const uint8*>(key_pair.first.data()), + reinterpret_cast<const uint8_t*>(key_pair.first.data()), key_pair.first.length()) .release()); } @@ -283,7 +285,7 @@ bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input, } // Add the decoded key ID to the list. - local_key_ids.push_back(std::vector<uint8>( + local_key_ids.push_back(std::vector<uint8_t>( raw_key_id.data(), raw_key_id.data() + raw_key_id.length())); } @@ -295,7 +297,7 @@ bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input, void CreateLicenseRequest(const KeyIdList& key_ids, MediaKeys::SessionType session_type, - std::vector<uint8>* license) { + std::vector<uint8_t>* license) { // Create the license request. scoped_ptr<base::DictionaryValue> request(new base::DictionaryValue()); scoped_ptr<base::ListValue> list(new base::ListValue()); @@ -328,12 +330,12 @@ void CreateLicenseRequest(const KeyIdList& key_ids, serializer.Serialize(*request); // Convert the serialized license request into std::vector and return it. - std::vector<uint8> result(json.begin(), json.end()); + std::vector<uint8_t> result(json.begin(), json.end()); license->swap(result); } void CreateKeyIdsInitData(const KeyIdList& key_ids, - std::vector<uint8>* init_data) { + std::vector<uint8_t>* init_data) { // Create the init_data. scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue()); scoped_ptr<base::ListValue> list(new base::ListValue()); @@ -354,12 +356,12 @@ void CreateKeyIdsInitData(const KeyIdList& key_ids, serializer.Serialize(*dictionary); // Convert the serialized data into std::vector and return it. - std::vector<uint8> result(json.begin(), json.end()); + std::vector<uint8_t> result(json.begin(), json.end()); init_data->swap(result); } -bool ExtractFirstKeyIdFromLicenseRequest(const std::vector<uint8>& license, - std::vector<uint8>* first_key) { +bool ExtractFirstKeyIdFromLicenseRequest(const std::vector<uint8_t>& license, + std::vector<uint8_t>* first_key) { const std::string license_as_str( reinterpret_cast<const char*>(!license.empty() ? &license[0] : NULL), license.size()); @@ -404,7 +406,7 @@ bool ExtractFirstKeyIdFromLicenseRequest(const std::vector<uint8>& license, return false; } - std::vector<uint8> result(decoded_string.begin(), decoded_string.end()); + std::vector<uint8_t> result(decoded_string.begin(), decoded_string.end()); first_key->swap(result); return true; } diff --git a/media/cdm/json_web_key.h b/media/cdm/json_web_key.h index 8502ad9..6e6cd66 100644 --- a/media/cdm/json_web_key.h +++ b/media/cdm/json_web_key.h @@ -9,7 +9,6 @@ #include <utility> #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/base/media_keys.h" @@ -49,7 +48,7 @@ namespace media { // http://tools.ietf.org/html/draft-jones-jose-json-private-and-symmetric-key // Vector of key IDs. -typedef std::vector<std::vector<uint8>> KeyIdList; +typedef std::vector<std::vector<uint8_t>> KeyIdList; // Vector of [key_id, key_value] pairs. Values are raw binary data, stored in // strings for convenience. @@ -57,8 +56,10 @@ typedef std::pair<std::string, std::string> KeyIdAndKeyPair; typedef std::vector<KeyIdAndKeyPair> KeyIdAndKeyPairs; // Converts a single |key|, |key_id| pair to a JSON Web Key Set. -MEDIA_EXPORT std::string GenerateJWKSet(const uint8* key, int key_length, - const uint8* key_id, int key_id_length); +MEDIA_EXPORT std::string GenerateJWKSet(const uint8_t* key, + int key_length, + const uint8_t* key_id, + int key_id_length); // Converts a set of |key|, |key_id| pairs to a JSON Web Key Set. MEDIA_EXPORT std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys, @@ -83,19 +84,19 @@ MEDIA_EXPORT bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input, // specified. |license| is updated to contain the resulting JSON string. MEDIA_EXPORT void CreateLicenseRequest(const KeyIdList& key_ids, MediaKeys::SessionType session_type, - std::vector<uint8>* license); + std::vector<uint8_t>* license); // Creates a keyIDs init_data message for the |key_ids| specified. // |key_ids_init_data| is updated to contain the resulting JSON string. MEDIA_EXPORT void CreateKeyIdsInitData(const KeyIdList& key_ids, - std::vector<uint8>* key_ids_init_data); + std::vector<uint8_t>* key_ids_init_data); // Extract the first key from the license request message. Returns true if // |license| is a valid license request and contains at least one key, // otherwise false and |first_key| is not touched. MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest( - const std::vector<uint8>& license, - std::vector<uint8>* first_key); + const std::vector<uint8_t>& license, + std::vector<uint8_t>* first_key); } // namespace media diff --git a/media/cdm/json_web_key_unittest.cc b/media/cdm/json_web_key_unittest.cc index 90d19e3..2b0baa4 100644 --- a/media/cdm/json_web_key_unittest.cc +++ b/media/cdm/json_web_key_unittest.cc @@ -40,13 +40,13 @@ class JSONWebKeyTest : public testing::Test { } } - void CreateLicenseAndExpect(const uint8* key_id, + void CreateLicenseAndExpect(const uint8_t* key_id, int key_id_length, MediaKeys::SessionType session_type, const std::string& expected_result) { - std::vector<uint8> result; + std::vector<uint8_t> result; KeyIdList key_ids; - key_ids.push_back(std::vector<uint8>(key_id, key_id + key_id_length)); + key_ids.push_back(std::vector<uint8_t>(key_id, key_id + key_id_length)); CreateLicenseRequest(key_ids, session_type, &result); std::string s(result.begin(), result.end()); EXPECT_EQ(expected_result, s); @@ -54,27 +54,27 @@ class JSONWebKeyTest : public testing::Test { void ExtractKeyFromLicenseAndExpect(const std::string& license, bool expected_result, - const uint8* expected_key, + const uint8_t* expected_key, int expected_key_length) { - std::vector<uint8> license_vector(license.begin(), license.end()); - std::vector<uint8> key; + std::vector<uint8_t> license_vector(license.begin(), license.end()); + std::vector<uint8_t> key; EXPECT_EQ(expected_result, ExtractFirstKeyIdFromLicenseRequest(license_vector, &key)); if (expected_result) VerifyKeyId(key, expected_key, expected_key_length); } - void VerifyKeyId(std::vector<uint8> key, - const uint8* expected_key, + void VerifyKeyId(std::vector<uint8_t> key, + const uint8_t* expected_key, int expected_key_length) { - std::vector<uint8> key_result(expected_key, - expected_key + expected_key_length); + std::vector<uint8_t> key_result(expected_key, + expected_key + expected_key_length); EXPECT_EQ(key_result, key); } - KeyIdAndKeyPair MakeKeyIdAndKeyPair(const uint8* key, + KeyIdAndKeyPair MakeKeyIdAndKeyPair(const uint8_t* key, int key_length, - const uint8* key_id, + const uint8_t* key_id, int key_id_length) { return std::make_pair(std::string(key_id, key_id + key_id_length), std::string(key, key + key_length)); @@ -82,10 +82,10 @@ class JSONWebKeyTest : public testing::Test { }; TEST_F(JSONWebKeyTest, GenerateJWKSet) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; EXPECT_EQ("{\"keys\":[{\"k\":\"AQI\",\"kid\":\"AQI\",\"kty\":\"oct\"}]}", GenerateJWKSet(data1, arraysize(data1), data1, arraysize(data1))); @@ -416,10 +416,10 @@ TEST_F(JSONWebKeyTest, SessionType) { } TEST_F(JSONWebKeyTest, CreateLicense) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; CreateLicenseAndExpect(data1, arraysize(data1), @@ -442,10 +442,10 @@ TEST_F(JSONWebKeyTest, CreateLicense) { } TEST_F(JSONWebKeyTest, ExtractLicense) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; ExtractKeyFromLicenseAndExpect( "{\"kids\":[\"AQI\"],\"type\":\"temporary\"}", @@ -485,7 +485,7 @@ TEST_F(JSONWebKeyTest, ExtractLicense) { } TEST_F(JSONWebKeyTest, Base64UrlEncoding) { - const uint8 data1[] = { 0xfb, 0xfd, 0xfb, 0xfd, 0xfb, 0xfd, 0xfb }; + const uint8_t data1[] = {0xfb, 0xfd, 0xfb, 0xfd, 0xfb, 0xfd, 0xfb}; // Verify that |data1| contains invalid base64url characters '+' and '/' // and is padded with = when converted to base64. @@ -511,16 +511,16 @@ TEST_F(JSONWebKeyTest, Base64UrlEncoding) { } TEST_F(JSONWebKeyTest, MultipleKeys) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; - std::vector<uint8> result; + std::vector<uint8_t> result; KeyIdList key_ids; - key_ids.push_back(std::vector<uint8>(data1, data1 + arraysize(data1))); - key_ids.push_back(std::vector<uint8>(data2, data2 + arraysize(data2))); - key_ids.push_back(std::vector<uint8>(data3, data3 + arraysize(data3))); + key_ids.push_back(std::vector<uint8_t>(data1, data1 + arraysize(data1))); + key_ids.push_back(std::vector<uint8_t>(data2, data2 + arraysize(data2))); + key_ids.push_back(std::vector<uint8_t>(data3, data3 + arraysize(data3))); CreateLicenseRequest(key_ids, MediaKeys::TEMPORARY_SESSION, &result); std::string s(result.begin(), result.end()); EXPECT_EQ( @@ -530,10 +530,10 @@ TEST_F(JSONWebKeyTest, MultipleKeys) { } TEST_F(JSONWebKeyTest, ExtractKeyIds) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; KeyIdList key_ids; std::string error_message; @@ -608,28 +608,28 @@ TEST_F(JSONWebKeyTest, ExtractKeyIds) { } TEST_F(JSONWebKeyTest, CreateInitData) { - const uint8 data1[] = { 0x01, 0x02 }; - const uint8 data2[] = { 0x01, 0x02, 0x03, 0x04 }; - const uint8 data3[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }; + const uint8_t data1[] = {0x01, 0x02}; + const uint8_t data2[] = {0x01, 0x02, 0x03, 0x04}; + const uint8_t data3[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}; KeyIdList key_ids; std::string error_message; - key_ids.push_back(std::vector<uint8>(data1, data1 + arraysize(data1))); - std::vector<uint8> init_data1; + key_ids.push_back(std::vector<uint8_t>(data1, data1 + arraysize(data1))); + std::vector<uint8_t> init_data1; CreateKeyIdsInitData(key_ids, &init_data1); std::string result1(init_data1.begin(), init_data1.end()); EXPECT_EQ(result1, "{\"kids\":[\"AQI\"]}"); - key_ids.push_back(std::vector<uint8>(data2, data2 + arraysize(data2))); - std::vector<uint8> init_data2; + key_ids.push_back(std::vector<uint8_t>(data2, data2 + arraysize(data2))); + std::vector<uint8_t> init_data2; CreateKeyIdsInitData(key_ids, &init_data2); std::string result2(init_data2.begin(), init_data2.end()); EXPECT_EQ(result2, "{\"kids\":[\"AQI\",\"AQIDBA\"]}"); - key_ids.push_back(std::vector<uint8>(data3, data3 + arraysize(data3))); - std::vector<uint8> init_data3; + key_ids.push_back(std::vector<uint8_t>(data3, data3 + arraysize(data3))); + std::vector<uint8_t> init_data3; CreateKeyIdsInitData(key_ids, &init_data3); std::string result3(init_data3.begin(), init_data3.end()); EXPECT_EQ(result3, diff --git a/media/cdm/key_system_names.cc b/media/cdm/key_system_names.cc index 1782203..f0f1c2e 100644 --- a/media/cdm/key_system_names.cc +++ b/media/cdm/key_system_names.cc @@ -4,7 +4,6 @@ #include "media/cdm/key_system_names.h" - namespace media { const char kClearKey[] = "org.w3.clearkey"; diff --git a/media/cdm/player_tracker_impl.h b/media/cdm/player_tracker_impl.h index 7da1a25..54de500 100644 --- a/media/cdm/player_tracker_impl.h +++ b/media/cdm/player_tracker_impl.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/callback.h" #include "base/synchronization/lock.h" #include "media/base/media_export.h" diff --git a/media/cdm/ppapi/cdm_file_io_impl.h b/media/cdm/ppapi/cdm_file_io_impl.h index 3e12a48..cbb59bd 100644 --- a/media/cdm/ppapi/cdm_file_io_impl.h +++ b/media/cdm/ppapi/cdm_file_io_impl.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/cdm/api/content_decryption_module.h" #include "ppapi/c/ppb_file_io.h" #include "ppapi/cpp/file_io.h" diff --git a/media/cdm/ppapi/cdm_logging.cc b/media/cdm/ppapi/cdm_logging.cc index 4d47cec..fe50065 100644 --- a/media/cdm/ppapi/cdm_logging.cc +++ b/media/cdm/ppapi/cdm_logging.cc @@ -9,7 +9,7 @@ #include "media/cdm/ppapi/cdm_logging.h" -#include "base/basictypes.h" +#include "build/build_config.h" #if defined(OS_WIN) #include <io.h> @@ -32,6 +32,8 @@ #include <unistd.h> #endif +#include <stdint.h> + #include <iomanip> #include <iostream> @@ -43,7 +45,7 @@ namespace { // Helper functions to wrap platform differences. -int32 CurrentProcessId() { +int32_t CurrentProcessId() { #if defined(OS_WIN) return GetCurrentProcessId(); #elif defined(OS_POSIX) @@ -51,7 +53,7 @@ int32 CurrentProcessId() { #endif } -int32 CurrentThreadId() { +int32_t CurrentThreadId() { // Pthreads doesn't have the concept of a thread ID, so we have to reach down // into the kernel. #if defined(OS_LINUX) @@ -61,13 +63,13 @@ int32 CurrentThreadId() { #elif defined(OS_SOLARIS) return pthread_self(); #elif defined(OS_POSIX) - return reinterpret_cast<int64>(pthread_self()); + return reinterpret_cast<int64_t>(pthread_self()); #elif defined(OS_WIN) - return static_cast<int32>(::GetCurrentThreadId()); + return static_cast<int32_t>(::GetCurrentThreadId()); #endif } -uint64 TickCount() { +uint64_t TickCount() { #if defined(OS_WIN) return GetTickCount(); #elif defined(OS_MACOSX) @@ -76,9 +78,8 @@ uint64 TickCount() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - uint64 absolute_micro = - static_cast<int64>(ts.tv_sec) * 1000000 + - static_cast<int64>(ts.tv_nsec) / 1000; + uint64_t absolute_micro = static_cast<int64_t>(ts.tv_sec) * 1000000 + + static_cast<int64_t>(ts.tv_nsec) / 1000; return absolute_micro; #endif diff --git a/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc b/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc index 297ea84..59adfde 100644 --- a/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc +++ b/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" diff --git a/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h b/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h index 7717b66..410580d 100644 --- a/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h +++ b/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CDM_VIDEO_DECODER_H_ #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CDM_VIDEO_DECODER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/cdm/api/content_decryption_module.h" #include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h" diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.h b/media/cdm/ppapi/external_clear_key/clear_key_cdm.h index 1421f02..bc990c7 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.h +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.h @@ -10,7 +10,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/media/cdm/ppapi/external_clear_key/fake_cdm_video_decoder.h b/media/cdm/ppapi/external_clear_key/fake_cdm_video_decoder.h index 346c2e0..bd81a3f 100644 --- a/media/cdm/ppapi/external_clear_key/fake_cdm_video_decoder.h +++ b/media/cdm/ppapi/external_clear_key/fake_cdm_video_decoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FAKE_CDM_VIDEO_DECODER_H_ #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FAKE_CDM_VIDEO_DECODER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "media/cdm/api/content_decryption_module.h" #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" diff --git a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc index 29b29a5..2c82f0a 100644 --- a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc +++ b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc @@ -351,7 +351,7 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( // If we've exhausted the packet in the first decode we can write directly // into the frame buffer instead of a multistep serialization approach. if (serialized_audio_frames_.empty() && !packet.size) { - const uint32_t buffer_size = decoded_audio_size + sizeof(int64) * 2; + const uint32_t buffer_size = decoded_audio_size + sizeof(int64_t) * 2; decoded_frames->SetFrameBuffer(host_->Allocate(buffer_size)); if (!decoded_frames->FrameBuffer()) { LOG(ERROR) << "DecodeBuffer() ClearKeyCdmHost::Allocate failed."; @@ -360,11 +360,11 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( decoded_frames->FrameBuffer()->SetSize(buffer_size); uint8_t* output_buffer = decoded_frames->FrameBuffer()->Data(); - const int64 timestamp = output_timestamp.InMicroseconds(); + const int64_t timestamp = output_timestamp.InMicroseconds(); memcpy(output_buffer, ×tamp, sizeof(timestamp)); output_buffer += sizeof(timestamp); - const int64 output_size = decoded_audio_size; + const int64_t output_size = decoded_audio_size; memcpy(output_buffer, &output_size, sizeof(output_size)); output_buffer += sizeof(output_size); @@ -420,7 +420,7 @@ void FFmpegCdmAudioDecoder::ReleaseFFmpegResources() { av_frame_.reset(); } -void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) { +void FFmpegCdmAudioDecoder::SerializeInt64(int64_t value) { const size_t previous_size = serialized_audio_frames_.size(); serialized_audio_frames_.resize(previous_size + sizeof(value)); memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value)); diff --git a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h index e32b227..c5fe344 100644 --- a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h +++ b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" diff --git a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h index 70bd2bf..ca27355 100644 --- a/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h +++ b/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_VIDEO_DECODER_H_ #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_VIDEO_DECODER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" diff --git a/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.h b/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.h index 0a7638a..992f825 100644 --- a/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.h +++ b/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_LIBVPX_CDM_VIDEO_DECODER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "media/cdm/api/content_decryption_module.h" #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" diff --git a/media/cdm/ppapi/ppapi_cdm_adapter.h b/media/cdm/ppapi/ppapi_cdm_adapter.h index 989bd45..6240f28 100644 --- a/media/cdm/ppapi/ppapi_cdm_adapter.h +++ b/media/cdm/ppapi/ppapi_cdm_adapter.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "build/build_config.h" #include "media/cdm/api/content_decryption_module.h" diff --git a/media/cdm/ppapi/ppapi_cdm_buffer.h b/media/cdm/ppapi/ppapi_cdm_buffer.h index 2335a00..648d619 100644 --- a/media/cdm/ppapi/ppapi_cdm_buffer.h +++ b/media/cdm/ppapi/ppapi_cdm_buffer.h @@ -8,8 +8,8 @@ #include <map> #include <utility> -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "build/build_config.h" #include "media/cdm/api/content_decryption_module.h" #include "ppapi/c/pp_errors.h" diff --git a/media/cdm/proxy_decryptor.cc b/media/cdm/proxy_decryptor.cc index 09d45b6..7bcef96 100644 --- a/media/cdm/proxy_decryptor.cc +++ b/media/cdm/proxy_decryptor.cc @@ -28,9 +28,8 @@ const int kSessionClosedSystemCode = 29127; ProxyDecryptor::PendingGenerateKeyRequestData::PendingGenerateKeyRequestData( EmeInitDataType init_data_type, - const std::vector<uint8>& init_data) - : init_data_type(init_data_type), init_data(init_data) { -} + const std::vector<uint8_t>& init_data) + : init_data_type(init_data_type), init_data(init_data) {} ProxyDecryptor::PendingGenerateKeyRequestData:: ~PendingGenerateKeyRequestData() { @@ -117,9 +116,10 @@ void ProxyDecryptor::OnCdmCreated(const std::string& key_system, } void ProxyDecryptor::GenerateKeyRequest(EmeInitDataType init_data_type, - const uint8* init_data, + const uint8_t* init_data, int init_data_length) { - std::vector<uint8> init_data_vector(init_data, init_data + init_data_length); + std::vector<uint8_t> init_data_vector(init_data, + init_data + init_data_length); if (is_creating_cdm_) { pending_requests_.push_back( @@ -132,20 +132,20 @@ void ProxyDecryptor::GenerateKeyRequest(EmeInitDataType init_data_type, // Returns true if |data| is prefixed with |header| and has data after the // |header|. -static bool HasHeader(const std::vector<uint8>& data, +static bool HasHeader(const std::vector<uint8_t>& data, const std::string& header) { return data.size() > header.size() && std::equal(header.begin(), header.end(), data.begin()); } // Removes the first |length| items from |data|. -static void StripHeader(std::vector<uint8>& data, size_t length) { +static void StripHeader(std::vector<uint8_t>& data, size_t length) { data.erase(data.begin(), data.begin() + length); } void ProxyDecryptor::GenerateKeyRequestInternal( EmeInitDataType init_data_type, - const std::vector<uint8>& init_data) { + const std::vector<uint8_t>& init_data) { DVLOG(1) << __FUNCTION__; DCHECK(!is_creating_cdm_); @@ -159,7 +159,7 @@ void ProxyDecryptor::GenerateKeyRequestInternal( const char kPrefixedApiLoadSessionHeader[] = "LOAD_SESSION|"; SessionCreationType session_creation_type = TemporarySession; - std::vector<uint8> stripped_init_data = init_data; + std::vector<uint8_t> stripped_init_data = init_data; if (HasHeader(init_data, kPrefixedApiLoadSessionHeader)) { session_creation_type = LoadSession; StripHeader(stripped_init_data, strlen(kPrefixedApiLoadSessionHeader)); @@ -214,7 +214,7 @@ void ProxyDecryptor::GenerateKeyRequestInternal( void ProxyDecryptor::OnPermissionStatus( MediaKeys::SessionType session_type, EmeInitDataType init_data_type, - const std::vector<uint8>& init_data, + const std::vector<uint8_t>& init_data, scoped_ptr<NewSessionCdmPromise> promise, bool granted) { // ProxyDecryptor is only used by Prefixed EME, where RequestPermission() is @@ -227,9 +227,9 @@ void ProxyDecryptor::OnPermissionStatus( init_data, promise.Pass()); } -void ProxyDecryptor::AddKey(const uint8* key, +void ProxyDecryptor::AddKey(const uint8_t* key, int key_length, - const uint8* init_data, + const uint8_t* init_data, int init_data_length, const std::string& session_id) { DVLOG(1) << "AddKey()"; @@ -268,7 +268,7 @@ void ProxyDecryptor::AddKey(const uint8* key, // Decryptor doesn't support empty key ID (see http://crbug.com/123265). // So ensure a non-empty value is passed. if (!init_data) { - static const uint8 kDummyInitData[1] = {0}; + static const uint8_t kDummyInitData[1] = {0}; init_data = kDummyInitData; init_data_length = arraysize(kDummyInitData); } @@ -306,14 +306,14 @@ void ProxyDecryptor::CancelKeyRequest(const std::string& session_id) { void ProxyDecryptor::OnSessionMessage(const std::string& session_id, MediaKeys::MessageType message_type, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& legacy_destination_url) { // Assumes that OnSessionCreated() has been called before this. // For ClearKey, convert the message from JSON into just passing the key // as the message. If unable to extract the key, return the message unchanged. if (is_clear_key_) { - std::vector<uint8> key; + std::vector<uint8_t> key; if (ExtractFirstKeyIdFromLicenseRequest(message, &key)) { key_message_cb_.Run(session_id, key, legacy_destination_url); return; @@ -366,7 +366,7 @@ void ProxyDecryptor::OnSessionClosed(const std::string& session_id) { void ProxyDecryptor::OnLegacySessionError(const std::string& session_id, MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message) { // Convert |error_name| back to MediaKeys::KeyError if possible. Prefixed // EME has different error message, so all the specific error events will diff --git a/media/cdm/proxy_decryptor.h b/media/cdm/proxy_decryptor.h index bcf34c2..14a2b82 100644 --- a/media/cdm/proxy_decryptor.h +++ b/media/cdm/proxy_decryptor.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -44,9 +43,9 @@ class MEDIA_EXPORT ProxyDecryptor { typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; typedef base::Callback<void(const std::string& session_id, MediaKeys::KeyError error_code, - uint32 system_code)> KeyErrorCB; + uint32_t system_code)> KeyErrorCB; typedef base::Callback<void(const std::string& session_id, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& destination_url)> KeyMessageCB; ProxyDecryptor(MediaPermission* media_permission, @@ -66,10 +65,12 @@ class MEDIA_EXPORT ProxyDecryptor { // May only be called after CreateCDM(). void GenerateKeyRequest(EmeInitDataType init_data_type, - const uint8* init_data, + const uint8_t* init_data, int init_data_length); - void AddKey(const uint8* key, int key_length, - const uint8* init_data, int init_data_length, + void AddKey(const uint8_t* key, + int key_length, + const uint8_t* init_data, + int init_data_length, const std::string& session_id); void CancelKeyRequest(const std::string& session_id); @@ -82,12 +83,12 @@ class MEDIA_EXPORT ProxyDecryptor { const std::string& error_message); void GenerateKeyRequestInternal(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data); + const std::vector<uint8_t>& init_data); // Callbacks for firing session events. void OnSessionMessage(const std::string& session_id, MediaKeys::MessageType message_type, - const std::vector<uint8>& message, + const std::vector<uint8_t>& message, const GURL& legacy_destination_url); void OnSessionKeysChange(const std::string& session_id, bool has_additional_usable_key, @@ -98,13 +99,13 @@ class MEDIA_EXPORT ProxyDecryptor { void OnSessionClosed(const std::string& session_id); void OnLegacySessionError(const std::string& session_id, MediaKeys::Exception exception_code, - uint32 system_code, + uint32_t system_code, const std::string& error_message); // Callback for permission request. void OnPermissionStatus(MediaKeys::SessionType session_type, EmeInitDataType init_data_type, - const std::vector<uint8>& init_data, + const std::vector<uint8_t>& init_data, scoped_ptr<NewSessionCdmPromise> promise, bool granted); @@ -120,11 +121,11 @@ class MEDIA_EXPORT ProxyDecryptor { struct PendingGenerateKeyRequestData { PendingGenerateKeyRequestData(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data); + const std::vector<uint8_t>& init_data); ~PendingGenerateKeyRequestData(); const EmeInitDataType init_data_type; - const std::vector<uint8> init_data; + const std::vector<uint8_t> init_data; }; bool is_creating_cdm_; diff --git a/media/cdm/stub/stub_cdm.cc b/media/cdm/stub/stub_cdm.cc index 9fb1592..9636f53 100644 --- a/media/cdm/stub/stub_cdm.cc +++ b/media/cdm/stub/stub_cdm.cc @@ -54,11 +54,11 @@ void StubCdm::Initialize(bool /* allow_distinctive_identifier */, } void StubCdm::CreateSessionAndGenerateRequest( - uint32 promise_id, + uint32_t promise_id, cdm::SessionType /* session_type */, cdm::InitDataType /* init_data_type */, - const uint8* /* init_data */, - uint32 /* init_data_size */) { + const uint8_t* /* init_data */, + uint32_t /* init_data_size */) { // Provide a dummy message (with a trivial session ID) to enable some testing // and be consistent with existing testing without a license server. std::string session_id(base::UintToString(next_session_id_++)); @@ -70,35 +70,35 @@ void StubCdm::CreateSessionAndGenerateRequest( cdm::kLicenseRequest, nullptr, 0, nullptr, 0); } -void StubCdm::LoadSession(uint32 promise_id, +void StubCdm::LoadSession(uint32_t promise_id, cdm::SessionType /* session_type */, const char* /* session_id */, uint32_t /* session_id_length */) { FailRequest(promise_id); } -void StubCdm::UpdateSession(uint32 promise_id, +void StubCdm::UpdateSession(uint32_t promise_id, const char* /* session_id */, uint32_t /* session_id_length */, - const uint8* /* response */, - uint32 /* response_size */) { + const uint8_t* /* response */, + uint32_t /* response_size */) { FailRequest(promise_id); } -void StubCdm::CloseSession(uint32 promise_id, +void StubCdm::CloseSession(uint32_t promise_id, const char* /* session_id */, uint32_t /* session_id_length */) { FailRequest(promise_id); } -void StubCdm::RemoveSession(uint32 promise_id, +void StubCdm::RemoveSession(uint32_t promise_id, const char* /* session_id */, uint32_t /* session_id_length */) { FailRequest(promise_id); } void StubCdm::SetServerCertificate( - uint32 promise_id, + uint32_t promise_id, const uint8_t* /* server_certificate_data */, uint32_t /* server_certificate_data_size */) { FailRequest(promise_id); @@ -156,7 +156,7 @@ void StubCdm::OnQueryOutputProtectionStatus( NOTREACHED(); }; -void StubCdm::FailRequest(uint32 promise_id) { +void StubCdm::FailRequest(uint32_t promise_id) { std::string message("Operation not supported by stub CDM."); host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0, message.data(), diff --git a/media/cdm/stub/stub_cdm.h b/media/cdm/stub/stub_cdm.h index 0a9628f..a96e6bd 100644 --- a/media/cdm/stub/stub_cdm.h +++ b/media/cdm/stub/stub_cdm.h @@ -5,7 +5,6 @@ #ifndef MEDIA_CDM_STUB_STUB_CDM_H_ #define MEDIA_CDM_STUB_STUB_CDM_H_ -#include "base/basictypes.h" #include "media/cdm/api/content_decryption_module.h" namespace media { @@ -21,27 +20,27 @@ class StubCdm : public StubCdmInterface { // StubCdmInterface implementation. void Initialize(bool allow_distinctive_identifier, bool allow_persistent_state) override; - void CreateSessionAndGenerateRequest(uint32 promise_id, + void CreateSessionAndGenerateRequest(uint32_t promise_id, cdm::SessionType session_type, cdm::InitDataType init_data_type, - const uint8* init_data, - uint32 init_data_size) override; - void LoadSession(uint32 promise_id, + const uint8_t* init_data, + uint32_t init_data_size) override; + void LoadSession(uint32_t promise_id, cdm::SessionType session_type, const char* session_id, uint32_t session_id_length) override; - void UpdateSession(uint32 promise_id, + void UpdateSession(uint32_t promise_id, const char* session_id, uint32_t session_id_length, - const uint8* response, - uint32 response_size) override; - void CloseSession(uint32 promise_id, + const uint8_t* response, + uint32_t response_size) override; + void CloseSession(uint32_t promise_id, const char* session_id, uint32_t session_id_length) override; - void RemoveSession(uint32 promise_id, + void RemoveSession(uint32_t promise_id, const char* session_id, uint32_t session_id_length) override; - void SetServerCertificate(uint32 promise_id, + void SetServerCertificate(uint32_t promise_id, const uint8_t* server_certificate_data, uint32_t server_certificate_data_size) override; void TimerExpired(void* context) override; @@ -66,11 +65,11 @@ class StubCdm : public StubCdmInterface { private: // Helper function that rejects the promise specified by |promise_id|. - void FailRequest(uint32 promise_id); + void FailRequest(uint32_t promise_id); Host* host_; - uint32 next_session_id_; + uint32_t next_session_id_; DISALLOW_COPY_AND_ASSIGN(StubCdm); }; diff --git a/media/cdm/supported_cdm_versions.cc b/media/cdm/supported_cdm_versions.cc index 6a8f896..4c007e3f 100644 --- a/media/cdm/supported_cdm_versions.cc +++ b/media/cdm/supported_cdm_versions.cc @@ -4,7 +4,6 @@ #include "media/cdm/supported_cdm_versions.h" -#include "base/basictypes.h" #include "media/cdm/api/content_decryption_module.h" namespace media { diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index 772b41d..88c29b1 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -4,7 +4,6 @@ #include "media/ffmpeg/ffmpeg_common.h" -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/sha1.h" @@ -52,13 +51,13 @@ static_assert( static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond }; base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, - int64 timestamp) { - int64 microseconds = av_rescale_q(timestamp, time_base, kMicrosBase); + int64_t timestamp) { + int64_t microseconds = av_rescale_q(timestamp, time_base, kMicrosBase); return base::TimeDelta::FromMicroseconds(microseconds); } -int64 ConvertToTimeBase(const AVRational& time_base, - const base::TimeDelta& timestamp) { +int64_t ConvertToTimeBase(const AVRational& time_base, + const base::TimeDelta& timestamp) { return av_rescale_q(timestamp.InMicroseconds(), kMicrosBase, time_base); } diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h index 955ee64..df4bab5 100644 --- a/media/ffmpeg/ffmpeg_common.h +++ b/media/ffmpeg/ffmpeg_common.h @@ -75,19 +75,19 @@ inline void ScopedPtrAVFreeFrame::operator()(void* x) const { av_frame_free(&frame); } -// Converts an int64 timestamp in |time_base| units to a base::TimeDelta. +// Converts an int64_t timestamp in |time_base| units to a base::TimeDelta. // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} // then the return value will be a base::TimeDelta for 0.25 seconds since that // is how much time 11025/44100ths of a second represents. MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, - int64 timestamp); + int64_t timestamp); -// Converts a base::TimeDelta into an int64 timestamp in |time_base| units. +// Converts a base::TimeDelta into an int64_t timestamp in |time_base| units. // For example if |timestamp| is 0.5 seconds and |time_base| is {1, 44100}, then // the return value will be 22050 since that is how many 1/44100ths of a second // represent 0.5 seconds. -MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, - const base::TimeDelta& timestamp); +MEDIA_EXPORT int64_t ConvertToTimeBase(const AVRational& time_base, + const base::TimeDelta& timestamp); // Returns true if AVStream is successfully converted to a AudioDecoderConfig. // Returns false if conversion fails, in which case |config| is not modified. diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc index 9a73587..bc575f9 100644 --- a/media/ffmpeg/ffmpeg_common_unittest.cc +++ b/media/ffmpeg/ffmpeg_common_unittest.cc @@ -136,10 +136,8 @@ TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) { } TEST_F(FFmpegCommonTest, TimeBaseConversions) { - const int64 test_data[][5] = { - {1, 2, 1, 500000, 1 }, - {1, 3, 1, 333333, 1 }, - {1, 3, 2, 666667, 2 }, + const int64_t test_data[][5] = { + {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, }; for (size_t i = 0; i < arraysize(test_data); ++i) { diff --git a/media/filters/audio_decoder_unittest.cc b/media/filters/audio_decoder_unittest.cc index 79d7702..28bb251 100644 --- a/media/filters/audio_decoder_unittest.cc +++ b/media/filters/audio_decoder_unittest.cc @@ -43,8 +43,8 @@ enum AudioDecoderType { }; struct DecodedBufferExpectations { - const int64 timestamp; - const int64 duration; + const int64_t timestamp; + const int64_t duration; const char* hash; }; @@ -83,8 +83,8 @@ static void SetDiscardPadding(AVPacket* packet, // If the timestamp is positive, try to use FFmpeg's discard data. int skip_samples_size = 0; - const uint32* skip_samples_ptr = - reinterpret_cast<const uint32*>(av_packet_get_side_data( + const uint32_t* skip_samples_ptr = + reinterpret_cast<const uint32_t*>(av_packet_get_side_data( packet, AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); if (skip_samples_size < 4) return; diff --git a/media/filters/audio_file_reader.h b/media/filters/audio_file_reader.h index c700b32..68a4c92 100644 --- a/media/filters/audio_file_reader.h +++ b/media/filters/audio_file_reader.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_AUDIO_FILE_READER_H_ #define MEDIA_FILTERS_AUDIO_FILE_READER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" #include "media/filters/ffmpeg_glue.h" diff --git a/media/filters/audio_renderer_algorithm_unittest.cc b/media/filters/audio_renderer_algorithm_unittest.cc index 986d6b5..37320b8 100644 --- a/media/filters/audio_renderer_algorithm_unittest.cc +++ b/media/filters/audio_renderer_algorithm_unittest.cc @@ -105,37 +105,22 @@ class AudioRendererAlgorithmTest : public testing::Test { while (!algorithm_.IsQueueFull()) { switch (sample_format_) { case kSampleFormatU8: - buffer = MakeAudioBuffer<uint8>( - sample_format_, - channel_layout_, - ChannelLayoutToChannelCount(channel_layout_), - samples_per_second_, - 1, - 1, - kFrameSize, - kNoTimestamp()); + buffer = MakeAudioBuffer<uint8_t>( + sample_format_, channel_layout_, + ChannelLayoutToChannelCount(channel_layout_), samples_per_second_, + 1, 1, kFrameSize, kNoTimestamp()); break; case kSampleFormatS16: - buffer = MakeAudioBuffer<int16>( - sample_format_, - channel_layout_, - ChannelLayoutToChannelCount(channel_layout_), - samples_per_second_, - 1, - 1, - kFrameSize, - kNoTimestamp()); + buffer = MakeAudioBuffer<int16_t>( + sample_format_, channel_layout_, + ChannelLayoutToChannelCount(channel_layout_), samples_per_second_, + 1, 1, kFrameSize, kNoTimestamp()); break; case kSampleFormatS32: - buffer = MakeAudioBuffer<int32>( - sample_format_, - channel_layout_, - ChannelLayoutToChannelCount(channel_layout_), - samples_per_second_, - 1, - 1, - kFrameSize, - kNoTimestamp()); + buffer = MakeAudioBuffer<int32_t>( + sample_format_, channel_layout_, + ChannelLayoutToChannelCount(channel_layout_), samples_per_second_, + 1, 1, kFrameSize, kNoTimestamp()); break; default: NOTREACHED() << "Unrecognized format " << sample_format_; @@ -268,7 +253,7 @@ class AudioRendererAlgorithmTest : public testing::Test { kSampleRateHz, kPulseWidthSamples); - const std::vector<uint8*>& channel_data = input->channel_data(); + const std::vector<uint8_t*>& channel_data = input->channel_data(); // Fill |input| channels. FillWithSquarePulseTrain(kHalfPulseWidthSamples, 0, kPulseWidthSamples, diff --git a/media/filters/blocking_url_protocol.cc b/media/filters/blocking_url_protocol.cc index e50b677..6dffacc 100644 --- a/media/filters/blocking_url_protocol.cc +++ b/media/filters/blocking_url_protocol.cc @@ -27,14 +27,14 @@ void BlockingUrlProtocol::Abort() { aborted_.Signal(); } -int BlockingUrlProtocol::Read(int size, uint8* data) { +int BlockingUrlProtocol::Read(int size, uint8_t* data) { // Read errors are unrecoverable. if (aborted_.IsSignaled()) return AVERROR(EIO); // Even though FFmpeg defines AVERROR_EOF, it's not to be used with I/O // routines. Instead return 0 for any read at or past EOF. - int64 file_size; + int64_t file_size; if (data_source_->GetSize(&file_size) && read_position_ >= file_size) return 0; @@ -60,13 +60,13 @@ int BlockingUrlProtocol::Read(int size, uint8* data) { return last_read_bytes_; } -bool BlockingUrlProtocol::GetPosition(int64* position_out) { +bool BlockingUrlProtocol::GetPosition(int64_t* position_out) { *position_out = read_position_; return true; } -bool BlockingUrlProtocol::SetPosition(int64 position) { - int64 file_size; +bool BlockingUrlProtocol::SetPosition(int64_t position) { + int64_t file_size; if ((data_source_->GetSize(&file_size) && position > file_size) || position < 0) { return false; @@ -76,7 +76,7 @@ bool BlockingUrlProtocol::SetPosition(int64 position) { return true; } -bool BlockingUrlProtocol::GetSize(int64* size_out) { +bool BlockingUrlProtocol::GetSize(int64_t* size_out) { return data_source_->GetSize(size_out); } diff --git a/media/filters/blocking_url_protocol.h b/media/filters/blocking_url_protocol.h index dbeeef9..c749c36 100644 --- a/media/filters/blocking_url_protocol.h +++ b/media/filters/blocking_url_protocol.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_ #define MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/synchronization/waitable_event.h" #include "media/filters/ffmpeg_glue.h" @@ -31,10 +30,10 @@ class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol { void Abort(); // FFmpegURLProtocol implementation. - int Read(int size, uint8* data) override; - bool GetPosition(int64* position_out) override; - bool SetPosition(int64 position) override; - bool GetSize(int64* size_out) override; + int Read(int size, uint8_t* data) override; + bool GetPosition(int64_t* position_out) override; + bool SetPosition(int64_t position) override; + bool GetSize(int64_t* size_out) override; bool IsStreaming() override; private: @@ -53,7 +52,7 @@ class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol { int last_read_bytes_; // Cached position within the data source. - int64 read_position_; + int64_t read_position_; DISALLOW_IMPLICIT_CONSTRUCTORS(BlockingUrlProtocol); }; diff --git a/media/filters/blocking_url_protocol_unittest.cc b/media/filters/blocking_url_protocol_unittest.cc index ec55a00..aed79c4 100644 --- a/media/filters/blocking_url_protocol_unittest.cc +++ b/media/filters/blocking_url_protocol_unittest.cc @@ -39,13 +39,13 @@ class BlockingUrlProtocolTest : public testing::Test { TEST_F(BlockingUrlProtocolTest, Read) { // Set read head to zero as Initialize() will have parsed a bit of the file. - int64 position = 0; + int64_t position = 0; EXPECT_TRUE(url_protocol_.SetPosition(0)); EXPECT_TRUE(url_protocol_.GetPosition(&position)); EXPECT_EQ(0, position); // Read 32 bytes from offset zero and verify position. - uint8 buffer[32]; + uint8_t buffer[32]; EXPECT_EQ(32, url_protocol_.Read(32, buffer)); EXPECT_TRUE(url_protocol_.GetPosition(&position)); EXPECT_EQ(32, position); @@ -56,7 +56,7 @@ TEST_F(BlockingUrlProtocolTest, Read) { EXPECT_EQ(64, position); // Seek to end and read until EOF. - int64 size = 0; + int64_t size = 0; EXPECT_TRUE(url_protocol_.GetSize(&size)); EXPECT_TRUE(url_protocol_.SetPosition(size - 48)); EXPECT_EQ(32, url_protocol_.Read(32, buffer)); @@ -75,14 +75,14 @@ TEST_F(BlockingUrlProtocolTest, Read) { TEST_F(BlockingUrlProtocolTest, ReadError) { data_source_.force_read_errors_for_testing(); - uint8 buffer[32]; + uint8_t buffer[32]; EXPECT_CALL(*this, OnDataSourceError()); EXPECT_EQ(AVERROR(EIO), url_protocol_.Read(32, buffer)); } TEST_F(BlockingUrlProtocolTest, GetSetPosition) { - int64 size; - int64 position; + int64_t size; + int64_t position; EXPECT_TRUE(url_protocol_.GetSize(&size)); EXPECT_TRUE(url_protocol_.GetPosition(&position)); @@ -98,8 +98,8 @@ TEST_F(BlockingUrlProtocolTest, GetSetPosition) { } TEST_F(BlockingUrlProtocolTest, GetSize) { - int64 data_source_size = 0; - int64 url_protocol_size = 0; + int64_t data_source_size = 0; + int64_t url_protocol_size = 0; EXPECT_TRUE(data_source_.GetSize(&data_source_size)); EXPECT_TRUE(url_protocol_.GetSize(&url_protocol_size)); EXPECT_NE(0, data_source_size); diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 6ddd3be..60b0700 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc @@ -33,27 +33,26 @@ using ::testing::_; namespace media { -const uint8 kTracksHeader[] = { - 0x16, 0x54, 0xAE, 0x6B, // Tracks ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tracks(size = 0) +const uint8_t kTracksHeader[] = { + 0x16, 0x54, 0xAE, 0x6B, // Tracks ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tracks(size = 0) }; // WebM Block bytes that represent a VP8 key frame. -const uint8 kVP8Keyframe[] = { - 0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00 -}; +const uint8_t kVP8Keyframe[] = {0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, + 0x00, 0x10, 0x00, 0x10, 0x00}; // WebM Block bytes that represent a VP8 interframe. -const uint8 kVP8Interframe[] = { 0x11, 0x00, 0x00 }; +const uint8_t kVP8Interframe[] = {0x11, 0x00, 0x00}; -const uint8 kCuesHeader[] = { - 0x1C, 0x53, 0xBB, 0x6B, // Cues ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cues(size = 0) +const uint8_t kCuesHeader[] = { + 0x1C, 0x53, 0xBB, 0x6B, // Cues ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cues(size = 0) }; -const uint8 kEncryptedMediaInitData[] = { - 0x68, 0xFE, 0xF9, 0xA1, 0xB3, 0x0D, 0x6B, 0x4D, - 0xF2, 0x22, 0xB5, 0x0B, 0x4D, 0xE9, 0xE9, 0x95, +const uint8_t kEncryptedMediaInitData[] = { + 0x68, 0xFE, 0xF9, 0xA1, 0xB3, 0x0D, 0x6B, 0x4D, + 0xF2, 0x22, 0xB5, 0x0B, 0x4D, 0xE9, 0xE9, 0x95, }; const int kTracksHeaderSize = sizeof(kTracksHeader); @@ -95,10 +94,10 @@ base::TimeDelta kDefaultDuration() { // Write an integer into buffer in the form of vint that spans 8 bytes. // The data pointed by |buffer| should be at least 8 bytes long. // |number| should be in the range 0 <= number < 0x00FFFFFFFFFFFFFF. -static void WriteInt64(uint8* buffer, int64 number) { +static void WriteInt64(uint8_t* buffer, int64_t number) { DCHECK(number >= 0 && number < 0x00FFFFFFFFFFFFFFLL); buffer[0] = 0x01; - int64 tmp = number; + int64_t tmp = number; for (int i = 7; i > 0; i--) { buffer[i] = tmp & 0xff; tmp >>= 8; @@ -189,7 +188,7 @@ class ChunkDemuxerTest : public ::testing::Test { void CreateInitSegment(int stream_flags, bool is_audio_encrypted, bool is_video_encrypted, - scoped_ptr<uint8[]>* buffer, + scoped_ptr<uint8_t[]>* buffer, int* size) { CreateInitSegmentInternal( stream_flags, is_audio_encrypted, is_video_encrypted, buffer, false, @@ -199,7 +198,7 @@ class ChunkDemuxerTest : public ::testing::Test { void CreateInitSegmentWithAlternateTextTrackNum(int stream_flags, bool is_audio_encrypted, bool is_video_encrypted, - scoped_ptr<uint8[]>* buffer, + scoped_ptr<uint8_t[]>* buffer, int* size) { DCHECK(stream_flags & HAS_TEXT); CreateInitSegmentInternal( @@ -210,7 +209,7 @@ class ChunkDemuxerTest : public ::testing::Test { void CreateInitSegmentInternal(int stream_flags, bool is_audio_encrypted, bool is_video_encrypted, - scoped_ptr<uint8[]>* buffer, + scoped_ptr<uint8_t[]>* buffer, bool use_alternate_text_track_id, int* size) { bool has_audio = (stream_flags & HAS_AUDIO) != 0; @@ -269,7 +268,7 @@ class ChunkDemuxerTest : public ::testing::Test { const int len = strlen(str); DCHECK_EQ(len, 32); - const uint8* const buf = reinterpret_cast<const uint8*>(str); + const uint8_t* const buf = reinterpret_cast<const uint8_t*>(str); text_track_entry = DecoderBuffer::CopyFrom(buf, len); tracks_element_size += text_track_entry->data_size(); } @@ -277,9 +276,9 @@ class ChunkDemuxerTest : public ::testing::Test { *size = ebml_header->data_size() + info->data_size() + kTracksHeaderSize + tracks_element_size; - buffer->reset(new uint8[*size]); + buffer->reset(new uint8_t[*size]); - uint8* buf = buffer->get(); + uint8_t* buf = buffer->get(); memcpy(buf, ebml_header->data(), ebml_header->data_size()); buf += ebml_header->data_size(); @@ -366,7 +365,7 @@ class ChunkDemuxerTest : public ::testing::Test { return demuxer_->AddId(source_id, type, codecs); } - void AppendData(const uint8* data, size_t length) { + void AppendData(const uint8_t* data, size_t length) { AppendData(kSourceId, data, length); } @@ -478,7 +477,7 @@ class ChunkDemuxerTest : public ::testing::Test { DCHECK_GT(blocks.size(), 0u); ClusterBuilder cb; - std::vector<uint8> data(10); + std::vector<uint8_t> data(10); for (size_t i = 0; i < blocks.size(); ++i) { if (i == 0) cb.SetClusterTimecode(blocks[i].timestamp_in_ms); @@ -575,7 +574,8 @@ class ChunkDemuxerTest : public ::testing::Test { } void AppendData(const std::string& source_id, - const uint8* data, size_t length) { + const uint8_t* data, + size_t length) { EXPECT_CALL(host_, AddBufferedTimeRange(_, _)).Times(AnyNumber()); demuxer_->AppendData(source_id, data, length, @@ -585,13 +585,15 @@ class ChunkDemuxerTest : public ::testing::Test { init_segment_received_cb_); } - void AppendDataInPieces(const uint8* data, size_t length) { + void AppendDataInPieces(const uint8_t* data, size_t length) { AppendDataInPieces(data, length, 7); } - void AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { - const uint8* start = data; - const uint8* end = data + length; + void AppendDataInPieces(const uint8_t* data, + size_t length, + size_t piece_size) { + const uint8_t* start = data; + const uint8_t* end = data + length; while (start < end) { size_t append_size = std::min(piece_size, static_cast<size_t>(end - start)); @@ -613,7 +615,7 @@ class ChunkDemuxerTest : public ::testing::Test { int stream_flags, bool is_audio_encrypted, bool is_video_encrypted) { - scoped_ptr<uint8[]> info_tracks; + scoped_ptr<uint8_t[]> info_tracks; int info_tracks_size = 0; CreateInitSegment(stream_flags, is_audio_encrypted, is_video_encrypted, @@ -624,7 +626,7 @@ class ChunkDemuxerTest : public ::testing::Test { void AppendGarbage() { // Fill up an array with gibberish. int garbage_cluster_size = 10; - scoped_ptr<uint8[]> garbage_cluster(new uint8[garbage_cluster_size]); + scoped_ptr<uint8_t[]> garbage_cluster(new uint8_t[garbage_cluster_size]); for (int i = 0; i < garbage_cluster_size; ++i) garbage_cluster[i] = i; AppendData(garbage_cluster.get(), garbage_cluster_size); @@ -800,8 +802,8 @@ class ChunkDemuxerTest : public ::testing::Test { } } - void AddSimpleBlock(ClusterBuilder* cb, int track_num, int64 timecode) { - uint8 data[] = { 0x00 }; + void AddSimpleBlock(ClusterBuilder* cb, int track_num, int64_t timecode) { + uint8_t data[] = {0x00}; cb->AddSimpleBlock(track_num, timecode, 0, data, sizeof(data)); } @@ -809,9 +811,12 @@ class ChunkDemuxerTest : public ::testing::Test { return GenerateCluster(timecode, timecode, block_count); } - void AddVideoBlockGroup(ClusterBuilder* cb, int track_num, int64 timecode, - int duration, int flags) { - const uint8* data = + void AddVideoBlockGroup(ClusterBuilder* cb, + int track_num, + int64_t timecode, + int duration, + int flags) { + const uint8_t* data = (flags & kWebMFlagKeyframe) != 0 ? kVP8Keyframe : kVP8Interframe; int size = (flags & kWebMFlagKeyframe) != 0 ? sizeof(kVP8Keyframe) : sizeof(kVP8Interframe); @@ -845,7 +850,7 @@ class ChunkDemuxerTest : public ::testing::Test { // Create simple blocks for everything except the last 2 blocks. // The first video frame must be a key frame. - uint8 video_flag = kWebMFlagKeyframe; + uint8_t video_flag = kWebMFlagKeyframe; for (int i = 0; i < block_count - 2; i++) { if (audio_timecode <= video_timecode) { block_queue.push(BlockInfo(kAudioTrackNum, @@ -884,7 +889,7 @@ class ChunkDemuxerTest : public ::testing::Test { int block_duration) { CHECK_GT(end_timecode, timecode); - std::vector<uint8> data(kBlockSize); + std::vector<uint8_t> data(kBlockSize); ClusterBuilder cb; cb.SetClusterTimecode(timecode); @@ -1041,7 +1046,7 @@ class ChunkDemuxerTest : public ::testing::Test { message_loop_.RunUntilIdle(); } - void ExpectRead(DemuxerStream::Type type, int64 timestamp_in_ms) { + void ExpectRead(DemuxerStream::Type type, int64_t timestamp_in_ms) { EXPECT_CALL(*this, ReadDone(DemuxerStream::kOk, HasTimestamp(timestamp_in_ms))); demuxer_->GetStream(type)->Read(base::Bind( @@ -1158,7 +1163,7 @@ class ChunkDemuxerTest : public ::testing::Test { MOCK_METHOD0(DemuxerOpened, void()); MOCK_METHOD2(OnEncryptedMediaInitData, void(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data)); + const std::vector<uint8_t>& init_data)); MOCK_METHOD0(InitSegmentReceived, void(void)); @@ -1221,7 +1226,7 @@ TEST_F(ChunkDemuxerTest, Init) { (is_video_encrypted ? 1 : 0); EXPECT_CALL(*this, OnEncryptedMediaInitData( EmeInitDataType::WEBM, - std::vector<uint8>( + std::vector<uint8_t>( kEncryptedMediaInitData, kEncryptedMediaInitData + arraysize(kEncryptedMediaInitData)))) @@ -1366,7 +1371,7 @@ TEST_F(ChunkDemuxerTest, SingleTextTrackIdChange) { MuxedStreamInfo(kTextTrackNum, "10K")); CheckExpectedRanges(kSourceId, "{ [0,46) }"); - scoped_ptr<uint8[]> info_tracks; + scoped_ptr<uint8_t[]> info_tracks; int info_tracks_size = 0; CreateInitSegmentWithAlternateTextTrackNum(HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false, @@ -1558,7 +1563,7 @@ TEST_F(ChunkDemuxerTest, SeekWhileParsingCluster) { // Test the case where AppendData() is called before Init(). TEST_F(ChunkDemuxerTest, AppendDataBeforeInit) { - scoped_ptr<uint8[]> info_tracks; + scoped_ptr<uint8_t[]> info_tracks; int info_tracks_size = 0; CreateInitSegment(HAS_AUDIO | HAS_VIDEO, false, false, &info_tracks, &info_tracks_size); @@ -1946,7 +1951,7 @@ TEST_F(ChunkDemuxerTest, AppendingInPieces) { ASSERT_EQ(AddId(), ChunkDemuxer::kOk); - scoped_ptr<uint8[]> info_tracks; + scoped_ptr<uint8_t[]> info_tracks; int info_tracks_size = 0; CreateInitSegment(HAS_AUDIO | HAS_VIDEO, false, false, &info_tracks, &info_tracks_size); @@ -1955,8 +1960,8 @@ TEST_F(ChunkDemuxerTest, AppendingInPieces) { scoped_ptr<Cluster> cluster_b(kDefaultSecondCluster()); size_t buffer_size = info_tracks_size + cluster_a->size() + cluster_b->size(); - scoped_ptr<uint8[]> buffer(new uint8[buffer_size]); - uint8* dst = buffer.get(); + scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); + uint8_t* dst = buffer.get(); memcpy(dst, info_tracks.get(), info_tracks_size); dst += info_tracks_size; @@ -2127,7 +2132,7 @@ TEST_F(ChunkDemuxerTest, ParseErrorDuringInit) { ASSERT_EQ(AddId(), ChunkDemuxer::kOk); - uint8 tmp = 0; + uint8_t tmp = 0; demuxer_->AppendData(kSourceId, &tmp, 1, append_window_start_for_next_append_, append_window_end_for_next_append_, @@ -3125,14 +3130,16 @@ TEST_F(ChunkDemuxerTest, SeekCompleteDuringAbort) { #endif TEST_F(ChunkDemuxerTest, WebMIsParsingMediaSegmentDetection) { - const uint8 kBuffer[] = { - 0x1F, 0x43, 0xB6, 0x75, 0x83, // CLUSTER (size = 3) - 0xE7, 0x81, 0x01, // Cluster TIMECODE (value = 1) - - 0x1F, 0x43, 0xB6, 0x75, 0xFF, // CLUSTER (size = unknown; really 3 due to:) - 0xE7, 0x81, 0x02, // Cluster TIMECODE (value = 2) - /* e.g. put some blocks here... */ - 0x1A, 0x45, 0xDF, 0xA3, 0x8A, // EBMLHEADER (size = 10, not fully appended) + const uint8_t kBuffer[] = { + 0x1F, 0x43, 0xB6, 0x75, 0x83, // CLUSTER (size = 3) + 0xE7, 0x81, 0x01, // Cluster TIMECODE (value = 1) + + 0x1F, 0x43, 0xB6, 0x75, + 0xFF, // CLUSTER (size = unknown; really 3 due to:) + 0xE7, 0x81, 0x02, // Cluster TIMECODE (value = 2) + /* e.g. put some blocks here... */ + 0x1A, 0x45, 0xDF, 0xA3, + 0x8A, // EBMLHEADER (size = 10, not fully appended) }; // This array indicates expected return value of IsParsingMediaSegment() @@ -3901,7 +3908,7 @@ TEST_F(ChunkDemuxerTest, CuesBetweenClustersWithUnknownSize) { // Add two clusters separated by Cues in a single Append() call. scoped_ptr<Cluster> cluster = GenerateCluster(0, 0, 4, true); - std::vector<uint8> data(cluster->data(), cluster->data() + cluster->size()); + std::vector<uint8_t> data(cluster->data(), cluster->data() + cluster->size()); data.insert(data.end(), kCuesHeader, kCuesHeader + sizeof(kCuesHeader)); cluster = GenerateCluster(46, 66, 5, true); data.insert(data.end(), cluster->data(), cluster->data() + cluster->size()); diff --git a/media/filters/decoder_stream.h b/media/filters/decoder_stream.h index 080064d..3f4d580 100644 --- a/media/filters/decoder_stream.h +++ b/media/filters/decoder_stream.h @@ -7,7 +7,6 @@ #include <list> -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" diff --git a/media/filters/decrypting_audio_decoder.cc b/media/filters/decrypting_audio_decoder.cc index 42f1939..a655782 100644 --- a/media/filters/decrypting_audio_decoder.cc +++ b/media/filters/decrypting_audio_decoder.cc @@ -26,7 +26,7 @@ static inline bool IsOutOfSync(const base::TimeDelta& timestamp_1, const base::TimeDelta& timestamp_2) { // Out of sync of 100ms would be pretty noticeable and we should keep any // drift below that. - const int64 kOutOfSyncThresholdInMilliseconds = 100; + const int64_t kOutOfSyncThresholdInMilliseconds = 100; return std::abs(timestamp_1.InMilliseconds() - timestamp_2.InMilliseconds()) > kOutOfSyncThresholdInMilliseconds; } diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc index 733a6e6..c3c44c6 100644 --- a/media/filters/decrypting_audio_decoder_unittest.cc +++ b/media/filters/decrypting_audio_decoder_unittest.cc @@ -32,8 +32,8 @@ const int kSampleRate = 44100; // Make sure the kFakeAudioFrameSize is a valid frame size for all audio decoder // configs used in this test. const int kFakeAudioFrameSize = 48; -const uint8 kFakeKeyId[] = { 0x4b, 0x65, 0x79, 0x20, 0x49, 0x44 }; -const uint8 kFakeIv[DecryptConfig::kDecryptionKeySize] = { 0 }; +const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44}; +const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0}; const int kDecodingDelay = 3; // Create a fake non-empty encrypted buffer. diff --git a/media/filters/decrypting_demuxer_stream_unittest.cc b/media/filters/decrypting_demuxer_stream_unittest.cc index 87c5d5e..5efc590 100644 --- a/media/filters/decrypting_demuxer_stream_unittest.cc +++ b/media/filters/decrypting_demuxer_stream_unittest.cc @@ -26,8 +26,8 @@ using ::testing::StrictMock; namespace media { static const int kFakeBufferSize = 16; -static const uint8 kFakeKeyId[] = { 0x4b, 0x65, 0x79, 0x20, 0x49, 0x44 }; -static const uint8 kFakeIv[DecryptConfig::kDecryptionKeySize] = { 0 }; +static const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44}; +static const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0}; // Create a fake non-empty buffer in an encrypted stream. When |is_clear| is // true, the buffer is not encrypted (signaled by an empty IV). diff --git a/media/filters/decrypting_video_decoder.h b/media/filters/decrypting_video_decoder.h index 0651edb..14e1746 100644 --- a/media/filters/decrypting_video_decoder.h +++ b/media/filters/decrypting_video_decoder.h @@ -114,7 +114,7 @@ class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the // matching DecryptCB call (in DoDeliverFrame()). - uint32 trace_id_; + uint32_t trace_id_; base::WeakPtr<DecryptingVideoDecoder> weak_this_; base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_; diff --git a/media/filters/decrypting_video_decoder_unittest.cc b/media/filters/decrypting_video_decoder_unittest.cc index 5fcb74e..730da67 100644 --- a/media/filters/decrypting_video_decoder_unittest.cc +++ b/media/filters/decrypting_video_decoder_unittest.cc @@ -25,8 +25,8 @@ using ::testing::StrictMock; namespace media { -const uint8 kFakeKeyId[] = { 0x4b, 0x65, 0x79, 0x20, 0x49, 0x44 }; -const uint8 kFakeIv[DecryptConfig::kDecryptionKeySize] = { 0 }; +const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44}; +const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0}; const int kDecodingDelay = 3; // Create a fake non-empty encrypted buffer. diff --git a/media/filters/fake_video_decoder_unittest.cc b/media/filters/fake_video_decoder_unittest.cc index 533022c..ccefc22 100644 --- a/media/filters/fake_video_decoder_unittest.cc +++ b/media/filters/fake_video_decoder_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "media/base/decoder_buffer.h" diff --git a/media/filters/ffmpeg_aac_bitstream_converter.cc b/media/filters/ffmpeg_aac_bitstream_converter.cc index a0f175f..ce5e8a2 100644 --- a/media/filters/ffmpeg_aac_bitstream_converter.cc +++ b/media/filters/ffmpeg_aac_bitstream_converter.cc @@ -14,11 +14,20 @@ namespace { // Creates an ADTS header and stores in |hdr| // Assumes |hdr| points to an array of length |kAdtsHeaderSize| // Returns false if parameter values are for an unsupported configuration. -bool GenerateAdtsHeader( - int codec, int layer, int audio_profile, int sample_rate_index, - int private_stream, int channel_configuration, int originality, int home, - int copyrighted_stream, int copyright_start, int frame_length, - int buffer_fullness, int number_of_frames_minus_one, uint8* hdr) { +bool GenerateAdtsHeader(int codec, + int layer, + int audio_profile, + int sample_rate_index, + int private_stream, + int channel_configuration, + int originality, + int home, + int copyrighted_stream, + int copyright_start, + int frame_length, + int buffer_fullness, + int number_of_frames_minus_one, + uint8_t* hdr) { DCHECK_EQ(codec, AV_CODEC_ID_AAC); memset(reinterpret_cast<void *>(hdr), 0, diff --git a/media/filters/ffmpeg_aac_bitstream_converter.h b/media/filters/ffmpeg_aac_bitstream_converter.h index c7328e6..fcf4206 100644 --- a/media/filters/ffmpeg_aac_bitstream_converter.h +++ b/media/filters/ffmpeg_aac_bitstream_converter.h @@ -5,7 +5,10 @@ #ifndef MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ -#include "base/basictypes.h" +#include <stdint.h> + +#include "base/macros.h" + #include "media/base/media_export.h" #include "media/filters/ffmpeg_bitstream_converter.h" diff --git a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc index 6f92f76..520bce1 100644 --- a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc +++ b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc @@ -30,7 +30,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test { test_context_.extradata_size = sizeof(context_header_); } - void CreatePacket(AVPacket* packet, const uint8* data, uint32 data_size) { + void CreatePacket(AVPacket* packet, const uint8_t* data, uint32_t data_size) { // Create new packet sized of |data_size| from |data|. EXPECT_EQ(av_new_packet(packet, data_size), 0); memcpy(packet->data, data, data_size); @@ -40,7 +40,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test { AVCodecContext test_context_; private: - uint8 context_header_[2]; + uint8_t context_header_[2]; DISALLOW_COPY_AND_ASSIGN(FFmpegAACBitstreamConverterTest); }; @@ -48,7 +48,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test { TEST_F(FFmpegAACBitstreamConverterTest, Conversion_Success) { FFmpegAACBitstreamConverter converter(&test_context_); - uint8 dummy_packet[1000]; + uint8_t dummy_packet[1000]; // Fill dummy packet with junk data. aac converter doesn't look into packet // data, just header, so can fill with whatever we want for test. for(size_t i = 0; i < sizeof(dummy_packet); i++) { @@ -81,7 +81,7 @@ TEST_F(FFmpegAACBitstreamConverterTest, Conversion_FailureNullParams) { dummy_context.extradata_size = 0; FFmpegAACBitstreamConverter converter(&dummy_context); - uint8 dummy_packet[1000] = {0}; + uint8_t dummy_packet[1000] = {0}; // Try out the actual conversion with NULL parameter. EXPECT_FALSE(converter.ConvertPacket(NULL)); @@ -97,7 +97,7 @@ TEST_F(FFmpegAACBitstreamConverterTest, Conversion_FailureNullParams) { TEST_F(FFmpegAACBitstreamConverterTest, Conversion_AudioProfileType) { FFmpegAACBitstreamConverter converter(&test_context_); - uint8 dummy_packet[1000] = {0}; + uint8_t dummy_packet[1000] = {0}; ScopedAVPacket test_packet(new AVPacket()); CreatePacket(test_packet.get(), dummy_packet, @@ -136,7 +136,7 @@ TEST_F(FFmpegAACBitstreamConverterTest, Conversion_AudioProfileType) { TEST_F(FFmpegAACBitstreamConverterTest, Conversion_MultipleLength) { FFmpegAACBitstreamConverter converter(&test_context_); - uint8 dummy_packet[1000]; + uint8_t dummy_packet[1000]; ScopedAVPacket test_packet(new AVPacket()); CreatePacket(test_packet.get(), dummy_packet, diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc index 2ad55cd..a81f2b3 100644 --- a/media/filters/ffmpeg_audio_decoder.cc +++ b/media/filters/ffmpeg_audio_decoder.cc @@ -42,7 +42,7 @@ static inline int DetermineChannels(AVFrame* frame) { // Called by FFmpeg's allocation routine to free a buffer. |opaque| is the // AudioBuffer allocated, so unref it. -static void ReleaseAudioBufferImpl(void* opaque, uint8* data) { +static void ReleaseAudioBufferImpl(void* opaque, uint8_t* data) { scoped_refptr<AudioBuffer> buffer; buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque)); } @@ -108,7 +108,7 @@ static int GetAudioBuffer(struct AVCodecContext* s, AVFrame* frame, int flags) { } else { // There are more channels than can fit into data[], so allocate // extended_data[] and fill appropriately. - frame->extended_data = static_cast<uint8**>( + frame->extended_data = static_cast<uint8_t**>( av_malloc(number_of_planes * sizeof(*frame->extended_data))); int i = 0; for (; i < AV_NUM_DATA_POINTERS; ++i) @@ -251,7 +251,7 @@ bool FFmpegAudioDecoder::FFmpegDecode( packet.data = NULL; packet.size = 0; } else { - packet.data = const_cast<uint8*>(buffer->data()); + packet.data = const_cast<uint8_t*>(buffer->data()); packet.size = buffer->data_size(); } diff --git a/media/filters/ffmpeg_bitstream_converter.h b/media/filters/ffmpeg_bitstream_converter.h index 4b17486..3926bf8 100644 --- a/media/filters/ffmpeg_bitstream_converter.h +++ b/media/filters/ffmpeg_bitstream_converter.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_FFMPEG_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_FFMPEG_BITSTREAM_CONVERTER_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" struct AVPacket; diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 3dccb55..c5959c4 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -345,18 +345,14 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { if (type() == DemuxerStream::TEXT) { int id_size = 0; - uint8* id_data = av_packet_get_side_data( - packet.get(), - AV_PKT_DATA_WEBVTT_IDENTIFIER, - &id_size); + uint8_t* id_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size); int settings_size = 0; - uint8* settings_data = av_packet_get_side_data( - packet.get(), - AV_PKT_DATA_WEBVTT_SETTINGS, - &settings_size); + uint8_t* settings_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size); - std::vector<uint8> side_data; + std::vector<uint8_t> side_data; MakeSideData(id_data, id_data + id_size, settings_data, settings_data + settings_size, &side_data); @@ -365,21 +361,17 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { side_data.data(), side_data.size()); } else { int side_data_size = 0; - uint8* side_data = av_packet_get_side_data( - packet.get(), - AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, - &side_data_size); + uint8_t* side_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); scoped_ptr<DecryptConfig> decrypt_config; int data_offset = 0; if ((type() == DemuxerStream::AUDIO && audio_config_->is_encrypted()) || (type() == DemuxerStream::VIDEO && video_config_->is_encrypted())) { if (!WebMCreateDecryptConfig( - packet->data, packet->size, - reinterpret_cast<const uint8*>(encryption_key_id_.data()), - encryption_key_id_.size(), - &decrypt_config, - &data_offset)) { + packet->data, packet->size, + reinterpret_cast<const uint8_t*>(encryption_key_id_.data()), + encryption_key_id_.size(), &decrypt_config, &data_offset)) { LOG(ERROR) << "Creation of DecryptConfig failed."; } } @@ -397,8 +389,8 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { } int skip_samples_size = 0; - const uint32* skip_samples_ptr = - reinterpret_cast<const uint32*>(av_packet_get_side_data( + const uint32_t* skip_samples_ptr = + reinterpret_cast<const uint32_t*>(av_packet_get_side_data( packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); const int kSkipSamplesValidSize = 10; const int kSkipEndSamplesOffset = 1; @@ -731,8 +723,9 @@ std::string FFmpegDemuxerStream::GetMetadata(const char* key) const { // static base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( - const AVRational& time_base, int64 timestamp) { - if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) + const AVRational& time_base, + int64_t timestamp) { + if (timestamp == static_cast<int64_t>(AV_NOPTS_VALUE)) return kNoTimestamp(); return ConvertFromTimeBase(time_base, timestamp); @@ -948,10 +941,9 @@ int64_t FFmpegDemuxer::GetMemoryUsage() const { // in |format_context| or failing that the size and duration of the media. // // Returns 0 if a bitrate could not be determined. -static int CalculateBitrate( - AVFormatContext* format_context, - const base::TimeDelta& duration, - int64 filesize_in_bytes) { +static int CalculateBitrate(AVFormatContext* format_context, + const base::TimeDelta& duration, + int64_t filesize_in_bytes) { // If there is a bitrate set on the container, use it. if (format_context->bit_rate > 0) return format_context->bit_rate; @@ -973,7 +965,7 @@ static int CalculateBitrate( return 0; } - // Do math in floating point as we'd overflow an int64 if the filesize was + // Do math in floating point as we'd overflow an int64_t if the filesize was // larger than ~1073GB. double bytes = filesize_in_bytes; double duration_us = duration.InMicroseconds(); @@ -1042,14 +1034,14 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb, kInfiniteDuration()); const AVFormatInternal* internal = format_context->internal; if (internal && internal->packet_buffer && - format_context->start_time != static_cast<int64>(AV_NOPTS_VALUE)) { + format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) { struct AVPacketList* packet_buffer = internal->packet_buffer; while (packet_buffer != internal->packet_buffer_end) { DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index), start_time_estimates.size()); const AVStream* stream = format_context->streams[packet_buffer->pkt.stream_index]; - if (packet_buffer->pkt.pts != static_cast<int64>(AV_NOPTS_VALUE)) { + if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) { const base::TimeDelta packet_pts = ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts); if (packet_pts < start_time_estimates[stream->index]) @@ -1260,7 +1252,7 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb, host_->SetDuration(max_duration); duration_known_ = (max_duration != kInfiniteDuration()); - int64 filesize_in_bytes = 0; + int64_t filesize_in_bytes = 0; url_protocol_->GetSize(&filesize_in_bytes); bitrate_ = CalculateBitrate(format_context, max_duration, filesize_in_bytes); if (bitrate_ > 0) @@ -1496,8 +1488,8 @@ void FFmpegDemuxer::StreamHasEnded() { void FFmpegDemuxer::OnEncryptedMediaInitData( EmeInitDataType init_data_type, const std::string& encryption_key_id) { - std::vector<uint8> key_id_local(encryption_key_id.begin(), - encryption_key_id.end()); + std::vector<uint8_t> key_id_local(encryption_key_id.begin(), + encryption_key_id.end()); encrypted_media_init_data_cb_.Run(init_data_type, key_id_local); } diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h index 009f21b..b0d0812 100644 --- a/media/filters/ffmpeg_demuxer.h +++ b/media/filters/ffmpeg_demuxer.h @@ -146,7 +146,7 @@ class FFmpegDemuxerStream : public DemuxerStream { // Converts an FFmpeg stream timestamp into a base::TimeDelta. static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, - int64 timestamp); + int64_t timestamp); // Resets any currently active bitstream converter. void ResetBitstreamConverter(); diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index f038648..c851073 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -42,9 +42,9 @@ MATCHER(IsEndOfStreamBuffer, return arg->end_of_stream(); } -const uint8 kEncryptedMediaInitData[] = { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, +const uint8_t kEncryptedMediaInitData[] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, }; static void EosOnReadDone(bool* got_eos_buffer, @@ -110,21 +110,20 @@ class FFmpegDemuxerTest : public testing::Test { InitializeDemuxerText(false); } - MOCK_METHOD2(OnReadDoneCalled, void(int, int64)); + MOCK_METHOD2(OnReadDoneCalled, void(int, int64_t)); struct ReadExpectation { ReadExpectation(int size, - int64 timestamp_us, + int64_t timestamp_us, const base::TimeDelta& discard_front_padding, bool is_key_frame) : size(size), timestamp_us(timestamp_us), discard_front_padding(discard_front_padding), - is_key_frame(is_key_frame) { - } + is_key_frame(is_key_frame) {} int size; - int64 timestamp_us; + int64_t timestamp_us; base::TimeDelta discard_front_padding; bool is_key_frame; }; @@ -155,7 +154,7 @@ class FFmpegDemuxerTest : public testing::Test { DemuxerStream::ReadCB NewReadCB(const tracked_objects::Location& location, int size, - int64 timestamp_us, + int64_t timestamp_us, bool is_key_frame) { return NewReadCBWithCheckedDiscard(location, size, @@ -167,7 +166,7 @@ class FFmpegDemuxerTest : public testing::Test { DemuxerStream::ReadCB NewReadCBWithCheckedDiscard( const tracked_objects::Location& location, int size, - int64 timestamp_us, + int64_t timestamp_us, base::TimeDelta discard_front_padding, bool is_key_frame) { EXPECT_CALL(*this, OnReadDoneCalled(size, timestamp_us)); @@ -185,7 +184,7 @@ class FFmpegDemuxerTest : public testing::Test { MOCK_METHOD2(OnEncryptedMediaInitData, void(EmeInitDataType init_data_type, - const std::vector<uint8>& init_data)); + const std::vector<uint8_t>& init_data)); // Accessor to demuxer internals. void set_duration_known(bool duration_known) { @@ -377,9 +376,9 @@ TEST_F(FFmpegDemuxerTest, Initialize_Encrypted) { EXPECT_CALL(*this, OnEncryptedMediaInitData( EmeInitDataType::WEBM, - std::vector<uint8>(kEncryptedMediaInitData, - kEncryptedMediaInitData + - arraysize(kEncryptedMediaInitData)))) + std::vector<uint8_t>(kEncryptedMediaInitData, + kEncryptedMediaInitData + + arraysize(kEncryptedMediaInitData)))) .Times(Exactly(2)); CreateDemuxer("bear-320x240-av_enc-av.webm"); @@ -444,7 +443,7 @@ TEST_F(FFmpegDemuxerTest, SeekInitialized_NoVideoStartTime) { } TEST_F(FFmpegDemuxerTest, Read_VideoPositiveStartTime) { - const int64 kTimelineOffsetMs = 1352550896000LL; + const int64_t kTimelineOffsetMs = 1352550896000LL; // Test the start time is the first timestamp of the video and audio stream. CreateDemuxer("nonzero-start-time.webm"); @@ -983,7 +982,7 @@ TEST_P(Mp3SeekFFmpegDemuxerTest, TestFastSeek) { // Verify that seeking to the end read only a small portion of the file. // Slow seeks that read sequentially up to the seek point will read too many // bytes and fail this check. - int64 file_size = 0; + int64_t file_size = 0; ASSERT_TRUE(data_source_->GetSize(&file_size)); EXPECT_LT(data_source_->bytes_read_for_testing(), (file_size * .25)); } diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc index bfeced0..d3819d2 100644 --- a/media/filters/ffmpeg_glue.cc +++ b/media/filters/ffmpeg_glue.cc @@ -27,9 +27,9 @@ static int AVIOReadOperation(void* opaque, uint8_t* buf, int buf_size) { return result; } -static int64 AVIOSeekOperation(void* opaque, int64 offset, int whence) { +static int64_t AVIOSeekOperation(void* opaque, int64_t offset, int whence) { FFmpegURLProtocol* protocol = reinterpret_cast<FFmpegURLProtocol*>(opaque); - int64 new_offset = AVERROR(EIO); + int64_t new_offset = AVERROR(EIO); switch (whence) { case SEEK_SET: if (protocol->SetPosition(offset)) @@ -37,7 +37,7 @@ static int64 AVIOSeekOperation(void* opaque, int64 offset, int whence) { break; case SEEK_CUR: - int64 pos; + int64_t pos; if (!protocol->GetPosition(&pos)) break; if (protocol->SetPosition(pos + offset)) @@ -45,7 +45,7 @@ static int64 AVIOSeekOperation(void* opaque, int64 offset, int whence) { break; case SEEK_END: - int64 size; + int64_t size; if (!protocol->GetSize(&size)) break; if (protocol->SetPosition(size + offset)) @@ -161,9 +161,9 @@ bool FFmpegGlue::OpenContext() { // Attempt to recognize the container by looking at the first few bytes of the // stream. The stream position is left unchanged. - scoped_ptr<std::vector<uint8> > buffer(new std::vector<uint8>(8192)); + scoped_ptr<std::vector<uint8_t>> buffer(new std::vector<uint8_t>(8192)); - int64 pos = AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_CUR); + int64_t pos = AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_CUR); AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_SET); int numRead = AVIOReadOperation( avio_context_.get()->opaque, buffer.get()->data(), buffer.get()->size()); diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h index 0073ac3..ddc49b1 100644 --- a/media/filters/ffmpeg_glue.h +++ b/media/filters/ffmpeg_glue.h @@ -25,7 +25,6 @@ #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ #define MEDIA_FILTERS_FFMPEG_GLUE_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" #include "media/ffmpeg/ffmpeg_deleters.h" @@ -39,18 +38,18 @@ class MEDIA_EXPORT FFmpegURLProtocol { public: // Read the given amount of bytes into data, returns the number of bytes read // if successful, kReadError otherwise. - virtual int Read(int size, uint8* data) = 0; + virtual int Read(int size, uint8_t* data) = 0; // Returns true and the current file position for this file, false if the // file position could not be retrieved. - virtual bool GetPosition(int64* position_out) = 0; + virtual bool GetPosition(int64_t* position_out) = 0; // Returns true if the file position could be set, false otherwise. - virtual bool SetPosition(int64 position) = 0; + virtual bool SetPosition(int64_t position) = 0; // Returns true and the file size, false if the file size could not be // retrieved. - virtual bool GetSize(int64* size_out) = 0; + virtual bool GetSize(int64_t* size_out) = 0; // Returns false if this protocol supports random seeking. virtual bool IsStreaming() = 0; diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc index 5b97f36..9cdc1cd 100644 --- a/media/filters/ffmpeg_glue_unittest.cc +++ b/media/filters/ffmpeg_glue_unittest.cc @@ -24,10 +24,10 @@ class MockProtocol : public FFmpegURLProtocol { public: MockProtocol() {} - MOCK_METHOD2(Read, int(int size, uint8* data)); - MOCK_METHOD1(GetPosition, bool(int64* position_out)); - MOCK_METHOD1(SetPosition, bool(int64 position)); - MOCK_METHOD1(GetSize, bool(int64* size_out)); + MOCK_METHOD2(Read, int(int size, uint8_t* data)); + MOCK_METHOD1(GetPosition, bool(int64_t* position_out)); + MOCK_METHOD1(SetPosition, bool(int64_t position)); + MOCK_METHOD1(GetSize, bool(int64_t* size_out)); MOCK_METHOD0(IsStreaming, bool()); private: @@ -54,12 +54,12 @@ class FFmpegGlueTest : public ::testing::Test { glue_.reset(); } - int ReadPacket(int size, uint8* data) { + int ReadPacket(int size, uint8_t* data) { return glue_->format_context()->pb->read_packet( protocol_.get(), data, size); } - int64 Seek(int64 offset, int whence) { + int64_t Seek(int64_t offset, int whence) { return glue_->format_context()->pb->seek(protocol_.get(), offset, whence); } @@ -116,7 +116,7 @@ TEST_F(FFmpegGlueTest, Write) { // Test both successful and unsuccessful reads pass through correctly. TEST_F(FFmpegGlueTest, Read) { const int kBufferSize = 16; - uint8 buffer[kBufferSize]; + uint8_t buffer[kBufferSize]; // Reads are for the most part straight-through calls to Read(). InSequence s; diff --git a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc index dd1b3d7..897658de 100644 --- a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc +++ b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc @@ -41,7 +41,7 @@ bool FFmpegH264ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { } } - uint32 output_packet_size = converter_.CalculateNeededOutputBufferSize( + uint32_t output_packet_size = converter_.CalculateNeededOutputBufferSize( packet->data, packet->size, avc_config.get()); if (output_packet_size == 0) @@ -59,7 +59,7 @@ bool FFmpegH264ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { // Proceed with the conversion of the actual in-band NAL units, leave room // for configuration in the beginning. - uint32 io_size = dest_packet.size; + uint32_t io_size = dest_packet.size; if (!converter_.ConvertNalUnitStreamToByteStream( packet->data, packet->size, avc_config.get(), diff --git a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h index 14bd40b..afcd4a5 100644 --- a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h +++ b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/filters/ffmpeg_bitstream_converter.h" #include "media/filters/h264_to_annex_b_bitstream_converter.h" diff --git a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc index db430e2..91530b2 100644 --- a/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc +++ b/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc @@ -10,250 +10,267 @@ namespace media { // Test data arrays. -static const uint8 kHeaderDataOkWithFieldLen4[] = { - 0x01, 0x42, 0x00, 0x28, 0xFF, 0xE1, 0x00, 0x08, 0x67, 0x42, 0x00, 0x28, - 0xE9, 0x05, 0x89, 0xC8, 0x01, 0x00, 0x04, 0x68, 0xCE, 0x06, 0xF2, 0x00 -}; +static const uint8_t kHeaderDataOkWithFieldLen4[] = { + 0x01, 0x42, 0x00, 0x28, 0xFF, 0xE1, 0x00, 0x08, 0x67, 0x42, 0x00, 0x28, + 0xE9, 0x05, 0x89, 0xC8, 0x01, 0x00, 0x04, 0x68, 0xCE, 0x06, 0xF2, 0x00}; -static const uint8 kPacketDataOkWithFieldLen4[] = { - 0x00, 0x00, 0x0B, 0xF7, 0x65, 0xB8, 0x40, 0x57, 0x0B, 0xF0, - 0xDF, 0xF8, 0x00, 0x1F, 0x78, 0x98, 0x54, 0xAC, 0xF2, 0x00, 0x04, 0x9D, 0x26, - 0xE0, 0x3B, 0x5C, 0x00, 0x0A, 0x00, 0x8F, 0x9E, 0x86, 0x63, 0x1B, 0x46, 0xE7, - 0xD6, 0x45, 0x88, 0x88, 0xEA, 0x10, 0x89, 0x79, 0x01, 0x34, 0x30, 0x01, 0x8E, - 0x7D, 0x1A, 0x39, 0x45, 0x4E, 0x69, 0x86, 0x12, 0xF2, 0xE7, 0xCF, 0x50, 0xF8, - 0x26, 0x54, 0x17, 0xBE, 0x3F, 0xC4, 0x80, 0x32, 0xD8, 0x02, 0x32, 0xE4, 0xAE, - 0xDD, 0x39, 0x11, 0x8E, 0x54, 0x42, 0xAE, 0xBD, 0x12, 0xA4, 0xCE, 0xE2, 0x98, - 0x91, 0x05, 0xC4, 0xA8, 0x20, 0xC7, 0xB3, 0xD9, 0x47, 0x73, 0x09, 0xD5, 0xCF, - 0x62, 0x57, 0x3F, 0xFF, 0xFD, 0xB9, 0x94, 0x2B, 0x3D, 0x12, 0x1A, 0x84, 0x0B, - 0x28, 0xAD, 0x5C, 0x9E, 0x5C, 0xC3, 0xBB, 0xBD, 0x7F, 0xFE, 0x09, 0x87, 0x74, - 0x39, 0x1C, 0xA5, 0x0E, 0x44, 0xD8, 0x5D, 0x41, 0xDB, 0xAA, 0xBC, 0x05, 0x16, - 0xA3, 0x98, 0xEE, 0xEE, 0x9C, 0xA0, 0xF1, 0x23, 0x90, 0xF0, 0x5E, 0x9F, 0xF4, - 0xFA, 0x7F, 0x4B, 0x69, 0x66, 0x49, 0x52, 0xDD, 0xD6, 0xC0, 0x0F, 0x8C, 0x6E, - 0x80, 0xDD, 0x7A, 0xDF, 0x10, 0xCD, 0x4B, 0x54, 0x6F, 0xFC, 0x7D, 0x34, 0xBA, - 0x8B, 0xD4, 0xD9, 0x30, 0x18, 0x9F, 0x39, 0x04, 0x9F, 0xCB, 0xDB, 0x1B, 0xA7, - 0x70, 0x96, 0xAF, 0xFF, 0x6F, 0xB5, 0xBF, 0x58, 0x01, 0x98, 0xCD, 0xF2, 0x66, - 0x28, 0x1A, 0xC4, 0x9E, 0x58, 0x40, 0x39, 0xAE, 0x07, 0x11, 0x3F, 0xF2, 0x9B, - 0x06, 0x9C, 0xB8, 0xC9, 0x16, 0x12, 0x09, 0x8E, 0xD2, 0xD4, 0xF5, 0xC6, 0x77, - 0x40, 0x0F, 0xFD, 0x12, 0x19, 0x55, 0x1A, 0x8E, 0x9C, 0x18, 0x8B, 0x0D, 0x18, - 0xFA, 0xBA, 0x7F, 0xBB, 0x83, 0xBB, 0x85, 0xA0, 0xCC, 0xAF, 0xF6, 0xEA, 0x81, - 0x10, 0x18, 0x8E, 0x10, 0x00, 0xCB, 0x7F, 0x27, 0x08, 0x06, 0xDE, 0x3C, 0x20, - 0xE5, 0xFE, 0xCC, 0x4F, 0xB3, 0x41, 0xE0, 0xCC, 0x4C, 0x26, 0xC1, 0xC0, 0x2C, - 0x16, 0x12, 0xAA, 0x04, 0x83, 0x51, 0x4E, 0xCA, 0x00, 0xCF, 0x42, 0x9C, 0x06, - 0x2D, 0x06, 0xDD, 0x1D, 0x08, 0x75, 0xE0, 0x89, 0xC7, 0x62, 0x68, 0x2E, 0xBF, - 0x4D, 0x2D, 0x0A, 0xC4, 0x86, 0xF6, 0x2F, 0xA1, 0x49, 0xA7, 0x0F, 0xDB, 0x1F, - 0x82, 0xEC, 0xC1, 0x62, 0xFB, 0x7F, 0xF1, 0xAE, 0xA6, 0x1A, 0xD5, 0x6B, 0x06, - 0x5E, 0xB6, 0x02, 0x50, 0xAE, 0x2D, 0xF9, 0xD9, 0x95, 0xAD, 0x01, 0x8C, 0x53, - 0x01, 0xAF, 0xCE, 0xE5, 0xA5, 0xBB, 0x95, 0x8A, 0x85, 0x70, 0x77, 0xE3, 0x9A, - 0x68, 0x1B, 0xDF, 0x47, 0xF9, 0xF4, 0xBD, 0x80, 0x7D, 0x76, 0x9A, 0x69, 0xFC, - 0xBE, 0x14, 0x0D, 0x87, 0x09, 0x12, 0x98, 0x20, 0x05, 0x46, 0xB7, 0xAE, 0x10, - 0xB7, 0x01, 0xB7, 0xDE, 0x3B, 0xDD, 0x7A, 0x8A, 0x55, 0x73, 0xAD, 0xDF, 0x69, - 0xDE, 0xD0, 0x51, 0x97, 0xA0, 0xE6, 0x5E, 0xBA, 0xBA, 0x80, 0x0F, 0x4E, 0x9A, - 0x68, 0x36, 0xE6, 0x9F, 0x5B, 0x39, 0xC0, 0x90, 0xA1, 0xC0, 0xC3, 0x82, 0xE4, - 0x50, 0xEA, 0x60, 0x7A, 0xDD, 0x5F, 0x8B, 0x5F, 0xAF, 0xFC, 0x74, 0xAF, 0xDC, - 0x56, 0xF7, 0x2E, 0x3E, 0x97, 0x6E, 0x2B, 0xF3, 0xAF, 0xFE, 0x7D, 0x32, 0xDC, - 0x56, 0xF8, 0xAF, 0xB5, 0xA3, 0xBB, 0x00, 0x5B, 0x84, 0x3D, 0x9F, 0x0B, 0x40, - 0x88, 0x61, 0x5F, 0x4F, 0x4F, 0xB0, 0xB3, 0x07, 0x81, 0x3E, 0xF2, 0xFB, 0x50, - 0xCA, 0x77, 0x40, 0x12, 0xA8, 0xE6, 0x11, 0x8E, 0xD6, 0x8A, 0xC6, 0xD6, 0x8C, - 0x1D, 0x63, 0x55, 0x3D, 0x34, 0xEA, 0xC3, 0xC6, 0x6A, 0xD2, 0x8C, 0xB0, 0x1D, - 0x5E, 0x4A, 0x7A, 0x8B, 0xD5, 0x99, 0x80, 0x84, 0x32, 0xFB, 0xB7, 0x02, 0x6E, - 0x61, 0xFE, 0xAC, 0x1B, 0x5D, 0x10, 0x23, 0x24, 0xC3, 0x8C, 0x7B, 0x58, 0x2C, - 0x4D, 0x04, 0x74, 0x84, 0x25, 0x10, 0x4E, 0x94, 0x29, 0x4D, 0x88, 0xAE, 0x65, - 0x53, 0xB9, 0x95, 0x4E, 0xE7, 0xDD, 0xEE, 0xF2, 0x70, 0x1F, 0x26, 0x4F, 0xA8, - 0xBC, 0x3D, 0x35, 0x02, 0x3B, 0xC0, 0x98, 0x70, 0x38, 0x18, 0xE5, 0x1E, 0x05, - 0xAC, 0x28, 0xAA, 0x46, 0x1A, 0xB0, 0x19, 0x99, 0x18, 0x35, 0x78, 0x1E, 0x41, - 0x60, 0x0D, 0x4F, 0x7E, 0xEC, 0x37, 0xC3, 0x30, 0x73, 0x2A, 0x69, 0xFE, 0xEF, - 0x27, 0xEE, 0x13, 0xCC, 0xD0, 0xDB, 0xE6, 0x45, 0xEC, 0x5C, 0xB5, 0x71, 0x54, - 0x2E, 0xB1, 0xE9, 0x88, 0xB4, 0x3F, 0x6F, 0xFD, 0xF7, 0xFF, 0x9D, 0x2D, 0x52, - 0x2E, 0xAE, 0xC9, 0x95, 0xDE, 0xBF, 0xDF, 0xFF, 0xBF, 0x21, 0xB3, 0x2B, 0xF5, - 0xF7, 0xF7, 0xD1, 0xA0, 0xF0, 0x76, 0x68, 0x37, 0xDB, 0x8F, 0x85, 0x4D, 0xA8, - 0x1A, 0xF9, 0x7F, 0x75, 0xA7, 0x93, 0xF5, 0x03, 0xC1, 0xF2, 0x60, 0x8A, 0x92, - 0x53, 0xF5, 0xD1, 0xC1, 0x56, 0x4B, 0x68, 0x05, 0x16, 0x88, 0x61, 0xE7, 0x14, - 0xC8, 0x0D, 0xF0, 0xDF, 0xEF, 0x46, 0x4A, 0xED, 0x0B, 0xD1, 0xD1, 0xD1, 0xA4, - 0x85, 0xA3, 0x2C, 0x1D, 0xDE, 0x45, 0x14, 0xA1, 0x8E, 0xA8, 0xD9, 0x8C, 0xAB, - 0x47, 0x31, 0xF1, 0x00, 0x15, 0xAD, 0x80, 0x20, 0xAA, 0xE4, 0x57, 0xF8, 0x05, - 0x14, 0x58, 0x0B, 0xD3, 0x63, 0x00, 0x8F, 0x44, 0x15, 0x7F, 0x19, 0xC7, 0x0A, - 0xE0, 0x49, 0x32, 0xFE, 0x36, 0x0E, 0xF3, 0x66, 0x10, 0x2B, 0x11, 0x73, 0x3D, - 0x19, 0x92, 0x22, 0x20, 0x75, 0x1F, 0xF1, 0xDB, 0x96, 0x73, 0xCF, 0x1B, 0x53, - 0xFF, 0xD2, 0x23, 0xF2, 0xB6, 0xAA, 0xB6, 0x44, 0xA3, 0x73, 0x7E, 0x00, 0x2D, - 0x4D, 0x4D, 0x87, 0xE0, 0x84, 0x55, 0xD6, 0x03, 0xB8, 0xD8, 0x90, 0xEF, 0xC0, - 0x76, 0x5D, 0x69, 0x02, 0x00, 0x0E, 0x17, 0xD0, 0x02, 0x96, 0x50, 0xEA, 0xAB, - 0xBF, 0x0D, 0xAF, 0xCB, 0xD3, 0xFF, 0xAA, 0x9D, 0x7F, 0xD6, 0xBD, 0x2C, 0x14, - 0xB4, 0xCD, 0x20, 0x73, 0xB4, 0xF4, 0x38, 0x96, 0xDE, 0xB0, 0x6B, 0xE5, 0x1B, - 0xFD, 0x0E, 0x0B, 0xA4, 0x81, 0xBF, 0xC8, 0xA0, 0x21, 0x76, 0x7B, 0x25, 0x3F, - 0xE6, 0x84, 0x40, 0x1A, 0xDA, 0x25, 0x5A, 0xFF, 0x73, 0x6B, 0x14, 0x1B, 0xF7, - 0x08, 0xFA, 0x26, 0x73, 0x7A, 0x58, 0x02, 0x1A, 0xE6, 0x63, 0xB6, 0x45, 0x7B, - 0xE3, 0xE0, 0x80, 0x14, 0x42, 0xA8, 0x7D, 0xF3, 0x80, 0x9B, 0x01, 0x43, 0x82, - 0x82, 0x8C, 0xBE, 0x0D, 0xFD, 0xAE, 0x88, 0xA8, 0xB9, 0xC3, 0xEE, 0xFF, 0x46, - 0x00, 0x84, 0xE6, 0xB4, 0x0C, 0xA9, 0x66, 0xC6, 0x74, 0x72, 0xAA, 0xA4, 0x3A, - 0xB0, 0x1B, 0x06, 0xB4, 0xDB, 0xE8, 0xC2, 0x17, 0xA2, 0xBC, 0xBE, 0x5C, 0x0F, - 0x2A, 0x76, 0xD5, 0xEE, 0x39, 0x36, 0x7C, 0x25, 0x94, 0x15, 0x3C, 0xC9, 0xB9, - 0x93, 0x07, 0x19, 0xAF, 0xE6, 0x70, 0xC3, 0xF5, 0xD4, 0x17, 0x87, 0x57, 0x77, - 0x7D, 0xCF, 0x0D, 0xDD, 0xDE, 0xB7, 0xFF, 0xB4, 0xDA, 0x20, 0x45, 0x1A, 0x45, - 0xF4, 0x58, 0x01, 0xBC, 0xEB, 0x3F, 0x16, 0x7F, 0x4C, 0x15, 0x84, 0x8C, 0xE5, - 0xF6, 0x96, 0xA6, 0xA1, 0xB9, 0xB2, 0x7F, 0x6B, 0xFF, 0x31, 0xF2, 0xF5, 0xC9, - 0xFF, 0x61, 0xEE, 0xB5, 0x84, 0xAE, 0x68, 0x41, 0xEA, 0xD0, 0xF0, 0xA5, 0xCE, - 0x0C, 0xE6, 0x4C, 0x6D, 0x6D, 0x94, 0x08, 0xC9, 0xA9, 0x4A, 0x60, 0x6D, 0x01, - 0x3B, 0xEF, 0x4D, 0x99, 0x8D, 0x42, 0x2A, 0x6B, 0x8A, 0xC7, 0xFA, 0xA9, 0x90, - 0x40, 0x00, 0x90, 0xF3, 0xA0, 0x75, 0x8E, 0xD5, 0xFE, 0xE7, 0xBD, 0x02, 0x87, - 0x0C, 0x7D, 0xF0, 0xAF, 0x1E, 0x5F, 0x8D, 0xC8, 0xE1, 0xD4, 0x56, 0x08, 0xBF, - 0x76, 0x80, 0xD4, 0x18, 0x89, 0x2D, 0x57, 0xDF, 0x66, 0xD0, 0x46, 0x68, 0x77, - 0x55, 0x47, 0xF5, 0x7C, 0xF7, 0xA6, 0x66, 0xD6, 0x5A, 0x64, 0x55, 0xD4, 0x80, - 0xC4, 0x55, 0xE9, 0x36, 0x3F, 0x5E, 0xE2, 0x5C, 0x7F, 0x5F, 0xCE, 0x7F, 0xE1, - 0x0C, 0x82, 0x3D, 0x6B, 0x6E, 0xA2, 0xEA, 0x3B, 0x1F, 0xE8, 0x9E, 0xC7, 0x4E, - 0x24, 0x3D, 0xDD, 0xFA, 0xEB, 0x71, 0xDF, 0xFE, 0x15, 0xFE, 0x41, 0x9B, 0xB4, - 0x4E, 0xAB, 0x51, 0xE5, 0x1F, 0x7D, 0x2D, 0xAC, 0xD0, 0x66, 0xD9, 0xA1, 0x59, - 0x78, 0xC6, 0xEF, 0xC4, 0x43, 0x08, 0x65, 0x18, 0x73, 0xDE, 0x2A, 0xAD, 0x72, - 0xE7, 0x5A, 0x7E, 0x33, 0x04, 0x72, 0x38, 0x57, 0x47, 0x73, 0x10, 0x1D, 0x88, - 0x57, 0x4C, 0xDF, 0xA7, 0x78, 0x16, 0xFB, 0x01, 0x21, 0x28, 0x2D, 0xB6, 0x7E, - 0x05, 0x18, 0x32, 0x52, 0xC3, 0x49, 0x0B, 0x32, 0x18, 0x12, 0x93, 0x54, 0x15, - 0x3B, 0xC8, 0x6D, 0x4A, 0x77, 0xEF, 0x0A, 0x46, 0x83, 0x89, 0x5C, 0x8B, 0xCB, - 0x18, 0xA6, 0xDC, 0x97, 0x6F, 0xEE, 0xEE, 0x00, 0x6A, 0xF1, 0x10, 0xFE, 0x07, - 0x0C, 0xE0, 0x53, 0xD2, 0xB8, 0x45, 0xF4, 0x6E, 0x16, 0x4B, 0xC9, 0x9C, 0xC7, - 0x93, 0x83, 0x23, 0x1D, 0x4D, 0x00, 0xB9, 0x4F, 0x86, 0x51, 0xF0, 0x29, 0x69, - 0x41, 0x21, 0xC5, 0x4A, 0xC6, 0x6D, 0xD1, 0x81, 0x38, 0xDB, 0x7C, 0x06, 0xA8, - 0x26, 0x8E, 0x71, 0x00, 0x4C, 0x44, 0x14, 0x05, 0xF2, 0x1C, 0x00, 0x49, 0xFC, - 0x29, 0x6A, 0xF9, 0x9E, 0xD1, 0x35, 0x4B, 0xB7, 0xE5, 0xDB, 0xFC, 0x01, 0x04, - 0x3F, 0x70, 0x33, 0x56, 0x87, 0x69, 0x01, 0xB4, 0xCE, 0x1C, 0x4D, 0x2E, 0x83, - 0x51, 0x51, 0xD0, 0x37, 0x3B, 0xB4, 0xBA, 0x47, 0xF5, 0xFF, 0xBF, 0xFA, 0xD5, - 0x03, 0x65, 0xD3, 0x28, 0x9F, 0x38, 0x57, 0xFE, 0x71, 0xD8, 0x9C, 0x16, 0xEE, - 0x72, 0x19, 0x03, 0x17, 0x6E, 0xC0, 0xEC, 0x49, 0x3D, 0x96, 0xE2, 0x30, 0x97, - 0x97, 0x84, 0x38, 0x6B, 0xE8, 0x2E, 0xAB, 0x0E, 0x2E, 0x03, 0x52, 0xBA, 0x68, - 0x55, 0xBA, 0x1D, 0x2C, 0x47, 0xAA, 0x72, 0xAE, 0x02, 0x31, 0x6E, 0xA1, 0xDC, - 0xAD, 0x0F, 0x4A, 0x46, 0xC9, 0xF2, 0xA9, 0xAB, 0xFD, 0x87, 0x89, 0x5C, 0xB3, - 0x75, 0x7E, 0xE3, 0xDE, 0x9F, 0xC4, 0x02, 0x1E, 0xA2, 0xF8, 0x8B, 0xD3, 0x00, - 0x83, 0x96, 0xC4, 0xD0, 0xB9, 0x62, 0xB9, 0x69, 0xEC, 0x56, 0xDF, 0x7D, 0x91, - 0x4B, 0x68, 0x27, 0xA8, 0x61, 0x78, 0xA7, 0x95, 0x66, 0x51, 0x41, 0xF6, 0xCE, - 0x78, 0xD3, 0x9A, 0x91, 0xA0, 0x31, 0x09, 0x47, 0xB8, 0x47, 0xB8, 0x44, 0xE1, - 0x13, 0x86, 0x7E, 0x92, 0x80, 0xC6, 0x1A, 0xF7, 0x79, 0x7E, 0xF1, 0x5D, 0x9F, - 0x17, 0x2D, 0x80, 0x00, 0x79, 0x34, 0x7D, 0xE3, 0xAD, 0x60, 0x00, 0x20, 0x07, - 0x80, 0x00, 0x40, 0x01, 0xF8, 0xA1, 0x86, 0xB1, 0xEE, 0x21, 0x63, 0x85, 0x60, - 0x51, 0x84, 0x90, 0x7E, 0x92, 0x09, 0x39, 0x1C, 0x16, 0x87, 0x5C, 0xA6, 0x09, - 0x90, 0x06, 0x34, 0x6E, 0xB8, 0x8D, 0x5D, 0xAC, 0x77, 0x97, 0xB5, 0x4D, 0x30, - 0xFD, 0x39, 0xD0, 0x50, 0x00, 0xC9, 0x98, 0x04, 0x86, 0x00, 0x0D, 0xD8, 0x3E, - 0x34, 0xC2, 0xA6, 0x25, 0xF8, 0x20, 0xCC, 0x6D, 0x9E, 0x63, 0x05, 0x30, 0xC4, - 0xC6, 0xCC, 0x54, 0x31, 0x9F, 0x3C, 0xF5, 0x86, 0xB9, 0x08, 0x18, 0xC3, 0x1E, - 0xB9, 0xA0, 0x0C, 0x45, 0x2C, 0x54, 0x32, 0x8B, 0x85, 0x86, 0x59, 0xC3, 0xB3, - 0x50, 0x5A, 0xFE, 0xBA, 0xF7, 0x4D, 0xC9, 0x9C, 0x9E, 0x01, 0xDF, 0xD7, 0x6E, - 0xB5, 0x15, 0x53, 0x08, 0x57, 0xA4, 0x71, 0x36, 0x80, 0x46, 0x05, 0x21, 0x48, - 0x7B, 0x91, 0xC8, 0xAA, 0xFF, 0x07, 0x9F, 0x78, 0x68, 0xCF, 0x3C, 0xEF, 0xFF, - 0xBC, 0xB6, 0xA2, 0x36, 0xB7, 0x9F, 0x54, 0xF6, 0x6F, 0x5D, 0xDD, 0x75, 0xD4, - 0x3C, 0x75, 0xE8, 0xCF, 0x15, 0x02, 0x5B, 0x94, 0xC3, 0xA2, 0x41, 0x63, 0xA1, - 0x14, 0xF6, 0xC0, 0x57, 0x15, 0x9F, 0x0C, 0x3F, 0x80, 0xF2, 0x98, 0xEE, 0x41, - 0x85, 0xEE, 0xBC, 0xAA, 0xE9, 0x59, 0xAA, 0xA0, 0x92, 0xCA, 0x00, 0xF3, 0x50, - 0xCC, 0xFF, 0xAD, 0x97, 0x69, 0xA7, 0xF2, 0x0B, 0x8F, 0xD7, 0xD7, 0x82, 0x3A, - 0xBB, 0x98, 0x1D, 0xCB, 0x89, 0x0B, 0x9B, 0x05, 0xF7, 0xD0, 0x1A, 0x60, 0xF3, - 0x29, 0x16, 0x12, 0xF8, 0xF4, 0xF1, 0x4A, 0x05, 0x9B, 0x57, 0x12, 0x7E, 0x3A, - 0x4A, 0x8D, 0xA6, 0xDF, 0xB6, 0xDD, 0xDF, 0xC3, 0xF0, 0xD2, 0xD4, 0xD7, 0x41, - 0xA6, 0x00, 0x76, 0x8C, 0x75, 0x08, 0xF0, 0x19, 0xD8, 0x14, 0x63, 0x55, 0x52, - 0x18, 0x30, 0x98, 0xD0, 0x3F, 0x65, 0x52, 0xB3, 0x88, 0x6D, 0x17, 0x39, 0x93, - 0xCA, 0x3B, 0xB4, 0x1D, 0x8D, 0xDF, 0xDF, 0xAD, 0x72, 0xDA, 0x74, 0xAF, 0xBD, - 0x31, 0xF9, 0x12, 0x61, 0x45, 0x29, 0x4C, 0x2B, 0x61, 0xA1, 0x12, 0x90, 0x53, - 0xE7, 0x5A, 0x9D, 0x44, 0xC8, 0x3A, 0x83, 0xDC, 0x34, 0x4C, 0x07, 0xAF, 0xDB, - 0x90, 0xCD, 0x03, 0xA4, 0x64, 0x78, 0xBD, 0x55, 0xB2, 0x56, 0x59, 0x32, 0xAB, - 0x13, 0x2C, 0xC9, 0x77, 0xF8, 0x3B, 0xDF, 0xFF, 0xAC, 0x07, 0xB9, 0x08, 0x7B, - 0xE9, 0x82, 0xB9, 0x59, 0xC7, 0xFF, 0x86, 0x2C, 0x12, 0x7C, 0xC6, 0x65, 0x3C, - 0x71, 0xB8, 0x98, 0x9F, 0xA2, 0x45, 0x03, 0xA5, 0xD9, 0xC3, 0xCF, 0xFA, 0xEB, - 0x89, 0xAD, 0x03, 0xEE, 0xDD, 0x76, 0xD3, 0x4F, 0x10, 0x6F, 0xF0, 0xC1, 0x60, - 0x0C, 0x00, 0xD4, 0x76, 0x12, 0x0A, 0x8D, 0xDC, 0xFD, 0x5E, 0x0B, 0x26, 0x2F, - 0x01, 0x1D, 0xB9, 0xE7, 0x73, 0xD4, 0xF2, 0xCB, 0xD8, 0x78, 0x21, 0x52, 0x4B, - 0x83, 0x3C, 0x44, 0x72, 0x0E, 0xB1, 0x4E, 0x37, 0xBC, 0xC7, 0x50, 0xFA, 0x07, - 0x80, 0x71, 0x10, 0x0B, 0x24, 0xD1, 0x7E, 0xDA, 0x7F, 0xA7, 0x2F, 0x40, 0xAA, - 0xD3, 0xF5, 0x44, 0x10, 0x56, 0x4E, 0x3B, 0xF1, 0x6E, 0x9A, 0xA0, 0xEA, 0x85, - 0x66, 0x16, 0xFB, 0x5C, 0x0B, 0x2B, 0x74, 0x18, 0xAF, 0x3D, 0x04, 0x3E, 0xCE, - 0x88, 0x9B, 0x3E, 0xF4, 0xB9, 0x00, 0x60, 0x0E, 0xE1, 0xE2, 0xCB, 0x12, 0xB9, - 0x6D, 0x5A, 0xC7, 0x55, 0x1D, 0xB9, 0x79, 0xAC, 0x43, 0x43, 0xE6, 0x3B, 0xDD, - 0x7E, 0x9F, 0x78, 0xD3, 0xEA, 0xA3, 0x11, 0xFF, 0xDB, 0xBB, 0xB8, 0x97, 0x37, - 0x15, 0xDB, 0xF1, 0x97, 0x96, 0xC7, 0xFC, 0xE5, 0xBF, 0xF2, 0x86, 0xC0, 0xFA, - 0x9B, 0x4C, 0x00, 0x04, 0x03, 0xA5, 0xB6, 0xB7, 0x9C, 0xD9, 0xAB, 0x09, 0x77, - 0x51, 0x18, 0x3B, 0xAD, 0x61, 0x6C, 0xFC, 0x51, 0x96, 0xFB, 0x19, 0xC8, 0x52, - 0x35, 0x07, 0x00, 0x63, 0x87, 0x14, 0x04, 0xFA, 0x7A, 0x48, 0x3E, 0x00, 0x47, - 0x29, 0x07, 0x74, 0x97, 0x74, 0x84, 0xEB, 0xB2, 0x16, 0xB2, 0x31, 0x81, 0xCE, - 0x2A, 0x31, 0xA7, 0xB1, 0xEB, 0x83, 0x34, 0x7A, 0x73, 0xD7, 0x2F, 0xFF, 0xBC, - 0xFF, 0xE5, 0xAA, 0xF2, 0xB5, 0x6E, 0x9E, 0xA5, 0x70, 0x8A, 0x8C, 0xDF, 0x6A, - 0x06, 0x16, 0xC1, 0xAB, 0x59, 0x70, 0xD9, 0x3D, 0x47, 0x7C, 0xDD, 0xEF, 0xDF, - 0x2F, 0xFF, 0x42, 0x6B, 0xBA, 0x4B, 0xBF, 0xF8, 0x7F, 0xF2, 0x03, 0x0D, 0x79, - 0xBC, 0x03, 0x76, 0x64, 0x1C, 0x0D, 0x7B, 0xD7, 0xBD, 0xB0, 0x6C, 0xD8, 0x61, - 0x17, 0x17, 0x8C, 0xED, 0x4E, 0x20, 0xEB, 0x55, 0x33, 0x39, 0xE9, 0x7E, 0xBE, - 0x8E, 0x05, 0x4B, 0x78, 0x96, 0x85, 0xCC, 0x68, 0xC9, 0x78, 0xAF, 0xAE, 0x44, - 0x36, 0x61, 0xD3, 0x53, 0xEB, 0xB3, 0x3E, 0x4F, 0x97, 0xE2, 0x8D, 0xAE, 0x90, - 0xED, 0xB5, 0x4F, 0x8E, 0xE4, 0x7A, 0x44, 0xCF, 0x9D, 0xC5, 0x77, 0x4D, 0xAB, - 0x4F, 0xE5, 0xC5, 0x73, 0xA0, 0xC8, 0xA5, 0xBB, 0x4B, 0x7D, 0xD5, 0xFB, 0xFB, - 0xFF, 0x61, 0xFD, 0xAA, 0x1A, 0x62, 0x7E, 0x3C, 0x66, 0x34, 0x15, 0x64, 0x25, - 0xEC, 0x7C, 0x9D, 0x6A, 0x64, 0x4D, 0x80, 0xD5, 0x4F, 0xFE, 0x8E, 0xEE, 0x18, - 0x53, 0xC1, 0x09, 0x51, 0xF7, 0xC0, 0xA6, 0xB2, 0x9B, 0x19, 0x2B, 0x14, 0x66, - 0x66, 0x4B, 0x39, 0x62, 0x1D, 0x84, 0xB9, 0x02, 0x84, 0xAC, 0xC1, 0xDA, 0x6C, - 0x80, 0xCD, 0x40, 0x20, 0x20, 0x19, 0x51, 0xDC, 0x2B, 0x7D, 0x5D, 0x7F, 0xE3, - 0x86, 0x8E, 0xC3, 0x35, 0xFE, 0x5C, 0xF6, 0x1C, 0xFF, 0x05, 0x9E, 0xB5, 0xB6, - 0xBB, 0xBE, 0xF7, 0x2F, 0xB7, 0xE1, 0xF5, 0x33, 0x86, 0xA0, 0x47, 0xDE, 0xF7, - 0xE9, 0x3B, 0xBE, 0x7E, 0x9B, 0x17, 0xFC, 0xFD, 0x2E, 0x40, 0x86, 0x41, 0x75, - 0xF1, 0xB2, 0x18, 0xA9, 0xDE, 0x2D, 0xD6, 0x04, 0x20, 0xA4, 0xBA, 0x81, 0xBC, - 0x1D, 0x5A, 0xD6, 0xF7, 0xF6, 0xB8, 0x42, 0xF7, 0xF5, 0x3D, 0x97, 0xAC, 0xCD, - 0x6F, 0xAD, 0xDB, 0x4F, 0x5A, 0x2E, 0x64, 0xB9, 0x5D, 0xDD, 0x8B, 0x4A, 0x35, - 0x44, 0xFE, 0x3D, 0xC6, 0x77, 0x7A, 0xBF, 0xDA, 0xAC, 0x9E, 0xB0, 0xA2, 0xB9, - 0x6C, 0xAF, 0x02, 0xDD, 0xF2, 0x71, 0x2B, 0xEF, 0xD3, 0x51, 0x0E, 0x07, 0x11, - 0xBD, 0xED, 0x39, 0x7F, 0xD9, 0xB8, 0xBD, 0xEE, 0x35, 0xE9, 0x5C, 0x67, 0x42, - 0xDA, 0x05, 0x6E, 0x39, 0xCE, 0x55, 0xFB, 0x26, 0xB7, 0x90, 0x4B, 0xDA, 0x91, - 0x48, 0xFD, 0xDE, 0xB2, 0xEC, 0x88, 0x9A, 0x46, 0x1A, 0x4C, 0xD4, 0x05, 0x12, - 0x85, 0x57, 0x37, 0x22, 0xD3, 0x0E, 0x4F, 0x79, 0xE3, 0x81, 0xA9, 0x2B, 0x5F, - 0xD7, 0x6D, 0xBD, 0x21, 0x98, 0x6F, 0x7D, 0xF5, 0x32, 0x7A, 0x6E, 0xF8, 0x20, - 0x01, 0x50, 0x90, 0x7A, 0x88, 0x3E, 0x0D, 0x57, 0xB1, 0x58, 0x65, 0xE6, 0x82, - 0xCE, 0x08, 0x69, 0x8B, 0x87, 0x62, 0x36, 0xB1, 0x7B, 0xDE, 0x74, 0xBD, 0xFE, - 0x10, 0xBE, 0x26, 0xAB, 0x7E, 0xB7, 0x8D, 0xF7, 0x83, 0x2E, 0x0F, 0xAF, 0x7E, - 0xBC, 0x17, 0x31, 0xFF, 0xB0, 0x4F, 0x7F, 0x4B, 0x13, 0x83, 0xDF, 0xEE, 0x23, - 0xD3, 0xE7, 0xC8, 0xAF, 0x75, 0xAB, 0xEA, 0xBD, 0x7D, 0xD2, 0x9D, 0xE9, 0xC1, - 0x18, 0x8B, 0x7C, 0x9F, 0x51, 0xDC, 0x37, 0xA3, 0xDB, 0xFC, 0xD4, 0x6A, 0x91, - 0x44, 0x7F, 0x72, 0xC5, 0xD9, 0xC8, 0x37, 0x38, 0x63, 0x0D, 0x59, 0x8B, 0x7F, - 0x7D, 0x96, 0xC1, 0x5F, 0x4C, 0x7C, 0x88, 0xCB, 0x65, 0x07, 0x2B, 0x0E, 0x1D, - 0x24, 0xAA, 0x20, 0x2E, 0x6C, 0x33, 0xAB, 0xEF, 0x23, 0xE5, 0xE3, 0x6C, 0xA3, - 0xA5, 0x2D, 0x01, 0xDF, 0x26, 0x92, 0x52, 0xF5, 0xE6, 0x3E, 0xE3, 0xDD, 0xC6, - 0xED, 0x42, 0x0F, 0x71, 0x7B, 0xD1, 0xF4, 0x06, 0xF6, 0x82, 0xD5, 0x13, 0xB3, - 0x60, 0x31, 0x09, 0x89, 0x63, 0x15, 0xD2, 0xCB, 0xAA, 0x77, 0xFD, 0xF4, 0xEB, - 0xF4, 0xED, 0x2E, 0xE2, 0xBA, 0x27, 0x2E, 0x74, 0xD2, 0x91, 0x7F, 0x0F, 0xDE, - 0x25, 0xFE, 0x78, 0x20, 0x05, 0x0A, 0x6A, 0xFE, 0x89, 0x14, 0x23, 0xF3, 0xF5, - 0x3A, 0x1E, 0xF3, 0x22, 0xCE, 0x12, 0x82, 0x24, 0x11, 0x05, 0x04, 0x71, 0x99, - 0xE5, 0xF0, 0xA6, 0xDB, 0x7B, 0xF5, 0x8F, 0xF9, 0x3C, 0x02, 0x0C, 0x46, 0xFD, - 0xB6, 0xEA, 0x06, 0x11, 0xF4, 0x1E, 0x7A, 0x20, 0x6A, 0x54, 0xBB, 0x4A, 0x60, - 0xB0, 0x30, 0x28, 0x9A, 0xF3, 0x3B, 0xE9, 0xBD, 0xD6, 0x04, 0xCA, 0x3A, 0x33, - 0x37, 0x5F, 0xB7, 0xAD, 0xE7, 0x9C, 0xE2, 0x95, 0x21, 0xF7, 0xB5, 0xC4, 0xF0, - 0xD1, 0x51, 0x09, 0x44, 0x3F, 0x07, 0xFC, 0x5F, 0x37, 0xFD, 0x7D, 0x7E, 0xD5, - 0xF7, 0xEB, 0x69, 0xB9, 0x54, 0x98, 0x5A, 0x2A, 0x56, 0xE3, 0xC0, 0x21, 0x57, - 0xD1, 0xEB, 0x75, 0x15, 0xED, 0xAC, 0xAF, 0x5D, 0xFF, 0xC2, 0xFE, 0x4E, 0xFB, - 0xBA, 0x13, 0xB8, 0x87, 0xFA, 0x4E, 0x5E, 0x5C, 0x24, 0x15, 0x5B, 0x2B, 0x2C, - 0x32, 0x68, 0x1F, 0x30, 0x5F, 0xC1, 0xF7, 0xE7, 0xE1, 0x9C, 0x00, 0xC1, 0x9C, - 0xB1, 0xAB, 0xFA, 0xFF, 0xC1, 0x1E, 0x72, 0xA1, 0x46, 0x9E, 0x2E, 0xCD, 0x76, - 0x96, 0x4F, 0x14, 0xDC, 0x68, 0xC1, 0x10, 0x9F, 0xDF, 0xEB, 0x5A, 0xBA, 0x8D, - 0x91, 0x4E, 0x76, 0xE9, 0x3A, 0x43, 0x2D, 0x88, 0xD2, 0x81, 0x0C, 0xEC, 0x6F, - 0xB7, 0xA4, 0x8B, 0x97, 0x4F, 0xC4, 0x1E, 0xF3, 0x0F, 0xF5, 0x66, 0x66, 0xBF, - 0x6C, 0x3F, 0xFB, 0x6E, 0x2B, 0x48, 0x6C, 0x7B, 0xD1, 0x2E, 0x64, 0xD1, 0x0B, - 0x6E, 0x5B, 0x05, 0x16, 0xDD, 0xCB, 0x1B, 0xDE, 0xA2, 0xB9, 0xA8, 0x94, 0xD6, - 0x5A, 0x5B, 0xE2, 0xC9, 0xBC, 0xD5, 0xAB, 0x64, 0x5B, 0x0F, 0x9A, 0xFD, 0xC7, - 0x2E, 0xB7, 0xEF, 0xAE, 0xE9, 0x1F, 0x32, 0xD2, 0xCA, 0xA0, 0x37, 0x63, 0x86, - 0x72, 0x41, 0x07, 0xBC, 0xAB, 0x6F, 0xFF, 0xB7, 0x16, 0xAA, 0xA9, 0x58, 0x9E, - 0x43, 0x9C, 0x22, 0x8D, 0x48, 0xCE, 0xE5, 0xEF, 0xE0, 0x7D, 0x47, 0x87, 0x5A, - 0xA8, 0x5B, 0x06, 0xA9, 0x47, 0xF0, 0x26, 0xB4, 0x99, 0xD8, 0xA3, 0x64, 0xED, - 0x73, 0xB3, 0x96, 0xB4, 0x21, 0x19, 0xA5, 0xC1, 0xDC, 0x88, 0x2E, 0xEE, 0xF2, - 0x77, 0x91, 0xEC, 0xFB, 0xD5, 0xF9, 0xF8, 0x90, 0x47, 0xAD, 0xF5, 0xEB, 0x96, - 0x6D, 0xF1, 0x1C, 0xE0, 0xDC, 0x74, 0x1C, 0xE6, 0x2E, 0xE1, 0x76, 0x9D, 0xEE, - 0xF4, 0xEF, 0xA5, 0x31, 0x03, 0x87, 0x0E, 0x2C, 0x84, 0xA5, 0xF1, 0x22, 0xBE, - 0x48, 0xA9, 0xCD, 0x09, 0x07, 0xC1, 0xF0, 0xD4, 0xE7, 0x03, 0x82, 0x39, 0xE2, - 0xA0, 0x0B, 0xDE, 0xAC, 0x37, 0xAC, 0x62, 0x97, 0x8E, 0x79, 0xCE, 0x52, 0x24, - 0x78, 0xF9, 0x17, 0xD2, 0xF1, 0x5D, 0x2D, 0xA1, 0xDF, 0x12, 0x2C, 0x83, 0xE5, - 0x1A, 0x28, 0x9A, 0x2D, 0xED, 0x8A, 0xBF, 0xFC, 0x41, 0xC3, 0xEB, 0x0E, 0x91, - 0xDB, 0xF2, 0xA1, 0xC8, 0xA8, 0x01, 0x8B, 0xF2, 0xF3, 0x59, 0xB7, 0xA7, 0x6F, - 0x80, 0xFF, 0x0B, 0x46, 0xE1, 0x63, 0xA7, 0x5F, 0x6B, 0xBE, 0x33, 0x71, 0xBE, - 0x3A, 0xAF, 0xA9, 0x53, 0x5D, 0x3B, 0xB2, 0xF6, 0xEB, 0x42, 0x1C, 0x3E, 0x3F, - 0x1D, 0x6A, 0x34, 0xAE, 0xB1, 0x05, 0xA1, 0x32, 0x6C, 0xB5, 0xE4, 0xD3, 0xBB, - 0xE8, 0x10, 0x14, 0x9E, 0x68, 0x6A, 0x24, 0x51, 0xA5, 0x66, 0x64, 0xCC, 0xC4, - 0x2D, 0x96, 0xA2, 0xC7, 0x2D, 0x1F, 0x0A, 0x0F, 0x6B, 0xD9, 0xAD, 0xA3, 0x11, - 0x8F, 0x00, 0xAA, 0x06, 0xC2, 0x1E, 0xF3, 0xE8, 0x5A, 0x37, 0x4C, 0xD6, 0x4B, - 0x6B, 0x01, 0xC9, 0xB0, 0xB6, 0xB9, 0x92, 0xED, 0x1D, 0x08, 0xB0, 0x80, 0x06, - 0x20, 0xEA, 0xEE, 0xF9, 0x1D, 0xA4, 0x57, 0x73, 0x2E, 0x1B, 0xA5, 0xAF, 0xF6, - 0xAF, 0xAE, 0x04, 0x7C, 0x4C, 0x7E, 0xC8, 0xDB, 0xC0, 0xFB, 0x37, 0xC8, 0x7E, - 0xFE, 0x47, 0x0A, 0x3C, 0xFA, 0x61, 0xE7, 0xEB, 0x1B, 0xF3, 0x7C, 0x32, 0xE3, - 0x7C, 0x37, 0x66, 0x7C, 0x53, 0x07, 0xC2, 0x37, 0xA3, 0xBD, 0xF7, 0xFA, 0xE3, - 0x8A, 0x76, 0xCB, 0x6C, 0xC8, 0x13, 0xC4, 0x53, 0x53, 0xDB, 0xAD, 0x37, 0x1A, - 0xEB, 0xE0 -}; +static const uint8_t kPacketDataOkWithFieldLen4[] = { + 0x00, 0x00, 0x0B, 0xF7, 0x65, 0xB8, 0x40, 0x57, 0x0B, 0xF0, 0xDF, 0xF8, + 0x00, 0x1F, 0x78, 0x98, 0x54, 0xAC, 0xF2, 0x00, 0x04, 0x9D, 0x26, 0xE0, + 0x3B, 0x5C, 0x00, 0x0A, 0x00, 0x8F, 0x9E, 0x86, 0x63, 0x1B, 0x46, 0xE7, + 0xD6, 0x45, 0x88, 0x88, 0xEA, 0x10, 0x89, 0x79, 0x01, 0x34, 0x30, 0x01, + 0x8E, 0x7D, 0x1A, 0x39, 0x45, 0x4E, 0x69, 0x86, 0x12, 0xF2, 0xE7, 0xCF, + 0x50, 0xF8, 0x26, 0x54, 0x17, 0xBE, 0x3F, 0xC4, 0x80, 0x32, 0xD8, 0x02, + 0x32, 0xE4, 0xAE, 0xDD, 0x39, 0x11, 0x8E, 0x54, 0x42, 0xAE, 0xBD, 0x12, + 0xA4, 0xCE, 0xE2, 0x98, 0x91, 0x05, 0xC4, 0xA8, 0x20, 0xC7, 0xB3, 0xD9, + 0x47, 0x73, 0x09, 0xD5, 0xCF, 0x62, 0x57, 0x3F, 0xFF, 0xFD, 0xB9, 0x94, + 0x2B, 0x3D, 0x12, 0x1A, 0x84, 0x0B, 0x28, 0xAD, 0x5C, 0x9E, 0x5C, 0xC3, + 0xBB, 0xBD, 0x7F, 0xFE, 0x09, 0x87, 0x74, 0x39, 0x1C, 0xA5, 0x0E, 0x44, + 0xD8, 0x5D, 0x41, 0xDB, 0xAA, 0xBC, 0x05, 0x16, 0xA3, 0x98, 0xEE, 0xEE, + 0x9C, 0xA0, 0xF1, 0x23, 0x90, 0xF0, 0x5E, 0x9F, 0xF4, 0xFA, 0x7F, 0x4B, + 0x69, 0x66, 0x49, 0x52, 0xDD, 0xD6, 0xC0, 0x0F, 0x8C, 0x6E, 0x80, 0xDD, + 0x7A, 0xDF, 0x10, 0xCD, 0x4B, 0x54, 0x6F, 0xFC, 0x7D, 0x34, 0xBA, 0x8B, + 0xD4, 0xD9, 0x30, 0x18, 0x9F, 0x39, 0x04, 0x9F, 0xCB, 0xDB, 0x1B, 0xA7, + 0x70, 0x96, 0xAF, 0xFF, 0x6F, 0xB5, 0xBF, 0x58, 0x01, 0x98, 0xCD, 0xF2, + 0x66, 0x28, 0x1A, 0xC4, 0x9E, 0x58, 0x40, 0x39, 0xAE, 0x07, 0x11, 0x3F, + 0xF2, 0x9B, 0x06, 0x9C, 0xB8, 0xC9, 0x16, 0x12, 0x09, 0x8E, 0xD2, 0xD4, + 0xF5, 0xC6, 0x77, 0x40, 0x0F, 0xFD, 0x12, 0x19, 0x55, 0x1A, 0x8E, 0x9C, + 0x18, 0x8B, 0x0D, 0x18, 0xFA, 0xBA, 0x7F, 0xBB, 0x83, 0xBB, 0x85, 0xA0, + 0xCC, 0xAF, 0xF6, 0xEA, 0x81, 0x10, 0x18, 0x8E, 0x10, 0x00, 0xCB, 0x7F, + 0x27, 0x08, 0x06, 0xDE, 0x3C, 0x20, 0xE5, 0xFE, 0xCC, 0x4F, 0xB3, 0x41, + 0xE0, 0xCC, 0x4C, 0x26, 0xC1, 0xC0, 0x2C, 0x16, 0x12, 0xAA, 0x04, 0x83, + 0x51, 0x4E, 0xCA, 0x00, 0xCF, 0x42, 0x9C, 0x06, 0x2D, 0x06, 0xDD, 0x1D, + 0x08, 0x75, 0xE0, 0x89, 0xC7, 0x62, 0x68, 0x2E, 0xBF, 0x4D, 0x2D, 0x0A, + 0xC4, 0x86, 0xF6, 0x2F, 0xA1, 0x49, 0xA7, 0x0F, 0xDB, 0x1F, 0x82, 0xEC, + 0xC1, 0x62, 0xFB, 0x7F, 0xF1, 0xAE, 0xA6, 0x1A, 0xD5, 0x6B, 0x06, 0x5E, + 0xB6, 0x02, 0x50, 0xAE, 0x2D, 0xF9, 0xD9, 0x95, 0xAD, 0x01, 0x8C, 0x53, + 0x01, 0xAF, 0xCE, 0xE5, 0xA5, 0xBB, 0x95, 0x8A, 0x85, 0x70, 0x77, 0xE3, + 0x9A, 0x68, 0x1B, 0xDF, 0x47, 0xF9, 0xF4, 0xBD, 0x80, 0x7D, 0x76, 0x9A, + 0x69, 0xFC, 0xBE, 0x14, 0x0D, 0x87, 0x09, 0x12, 0x98, 0x20, 0x05, 0x46, + 0xB7, 0xAE, 0x10, 0xB7, 0x01, 0xB7, 0xDE, 0x3B, 0xDD, 0x7A, 0x8A, 0x55, + 0x73, 0xAD, 0xDF, 0x69, 0xDE, 0xD0, 0x51, 0x97, 0xA0, 0xE6, 0x5E, 0xBA, + 0xBA, 0x80, 0x0F, 0x4E, 0x9A, 0x68, 0x36, 0xE6, 0x9F, 0x5B, 0x39, 0xC0, + 0x90, 0xA1, 0xC0, 0xC3, 0x82, 0xE4, 0x50, 0xEA, 0x60, 0x7A, 0xDD, 0x5F, + 0x8B, 0x5F, 0xAF, 0xFC, 0x74, 0xAF, 0xDC, 0x56, 0xF7, 0x2E, 0x3E, 0x97, + 0x6E, 0x2B, 0xF3, 0xAF, 0xFE, 0x7D, 0x32, 0xDC, 0x56, 0xF8, 0xAF, 0xB5, + 0xA3, 0xBB, 0x00, 0x5B, 0x84, 0x3D, 0x9F, 0x0B, 0x40, 0x88, 0x61, 0x5F, + 0x4F, 0x4F, 0xB0, 0xB3, 0x07, 0x81, 0x3E, 0xF2, 0xFB, 0x50, 0xCA, 0x77, + 0x40, 0x12, 0xA8, 0xE6, 0x11, 0x8E, 0xD6, 0x8A, 0xC6, 0xD6, 0x8C, 0x1D, + 0x63, 0x55, 0x3D, 0x34, 0xEA, 0xC3, 0xC6, 0x6A, 0xD2, 0x8C, 0xB0, 0x1D, + 0x5E, 0x4A, 0x7A, 0x8B, 0xD5, 0x99, 0x80, 0x84, 0x32, 0xFB, 0xB7, 0x02, + 0x6E, 0x61, 0xFE, 0xAC, 0x1B, 0x5D, 0x10, 0x23, 0x24, 0xC3, 0x8C, 0x7B, + 0x58, 0x2C, 0x4D, 0x04, 0x74, 0x84, 0x25, 0x10, 0x4E, 0x94, 0x29, 0x4D, + 0x88, 0xAE, 0x65, 0x53, 0xB9, 0x95, 0x4E, 0xE7, 0xDD, 0xEE, 0xF2, 0x70, + 0x1F, 0x26, 0x4F, 0xA8, 0xBC, 0x3D, 0x35, 0x02, 0x3B, 0xC0, 0x98, 0x70, + 0x38, 0x18, 0xE5, 0x1E, 0x05, 0xAC, 0x28, 0xAA, 0x46, 0x1A, 0xB0, 0x19, + 0x99, 0x18, 0x35, 0x78, 0x1E, 0x41, 0x60, 0x0D, 0x4F, 0x7E, 0xEC, 0x37, + 0xC3, 0x30, 0x73, 0x2A, 0x69, 0xFE, 0xEF, 0x27, 0xEE, 0x13, 0xCC, 0xD0, + 0xDB, 0xE6, 0x45, 0xEC, 0x5C, 0xB5, 0x71, 0x54, 0x2E, 0xB1, 0xE9, 0x88, + 0xB4, 0x3F, 0x6F, 0xFD, 0xF7, 0xFF, 0x9D, 0x2D, 0x52, 0x2E, 0xAE, 0xC9, + 0x95, 0xDE, 0xBF, 0xDF, 0xFF, 0xBF, 0x21, 0xB3, 0x2B, 0xF5, 0xF7, 0xF7, + 0xD1, 0xA0, 0xF0, 0x76, 0x68, 0x37, 0xDB, 0x8F, 0x85, 0x4D, 0xA8, 0x1A, + 0xF9, 0x7F, 0x75, 0xA7, 0x93, 0xF5, 0x03, 0xC1, 0xF2, 0x60, 0x8A, 0x92, + 0x53, 0xF5, 0xD1, 0xC1, 0x56, 0x4B, 0x68, 0x05, 0x16, 0x88, 0x61, 0xE7, + 0x14, 0xC8, 0x0D, 0xF0, 0xDF, 0xEF, 0x46, 0x4A, 0xED, 0x0B, 0xD1, 0xD1, + 0xD1, 0xA4, 0x85, 0xA3, 0x2C, 0x1D, 0xDE, 0x45, 0x14, 0xA1, 0x8E, 0xA8, + 0xD9, 0x8C, 0xAB, 0x47, 0x31, 0xF1, 0x00, 0x15, 0xAD, 0x80, 0x20, 0xAA, + 0xE4, 0x57, 0xF8, 0x05, 0x14, 0x58, 0x0B, 0xD3, 0x63, 0x00, 0x8F, 0x44, + 0x15, 0x7F, 0x19, 0xC7, 0x0A, 0xE0, 0x49, 0x32, 0xFE, 0x36, 0x0E, 0xF3, + 0x66, 0x10, 0x2B, 0x11, 0x73, 0x3D, 0x19, 0x92, 0x22, 0x20, 0x75, 0x1F, + 0xF1, 0xDB, 0x96, 0x73, 0xCF, 0x1B, 0x53, 0xFF, 0xD2, 0x23, 0xF2, 0xB6, + 0xAA, 0xB6, 0x44, 0xA3, 0x73, 0x7E, 0x00, 0x2D, 0x4D, 0x4D, 0x87, 0xE0, + 0x84, 0x55, 0xD6, 0x03, 0xB8, 0xD8, 0x90, 0xEF, 0xC0, 0x76, 0x5D, 0x69, + 0x02, 0x00, 0x0E, 0x17, 0xD0, 0x02, 0x96, 0x50, 0xEA, 0xAB, 0xBF, 0x0D, + 0xAF, 0xCB, 0xD3, 0xFF, 0xAA, 0x9D, 0x7F, 0xD6, 0xBD, 0x2C, 0x14, 0xB4, + 0xCD, 0x20, 0x73, 0xB4, 0xF4, 0x38, 0x96, 0xDE, 0xB0, 0x6B, 0xE5, 0x1B, + 0xFD, 0x0E, 0x0B, 0xA4, 0x81, 0xBF, 0xC8, 0xA0, 0x21, 0x76, 0x7B, 0x25, + 0x3F, 0xE6, 0x84, 0x40, 0x1A, 0xDA, 0x25, 0x5A, 0xFF, 0x73, 0x6B, 0x14, + 0x1B, 0xF7, 0x08, 0xFA, 0x26, 0x73, 0x7A, 0x58, 0x02, 0x1A, 0xE6, 0x63, + 0xB6, 0x45, 0x7B, 0xE3, 0xE0, 0x80, 0x14, 0x42, 0xA8, 0x7D, 0xF3, 0x80, + 0x9B, 0x01, 0x43, 0x82, 0x82, 0x8C, 0xBE, 0x0D, 0xFD, 0xAE, 0x88, 0xA8, + 0xB9, 0xC3, 0xEE, 0xFF, 0x46, 0x00, 0x84, 0xE6, 0xB4, 0x0C, 0xA9, 0x66, + 0xC6, 0x74, 0x72, 0xAA, 0xA4, 0x3A, 0xB0, 0x1B, 0x06, 0xB4, 0xDB, 0xE8, + 0xC2, 0x17, 0xA2, 0xBC, 0xBE, 0x5C, 0x0F, 0x2A, 0x76, 0xD5, 0xEE, 0x39, + 0x36, 0x7C, 0x25, 0x94, 0x15, 0x3C, 0xC9, 0xB9, 0x93, 0x07, 0x19, 0xAF, + 0xE6, 0x70, 0xC3, 0xF5, 0xD4, 0x17, 0x87, 0x57, 0x77, 0x7D, 0xCF, 0x0D, + 0xDD, 0xDE, 0xB7, 0xFF, 0xB4, 0xDA, 0x20, 0x45, 0x1A, 0x45, 0xF4, 0x58, + 0x01, 0xBC, 0xEB, 0x3F, 0x16, 0x7F, 0x4C, 0x15, 0x84, 0x8C, 0xE5, 0xF6, + 0x96, 0xA6, 0xA1, 0xB9, 0xB2, 0x7F, 0x6B, 0xFF, 0x31, 0xF2, 0xF5, 0xC9, + 0xFF, 0x61, 0xEE, 0xB5, 0x84, 0xAE, 0x68, 0x41, 0xEA, 0xD0, 0xF0, 0xA5, + 0xCE, 0x0C, 0xE6, 0x4C, 0x6D, 0x6D, 0x94, 0x08, 0xC9, 0xA9, 0x4A, 0x60, + 0x6D, 0x01, 0x3B, 0xEF, 0x4D, 0x99, 0x8D, 0x42, 0x2A, 0x6B, 0x8A, 0xC7, + 0xFA, 0xA9, 0x90, 0x40, 0x00, 0x90, 0xF3, 0xA0, 0x75, 0x8E, 0xD5, 0xFE, + 0xE7, 0xBD, 0x02, 0x87, 0x0C, 0x7D, 0xF0, 0xAF, 0x1E, 0x5F, 0x8D, 0xC8, + 0xE1, 0xD4, 0x56, 0x08, 0xBF, 0x76, 0x80, 0xD4, 0x18, 0x89, 0x2D, 0x57, + 0xDF, 0x66, 0xD0, 0x46, 0x68, 0x77, 0x55, 0x47, 0xF5, 0x7C, 0xF7, 0xA6, + 0x66, 0xD6, 0x5A, 0x64, 0x55, 0xD4, 0x80, 0xC4, 0x55, 0xE9, 0x36, 0x3F, + 0x5E, 0xE2, 0x5C, 0x7F, 0x5F, 0xCE, 0x7F, 0xE1, 0x0C, 0x82, 0x3D, 0x6B, + 0x6E, 0xA2, 0xEA, 0x3B, 0x1F, 0xE8, 0x9E, 0xC7, 0x4E, 0x24, 0x3D, 0xDD, + 0xFA, 0xEB, 0x71, 0xDF, 0xFE, 0x15, 0xFE, 0x41, 0x9B, 0xB4, 0x4E, 0xAB, + 0x51, 0xE5, 0x1F, 0x7D, 0x2D, 0xAC, 0xD0, 0x66, 0xD9, 0xA1, 0x59, 0x78, + 0xC6, 0xEF, 0xC4, 0x43, 0x08, 0x65, 0x18, 0x73, 0xDE, 0x2A, 0xAD, 0x72, + 0xE7, 0x5A, 0x7E, 0x33, 0x04, 0x72, 0x38, 0x57, 0x47, 0x73, 0x10, 0x1D, + 0x88, 0x57, 0x4C, 0xDF, 0xA7, 0x78, 0x16, 0xFB, 0x01, 0x21, 0x28, 0x2D, + 0xB6, 0x7E, 0x05, 0x18, 0x32, 0x52, 0xC3, 0x49, 0x0B, 0x32, 0x18, 0x12, + 0x93, 0x54, 0x15, 0x3B, 0xC8, 0x6D, 0x4A, 0x77, 0xEF, 0x0A, 0x46, 0x83, + 0x89, 0x5C, 0x8B, 0xCB, 0x18, 0xA6, 0xDC, 0x97, 0x6F, 0xEE, 0xEE, 0x00, + 0x6A, 0xF1, 0x10, 0xFE, 0x07, 0x0C, 0xE0, 0x53, 0xD2, 0xB8, 0x45, 0xF4, + 0x6E, 0x16, 0x4B, 0xC9, 0x9C, 0xC7, 0x93, 0x83, 0x23, 0x1D, 0x4D, 0x00, + 0xB9, 0x4F, 0x86, 0x51, 0xF0, 0x29, 0x69, 0x41, 0x21, 0xC5, 0x4A, 0xC6, + 0x6D, 0xD1, 0x81, 0x38, 0xDB, 0x7C, 0x06, 0xA8, 0x26, 0x8E, 0x71, 0x00, + 0x4C, 0x44, 0x14, 0x05, 0xF2, 0x1C, 0x00, 0x49, 0xFC, 0x29, 0x6A, 0xF9, + 0x9E, 0xD1, 0x35, 0x4B, 0xB7, 0xE5, 0xDB, 0xFC, 0x01, 0x04, 0x3F, 0x70, + 0x33, 0x56, 0x87, 0x69, 0x01, 0xB4, 0xCE, 0x1C, 0x4D, 0x2E, 0x83, 0x51, + 0x51, 0xD0, 0x37, 0x3B, 0xB4, 0xBA, 0x47, 0xF5, 0xFF, 0xBF, 0xFA, 0xD5, + 0x03, 0x65, 0xD3, 0x28, 0x9F, 0x38, 0x57, 0xFE, 0x71, 0xD8, 0x9C, 0x16, + 0xEE, 0x72, 0x19, 0x03, 0x17, 0x6E, 0xC0, 0xEC, 0x49, 0x3D, 0x96, 0xE2, + 0x30, 0x97, 0x97, 0x84, 0x38, 0x6B, 0xE8, 0x2E, 0xAB, 0x0E, 0x2E, 0x03, + 0x52, 0xBA, 0x68, 0x55, 0xBA, 0x1D, 0x2C, 0x47, 0xAA, 0x72, 0xAE, 0x02, + 0x31, 0x6E, 0xA1, 0xDC, 0xAD, 0x0F, 0x4A, 0x46, 0xC9, 0xF2, 0xA9, 0xAB, + 0xFD, 0x87, 0x89, 0x5C, 0xB3, 0x75, 0x7E, 0xE3, 0xDE, 0x9F, 0xC4, 0x02, + 0x1E, 0xA2, 0xF8, 0x8B, 0xD3, 0x00, 0x83, 0x96, 0xC4, 0xD0, 0xB9, 0x62, + 0xB9, 0x69, 0xEC, 0x56, 0xDF, 0x7D, 0x91, 0x4B, 0x68, 0x27, 0xA8, 0x61, + 0x78, 0xA7, 0x95, 0x66, 0x51, 0x41, 0xF6, 0xCE, 0x78, 0xD3, 0x9A, 0x91, + 0xA0, 0x31, 0x09, 0x47, 0xB8, 0x47, 0xB8, 0x44, 0xE1, 0x13, 0x86, 0x7E, + 0x92, 0x80, 0xC6, 0x1A, 0xF7, 0x79, 0x7E, 0xF1, 0x5D, 0x9F, 0x17, 0x2D, + 0x80, 0x00, 0x79, 0x34, 0x7D, 0xE3, 0xAD, 0x60, 0x00, 0x20, 0x07, 0x80, + 0x00, 0x40, 0x01, 0xF8, 0xA1, 0x86, 0xB1, 0xEE, 0x21, 0x63, 0x85, 0x60, + 0x51, 0x84, 0x90, 0x7E, 0x92, 0x09, 0x39, 0x1C, 0x16, 0x87, 0x5C, 0xA6, + 0x09, 0x90, 0x06, 0x34, 0x6E, 0xB8, 0x8D, 0x5D, 0xAC, 0x77, 0x97, 0xB5, + 0x4D, 0x30, 0xFD, 0x39, 0xD0, 0x50, 0x00, 0xC9, 0x98, 0x04, 0x86, 0x00, + 0x0D, 0xD8, 0x3E, 0x34, 0xC2, 0xA6, 0x25, 0xF8, 0x20, 0xCC, 0x6D, 0x9E, + 0x63, 0x05, 0x30, 0xC4, 0xC6, 0xCC, 0x54, 0x31, 0x9F, 0x3C, 0xF5, 0x86, + 0xB9, 0x08, 0x18, 0xC3, 0x1E, 0xB9, 0xA0, 0x0C, 0x45, 0x2C, 0x54, 0x32, + 0x8B, 0x85, 0x86, 0x59, 0xC3, 0xB3, 0x50, 0x5A, 0xFE, 0xBA, 0xF7, 0x4D, + 0xC9, 0x9C, 0x9E, 0x01, 0xDF, 0xD7, 0x6E, 0xB5, 0x15, 0x53, 0x08, 0x57, + 0xA4, 0x71, 0x36, 0x80, 0x46, 0x05, 0x21, 0x48, 0x7B, 0x91, 0xC8, 0xAA, + 0xFF, 0x07, 0x9F, 0x78, 0x68, 0xCF, 0x3C, 0xEF, 0xFF, 0xBC, 0xB6, 0xA2, + 0x36, 0xB7, 0x9F, 0x54, 0xF6, 0x6F, 0x5D, 0xDD, 0x75, 0xD4, 0x3C, 0x75, + 0xE8, 0xCF, 0x15, 0x02, 0x5B, 0x94, 0xC3, 0xA2, 0x41, 0x63, 0xA1, 0x14, + 0xF6, 0xC0, 0x57, 0x15, 0x9F, 0x0C, 0x3F, 0x80, 0xF2, 0x98, 0xEE, 0x41, + 0x85, 0xEE, 0xBC, 0xAA, 0xE9, 0x59, 0xAA, 0xA0, 0x92, 0xCA, 0x00, 0xF3, + 0x50, 0xCC, 0xFF, 0xAD, 0x97, 0x69, 0xA7, 0xF2, 0x0B, 0x8F, 0xD7, 0xD7, + 0x82, 0x3A, 0xBB, 0x98, 0x1D, 0xCB, 0x89, 0x0B, 0x9B, 0x05, 0xF7, 0xD0, + 0x1A, 0x60, 0xF3, 0x29, 0x16, 0x12, 0xF8, 0xF4, 0xF1, 0x4A, 0x05, 0x9B, + 0x57, 0x12, 0x7E, 0x3A, 0x4A, 0x8D, 0xA6, 0xDF, 0xB6, 0xDD, 0xDF, 0xC3, + 0xF0, 0xD2, 0xD4, 0xD7, 0x41, 0xA6, 0x00, 0x76, 0x8C, 0x75, 0x08, 0xF0, + 0x19, 0xD8, 0x14, 0x63, 0x55, 0x52, 0x18, 0x30, 0x98, 0xD0, 0x3F, 0x65, + 0x52, 0xB3, 0x88, 0x6D, 0x17, 0x39, 0x93, 0xCA, 0x3B, 0xB4, 0x1D, 0x8D, + 0xDF, 0xDF, 0xAD, 0x72, 0xDA, 0x74, 0xAF, 0xBD, 0x31, 0xF9, 0x12, 0x61, + 0x45, 0x29, 0x4C, 0x2B, 0x61, 0xA1, 0x12, 0x90, 0x53, 0xE7, 0x5A, 0x9D, + 0x44, 0xC8, 0x3A, 0x83, 0xDC, 0x34, 0x4C, 0x07, 0xAF, 0xDB, 0x90, 0xCD, + 0x03, 0xA4, 0x64, 0x78, 0xBD, 0x55, 0xB2, 0x56, 0x59, 0x32, 0xAB, 0x13, + 0x2C, 0xC9, 0x77, 0xF8, 0x3B, 0xDF, 0xFF, 0xAC, 0x07, 0xB9, 0x08, 0x7B, + 0xE9, 0x82, 0xB9, 0x59, 0xC7, 0xFF, 0x86, 0x2C, 0x12, 0x7C, 0xC6, 0x65, + 0x3C, 0x71, 0xB8, 0x98, 0x9F, 0xA2, 0x45, 0x03, 0xA5, 0xD9, 0xC3, 0xCF, + 0xFA, 0xEB, 0x89, 0xAD, 0x03, 0xEE, 0xDD, 0x76, 0xD3, 0x4F, 0x10, 0x6F, + 0xF0, 0xC1, 0x60, 0x0C, 0x00, 0xD4, 0x76, 0x12, 0x0A, 0x8D, 0xDC, 0xFD, + 0x5E, 0x0B, 0x26, 0x2F, 0x01, 0x1D, 0xB9, 0xE7, 0x73, 0xD4, 0xF2, 0xCB, + 0xD8, 0x78, 0x21, 0x52, 0x4B, 0x83, 0x3C, 0x44, 0x72, 0x0E, 0xB1, 0x4E, + 0x37, 0xBC, 0xC7, 0x50, 0xFA, 0x07, 0x80, 0x71, 0x10, 0x0B, 0x24, 0xD1, + 0x7E, 0xDA, 0x7F, 0xA7, 0x2F, 0x40, 0xAA, 0xD3, 0xF5, 0x44, 0x10, 0x56, + 0x4E, 0x3B, 0xF1, 0x6E, 0x9A, 0xA0, 0xEA, 0x85, 0x66, 0x16, 0xFB, 0x5C, + 0x0B, 0x2B, 0x74, 0x18, 0xAF, 0x3D, 0x04, 0x3E, 0xCE, 0x88, 0x9B, 0x3E, + 0xF4, 0xB9, 0x00, 0x60, 0x0E, 0xE1, 0xE2, 0xCB, 0x12, 0xB9, 0x6D, 0x5A, + 0xC7, 0x55, 0x1D, 0xB9, 0x79, 0xAC, 0x43, 0x43, 0xE6, 0x3B, 0xDD, 0x7E, + 0x9F, 0x78, 0xD3, 0xEA, 0xA3, 0x11, 0xFF, 0xDB, 0xBB, 0xB8, 0x97, 0x37, + 0x15, 0xDB, 0xF1, 0x97, 0x96, 0xC7, 0xFC, 0xE5, 0xBF, 0xF2, 0x86, 0xC0, + 0xFA, 0x9B, 0x4C, 0x00, 0x04, 0x03, 0xA5, 0xB6, 0xB7, 0x9C, 0xD9, 0xAB, + 0x09, 0x77, 0x51, 0x18, 0x3B, 0xAD, 0x61, 0x6C, 0xFC, 0x51, 0x96, 0xFB, + 0x19, 0xC8, 0x52, 0x35, 0x07, 0x00, 0x63, 0x87, 0x14, 0x04, 0xFA, 0x7A, + 0x48, 0x3E, 0x00, 0x47, 0x29, 0x07, 0x74, 0x97, 0x74, 0x84, 0xEB, 0xB2, + 0x16, 0xB2, 0x31, 0x81, 0xCE, 0x2A, 0x31, 0xA7, 0xB1, 0xEB, 0x83, 0x34, + 0x7A, 0x73, 0xD7, 0x2F, 0xFF, 0xBC, 0xFF, 0xE5, 0xAA, 0xF2, 0xB5, 0x6E, + 0x9E, 0xA5, 0x70, 0x8A, 0x8C, 0xDF, 0x6A, 0x06, 0x16, 0xC1, 0xAB, 0x59, + 0x70, 0xD9, 0x3D, 0x47, 0x7C, 0xDD, 0xEF, 0xDF, 0x2F, 0xFF, 0x42, 0x6B, + 0xBA, 0x4B, 0xBF, 0xF8, 0x7F, 0xF2, 0x03, 0x0D, 0x79, 0xBC, 0x03, 0x76, + 0x64, 0x1C, 0x0D, 0x7B, 0xD7, 0xBD, 0xB0, 0x6C, 0xD8, 0x61, 0x17, 0x17, + 0x8C, 0xED, 0x4E, 0x20, 0xEB, 0x55, 0x33, 0x39, 0xE9, 0x7E, 0xBE, 0x8E, + 0x05, 0x4B, 0x78, 0x96, 0x85, 0xCC, 0x68, 0xC9, 0x78, 0xAF, 0xAE, 0x44, + 0x36, 0x61, 0xD3, 0x53, 0xEB, 0xB3, 0x3E, 0x4F, 0x97, 0xE2, 0x8D, 0xAE, + 0x90, 0xED, 0xB5, 0x4F, 0x8E, 0xE4, 0x7A, 0x44, 0xCF, 0x9D, 0xC5, 0x77, + 0x4D, 0xAB, 0x4F, 0xE5, 0xC5, 0x73, 0xA0, 0xC8, 0xA5, 0xBB, 0x4B, 0x7D, + 0xD5, 0xFB, 0xFB, 0xFF, 0x61, 0xFD, 0xAA, 0x1A, 0x62, 0x7E, 0x3C, 0x66, + 0x34, 0x15, 0x64, 0x25, 0xEC, 0x7C, 0x9D, 0x6A, 0x64, 0x4D, 0x80, 0xD5, + 0x4F, 0xFE, 0x8E, 0xEE, 0x18, 0x53, 0xC1, 0x09, 0x51, 0xF7, 0xC0, 0xA6, + 0xB2, 0x9B, 0x19, 0x2B, 0x14, 0x66, 0x66, 0x4B, 0x39, 0x62, 0x1D, 0x84, + 0xB9, 0x02, 0x84, 0xAC, 0xC1, 0xDA, 0x6C, 0x80, 0xCD, 0x40, 0x20, 0x20, + 0x19, 0x51, 0xDC, 0x2B, 0x7D, 0x5D, 0x7F, 0xE3, 0x86, 0x8E, 0xC3, 0x35, + 0xFE, 0x5C, 0xF6, 0x1C, 0xFF, 0x05, 0x9E, 0xB5, 0xB6, 0xBB, 0xBE, 0xF7, + 0x2F, 0xB7, 0xE1, 0xF5, 0x33, 0x86, 0xA0, 0x47, 0xDE, 0xF7, 0xE9, 0x3B, + 0xBE, 0x7E, 0x9B, 0x17, 0xFC, 0xFD, 0x2E, 0x40, 0x86, 0x41, 0x75, 0xF1, + 0xB2, 0x18, 0xA9, 0xDE, 0x2D, 0xD6, 0x04, 0x20, 0xA4, 0xBA, 0x81, 0xBC, + 0x1D, 0x5A, 0xD6, 0xF7, 0xF6, 0xB8, 0x42, 0xF7, 0xF5, 0x3D, 0x97, 0xAC, + 0xCD, 0x6F, 0xAD, 0xDB, 0x4F, 0x5A, 0x2E, 0x64, 0xB9, 0x5D, 0xDD, 0x8B, + 0x4A, 0x35, 0x44, 0xFE, 0x3D, 0xC6, 0x77, 0x7A, 0xBF, 0xDA, 0xAC, 0x9E, + 0xB0, 0xA2, 0xB9, 0x6C, 0xAF, 0x02, 0xDD, 0xF2, 0x71, 0x2B, 0xEF, 0xD3, + 0x51, 0x0E, 0x07, 0x11, 0xBD, 0xED, 0x39, 0x7F, 0xD9, 0xB8, 0xBD, 0xEE, + 0x35, 0xE9, 0x5C, 0x67, 0x42, 0xDA, 0x05, 0x6E, 0x39, 0xCE, 0x55, 0xFB, + 0x26, 0xB7, 0x90, 0x4B, 0xDA, 0x91, 0x48, 0xFD, 0xDE, 0xB2, 0xEC, 0x88, + 0x9A, 0x46, 0x1A, 0x4C, 0xD4, 0x05, 0x12, 0x85, 0x57, 0x37, 0x22, 0xD3, + 0x0E, 0x4F, 0x79, 0xE3, 0x81, 0xA9, 0x2B, 0x5F, 0xD7, 0x6D, 0xBD, 0x21, + 0x98, 0x6F, 0x7D, 0xF5, 0x32, 0x7A, 0x6E, 0xF8, 0x20, 0x01, 0x50, 0x90, + 0x7A, 0x88, 0x3E, 0x0D, 0x57, 0xB1, 0x58, 0x65, 0xE6, 0x82, 0xCE, 0x08, + 0x69, 0x8B, 0x87, 0x62, 0x36, 0xB1, 0x7B, 0xDE, 0x74, 0xBD, 0xFE, 0x10, + 0xBE, 0x26, 0xAB, 0x7E, 0xB7, 0x8D, 0xF7, 0x83, 0x2E, 0x0F, 0xAF, 0x7E, + 0xBC, 0x17, 0x31, 0xFF, 0xB0, 0x4F, 0x7F, 0x4B, 0x13, 0x83, 0xDF, 0xEE, + 0x23, 0xD3, 0xE7, 0xC8, 0xAF, 0x75, 0xAB, 0xEA, 0xBD, 0x7D, 0xD2, 0x9D, + 0xE9, 0xC1, 0x18, 0x8B, 0x7C, 0x9F, 0x51, 0xDC, 0x37, 0xA3, 0xDB, 0xFC, + 0xD4, 0x6A, 0x91, 0x44, 0x7F, 0x72, 0xC5, 0xD9, 0xC8, 0x37, 0x38, 0x63, + 0x0D, 0x59, 0x8B, 0x7F, 0x7D, 0x96, 0xC1, 0x5F, 0x4C, 0x7C, 0x88, 0xCB, + 0x65, 0x07, 0x2B, 0x0E, 0x1D, 0x24, 0xAA, 0x20, 0x2E, 0x6C, 0x33, 0xAB, + 0xEF, 0x23, 0xE5, 0xE3, 0x6C, 0xA3, 0xA5, 0x2D, 0x01, 0xDF, 0x26, 0x92, + 0x52, 0xF5, 0xE6, 0x3E, 0xE3, 0xDD, 0xC6, 0xED, 0x42, 0x0F, 0x71, 0x7B, + 0xD1, 0xF4, 0x06, 0xF6, 0x82, 0xD5, 0x13, 0xB3, 0x60, 0x31, 0x09, 0x89, + 0x63, 0x15, 0xD2, 0xCB, 0xAA, 0x77, 0xFD, 0xF4, 0xEB, 0xF4, 0xED, 0x2E, + 0xE2, 0xBA, 0x27, 0x2E, 0x74, 0xD2, 0x91, 0x7F, 0x0F, 0xDE, 0x25, 0xFE, + 0x78, 0x20, 0x05, 0x0A, 0x6A, 0xFE, 0x89, 0x14, 0x23, 0xF3, 0xF5, 0x3A, + 0x1E, 0xF3, 0x22, 0xCE, 0x12, 0x82, 0x24, 0x11, 0x05, 0x04, 0x71, 0x99, + 0xE5, 0xF0, 0xA6, 0xDB, 0x7B, 0xF5, 0x8F, 0xF9, 0x3C, 0x02, 0x0C, 0x46, + 0xFD, 0xB6, 0xEA, 0x06, 0x11, 0xF4, 0x1E, 0x7A, 0x20, 0x6A, 0x54, 0xBB, + 0x4A, 0x60, 0xB0, 0x30, 0x28, 0x9A, 0xF3, 0x3B, 0xE9, 0xBD, 0xD6, 0x04, + 0xCA, 0x3A, 0x33, 0x37, 0x5F, 0xB7, 0xAD, 0xE7, 0x9C, 0xE2, 0x95, 0x21, + 0xF7, 0xB5, 0xC4, 0xF0, 0xD1, 0x51, 0x09, 0x44, 0x3F, 0x07, 0xFC, 0x5F, + 0x37, 0xFD, 0x7D, 0x7E, 0xD5, 0xF7, 0xEB, 0x69, 0xB9, 0x54, 0x98, 0x5A, + 0x2A, 0x56, 0xE3, 0xC0, 0x21, 0x57, 0xD1, 0xEB, 0x75, 0x15, 0xED, 0xAC, + 0xAF, 0x5D, 0xFF, 0xC2, 0xFE, 0x4E, 0xFB, 0xBA, 0x13, 0xB8, 0x87, 0xFA, + 0x4E, 0x5E, 0x5C, 0x24, 0x15, 0x5B, 0x2B, 0x2C, 0x32, 0x68, 0x1F, 0x30, + 0x5F, 0xC1, 0xF7, 0xE7, 0xE1, 0x9C, 0x00, 0xC1, 0x9C, 0xB1, 0xAB, 0xFA, + 0xFF, 0xC1, 0x1E, 0x72, 0xA1, 0x46, 0x9E, 0x2E, 0xCD, 0x76, 0x96, 0x4F, + 0x14, 0xDC, 0x68, 0xC1, 0x10, 0x9F, 0xDF, 0xEB, 0x5A, 0xBA, 0x8D, 0x91, + 0x4E, 0x76, 0xE9, 0x3A, 0x43, 0x2D, 0x88, 0xD2, 0x81, 0x0C, 0xEC, 0x6F, + 0xB7, 0xA4, 0x8B, 0x97, 0x4F, 0xC4, 0x1E, 0xF3, 0x0F, 0xF5, 0x66, 0x66, + 0xBF, 0x6C, 0x3F, 0xFB, 0x6E, 0x2B, 0x48, 0x6C, 0x7B, 0xD1, 0x2E, 0x64, + 0xD1, 0x0B, 0x6E, 0x5B, 0x05, 0x16, 0xDD, 0xCB, 0x1B, 0xDE, 0xA2, 0xB9, + 0xA8, 0x94, 0xD6, 0x5A, 0x5B, 0xE2, 0xC9, 0xBC, 0xD5, 0xAB, 0x64, 0x5B, + 0x0F, 0x9A, 0xFD, 0xC7, 0x2E, 0xB7, 0xEF, 0xAE, 0xE9, 0x1F, 0x32, 0xD2, + 0xCA, 0xA0, 0x37, 0x63, 0x86, 0x72, 0x41, 0x07, 0xBC, 0xAB, 0x6F, 0xFF, + 0xB7, 0x16, 0xAA, 0xA9, 0x58, 0x9E, 0x43, 0x9C, 0x22, 0x8D, 0x48, 0xCE, + 0xE5, 0xEF, 0xE0, 0x7D, 0x47, 0x87, 0x5A, 0xA8, 0x5B, 0x06, 0xA9, 0x47, + 0xF0, 0x26, 0xB4, 0x99, 0xD8, 0xA3, 0x64, 0xED, 0x73, 0xB3, 0x96, 0xB4, + 0x21, 0x19, 0xA5, 0xC1, 0xDC, 0x88, 0x2E, 0xEE, 0xF2, 0x77, 0x91, 0xEC, + 0xFB, 0xD5, 0xF9, 0xF8, 0x90, 0x47, 0xAD, 0xF5, 0xEB, 0x96, 0x6D, 0xF1, + 0x1C, 0xE0, 0xDC, 0x74, 0x1C, 0xE6, 0x2E, 0xE1, 0x76, 0x9D, 0xEE, 0xF4, + 0xEF, 0xA5, 0x31, 0x03, 0x87, 0x0E, 0x2C, 0x84, 0xA5, 0xF1, 0x22, 0xBE, + 0x48, 0xA9, 0xCD, 0x09, 0x07, 0xC1, 0xF0, 0xD4, 0xE7, 0x03, 0x82, 0x39, + 0xE2, 0xA0, 0x0B, 0xDE, 0xAC, 0x37, 0xAC, 0x62, 0x97, 0x8E, 0x79, 0xCE, + 0x52, 0x24, 0x78, 0xF9, 0x17, 0xD2, 0xF1, 0x5D, 0x2D, 0xA1, 0xDF, 0x12, + 0x2C, 0x83, 0xE5, 0x1A, 0x28, 0x9A, 0x2D, 0xED, 0x8A, 0xBF, 0xFC, 0x41, + 0xC3, 0xEB, 0x0E, 0x91, 0xDB, 0xF2, 0xA1, 0xC8, 0xA8, 0x01, 0x8B, 0xF2, + 0xF3, 0x59, 0xB7, 0xA7, 0x6F, 0x80, 0xFF, 0x0B, 0x46, 0xE1, 0x63, 0xA7, + 0x5F, 0x6B, 0xBE, 0x33, 0x71, 0xBE, 0x3A, 0xAF, 0xA9, 0x53, 0x5D, 0x3B, + 0xB2, 0xF6, 0xEB, 0x42, 0x1C, 0x3E, 0x3F, 0x1D, 0x6A, 0x34, 0xAE, 0xB1, + 0x05, 0xA1, 0x32, 0x6C, 0xB5, 0xE4, 0xD3, 0xBB, 0xE8, 0x10, 0x14, 0x9E, + 0x68, 0x6A, 0x24, 0x51, 0xA5, 0x66, 0x64, 0xCC, 0xC4, 0x2D, 0x96, 0xA2, + 0xC7, 0x2D, 0x1F, 0x0A, 0x0F, 0x6B, 0xD9, 0xAD, 0xA3, 0x11, 0x8F, 0x00, + 0xAA, 0x06, 0xC2, 0x1E, 0xF3, 0xE8, 0x5A, 0x37, 0x4C, 0xD6, 0x4B, 0x6B, + 0x01, 0xC9, 0xB0, 0xB6, 0xB9, 0x92, 0xED, 0x1D, 0x08, 0xB0, 0x80, 0x06, + 0x20, 0xEA, 0xEE, 0xF9, 0x1D, 0xA4, 0x57, 0x73, 0x2E, 0x1B, 0xA5, 0xAF, + 0xF6, 0xAF, 0xAE, 0x04, 0x7C, 0x4C, 0x7E, 0xC8, 0xDB, 0xC0, 0xFB, 0x37, + 0xC8, 0x7E, 0xFE, 0x47, 0x0A, 0x3C, 0xFA, 0x61, 0xE7, 0xEB, 0x1B, 0xF3, + 0x7C, 0x32, 0xE3, 0x7C, 0x37, 0x66, 0x7C, 0x53, 0x07, 0xC2, 0x37, 0xA3, + 0xBD, 0xF7, 0xFA, 0xE3, 0x8A, 0x76, 0xCB, 0x6C, 0xC8, 0x13, 0xC4, 0x53, + 0x53, 0xDB, 0xAD, 0x37, 0x1A, 0xEB, 0xE0}; // Class for testing the FFmpegH264ToAnnexBBitstreamConverter. class FFmpegH264ToAnnexBBitstreamConverterTest : public testing::Test { @@ -263,11 +280,11 @@ class FFmpegH264ToAnnexBBitstreamConverterTest : public testing::Test { // It's ok to do const cast here as data in kHeaderDataOkWithFieldLen4 is // never written to. memset(&test_context_, 0, sizeof(AVCodecContext)); - test_context_.extradata = const_cast<uint8*>(kHeaderDataOkWithFieldLen4); + test_context_.extradata = const_cast<uint8_t*>(kHeaderDataOkWithFieldLen4); test_context_.extradata_size = sizeof(kHeaderDataOkWithFieldLen4); } - void CreatePacket(AVPacket* packet, const uint8* data, uint32 data_size) { + void CreatePacket(AVPacket* packet, const uint8_t* data, uint32_t data_size) { // Create new packet sized of |data_size| from |data|. EXPECT_EQ(av_new_packet(packet, data_size), 0); memcpy(packet->data, data, data_size); @@ -299,7 +316,7 @@ TEST_F(FFmpegH264ToAnnexBBitstreamConverterTest, Conversion_SuccessBigPacket) { // Create new packet with 1000 excess bytes. ScopedAVPacket test_packet(new AVPacket()); - static uint8 excess_data[sizeof(kPacketDataOkWithFieldLen4) + 1000] = {0}; + static uint8_t excess_data[sizeof(kPacketDataOkWithFieldLen4) + 1000] = {0}; memcpy(excess_data, kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4)); CreatePacket(test_packet.get(), excess_data, sizeof(excess_data)); diff --git a/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc b/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc index 06327a4..0d32bb2 100644 --- a/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc +++ b/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc @@ -44,7 +44,7 @@ bool FFmpegH265ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { } } - std::vector<uint8> input_frame; + std::vector<uint8_t> input_frame; std::vector<SubsampleEntry> subsamples; // TODO(servolk): Performance could be improved here, by reducing unnecessary // data copying, but first annex b conversion code needs to be refactored to @@ -64,7 +64,7 @@ bool FFmpegH265ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { DVLOG(4) << "Inserted HEVC decoder params"; } - uint32 output_packet_size = input_frame.size(); + uint32_t output_packet_size = input_frame.size(); if (output_packet_size == 0) return false; // Invalid input packet. diff --git a/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h b/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h index 5892f42..6c2ad03 100644 --- a/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h +++ b/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" #include "media/filters/ffmpeg_bitstream_converter.h" diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index 04350fc..09a119f9 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -61,7 +61,7 @@ static int GetVideoBufferImpl(struct AVCodecContext* s, return decoder->GetVideoBuffer(s, frame, flags); } -static void ReleaseVideoBufferImpl(void* opaque, uint8* data) { +static void ReleaseVideoBufferImpl(void* opaque, uint8_t* data) { scoped_refptr<VideoFrame> video_frame; video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque)); } @@ -286,7 +286,7 @@ bool FFmpegVideoDecoder::FFmpegDecode( packet.data = NULL; packet.size = 0; } else { - packet.data = const_cast<uint8*>(buffer->data()); + packet.data = const_cast<uint8_t*>(buffer->data()); packet.size = buffer->data_size(); // Let FFmpeg handle presentation timestamp reordering. diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index e01d8b8..191d22b 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -55,7 +55,7 @@ class FFmpegVideoDecoderTest : public testing::Test { FFmpegGlue::InitializeFFmpeg(); // Initialize various test buffers. - frame_buffer_.reset(new uint8[kCodedSize.GetArea()]); + frame_buffer_.reset(new uint8_t[kCodedSize.GetArea()]); end_of_stream_buffer_ = DecoderBuffer::CreateEOSBuffer(); i_frame_buffer_ = ReadTestDataFile("vp8-I-frame-320x240"); corrupt_i_frame_buffer_ = ReadTestDataFile("vp8-corrupt-I-frame"); diff --git a/media/filters/file_data_source.cc b/media/filters/file_data_source.cc index 76929aa..8bf6b0d 100644 --- a/media/filters/file_data_source.cc +++ b/media/filters/file_data_source.cc @@ -31,14 +31,16 @@ bool FileDataSource::Initialize(const base::FilePath& file_path) { void FileDataSource::Stop() { } -void FileDataSource::Read(int64 position, int size, uint8* data, +void FileDataSource::Read(int64_t position, + int size, + uint8_t* data, const DataSource::ReadCB& read_cb) { if (force_read_errors_ || !file_.IsValid()) { read_cb.Run(kReadError); return; } - int64 file_size = file_.length(); + int64_t file_size = file_.length(); CHECK_GE(file_size, 0); CHECK_GE(position, 0); @@ -46,14 +48,15 @@ void FileDataSource::Read(int64 position, int size, uint8* data, // Cap position and size within bounds. position = std::min(position, file_size); - int64 clamped_size = std::min(static_cast<int64>(size), file_size - position); + int64_t clamped_size = + std::min(static_cast<int64_t>(size), file_size - position); memcpy(data, file_.data() + position, clamped_size); bytes_read_ += clamped_size; read_cb.Run(clamped_size); } -bool FileDataSource::GetSize(int64* size_out) { +bool FileDataSource::GetSize(int64_t* size_out) { *size_out = file_.length(); return true; } diff --git a/media/filters/file_data_source.h b/media/filters/file_data_source.h index 68b8b3c..9232608 100644 --- a/media/filters/file_data_source.h +++ b/media/filters/file_data_source.h @@ -26,11 +26,11 @@ class MEDIA_EXPORT FileDataSource : public DataSource { // Implementation of DataSource. void Stop() override; - void Read(int64 position, + void Read(int64_t position, int size, - uint8* data, + uint8_t* data, const DataSource::ReadCB& read_cb) override; - bool GetSize(int64* size_out) override; + bool GetSize(int64_t* size_out) override; bool IsStreaming() override; void SetBitrate(int bitrate) override; diff --git a/media/filters/file_data_source_unittest.cc b/media/filters/file_data_source_unittest.cc index 0d57ae7..6e34935 100644 --- a/media/filters/file_data_source_unittest.cc +++ b/media/filters/file_data_source_unittest.cc @@ -45,8 +45,8 @@ base::FilePath TestFileURL() { // Use the mock filter host to directly call the Read and GetPosition methods. TEST(FileDataSourceTest, ReadData) { - int64 size; - uint8 ten_bytes[10]; + int64_t size; + uint8_t ten_bytes[10]; // Create our mock filter host and initialize the data source. FileDataSource data_source; diff --git a/media/filters/frame_processor.cc b/media/filters/frame_processor.cc index 80c5dab..9a637dc 100644 --- a/media/filters/frame_processor.cc +++ b/media/filters/frame_processor.cc @@ -375,7 +375,7 @@ bool FrameProcessor::HandlePartialAppendWindowTrimming( if (audio_preroll_buffer_.get()) { // We only want to use the preroll buffer if it directly precedes (less // than one sample apart) the current buffer. - const int64 delta = + const int64_t delta = (audio_preroll_buffer_->timestamp() + audio_preroll_buffer_->duration() - buffer->timestamp()) .InMicroseconds(); diff --git a/media/filters/frame_processor.h b/media/filters/frame_processor.h index fc6de69..5c9348e 100644 --- a/media/filters/frame_processor.h +++ b/media/filters/frame_processor.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/time/time.h" #include "media/base/media_export.h" diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc index 4440de0..71f135c 100644 --- a/media/filters/frame_processor_unittest.cc +++ b/media/filters/frame_processor_unittest.cc @@ -128,7 +128,8 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { // Create buffer. Encode the original time_in_ms as the buffer's data to // enable later verification of possible buffer relocation in presentation // timeline due to coded frame processing. - const uint8* timestamp_as_data = reinterpret_cast<uint8*>(&time_in_ms); + const uint8_t* timestamp_as_data = + reinterpret_cast<uint8_t*>(&time_in_ms); scoped_refptr<StreamParserBuffer> buffer = StreamParserBuffer::CopyFrom(timestamp_as_data, sizeof(time_in_ms), is_keyframe, type, track_id); @@ -165,8 +166,8 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { std::stringstream ss; ss << "{ "; for (size_t i = 0; i < r.size(); ++i) { - int64 start = r.start(i).InMilliseconds(); - int64 end = r.end(i).InMilliseconds(); + int64_t start = r.start(i).InMilliseconds(); + int64_t end = r.end(i).InMilliseconds(); ss << "[" << start << "," << end << ") "; } ss << "}"; diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc index c413a86..bcd1cc6 100644 --- a/media/filters/gpu_video_decoder.cc +++ b/media/filters/gpu_video_decoder.cc @@ -52,11 +52,14 @@ GpuVideoDecoder::PendingDecoderBuffer::PendingDecoderBuffer( GpuVideoDecoder::PendingDecoderBuffer::~PendingDecoderBuffer() {} -GpuVideoDecoder::BufferData::BufferData( - int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns) - : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), - natural_size(ns) { -} +GpuVideoDecoder::BufferData::BufferData(int32_t bbid, + base::TimeDelta ts, + const gfx::Rect& vr, + const gfx::Size& ns) + : bitstream_buffer_id(bbid), + timestamp(ts), + visible_rect(vr), + natural_size(ns) {} GpuVideoDecoder::BufferData::~BufferData() {} @@ -338,7 +341,8 @@ void GpuVideoDecoder::RecordBufferData(const BitstreamBuffer& bitstream_buffer, input_buffer_data_.pop_back(); } -void GpuVideoDecoder::GetBufferData(int32 id, base::TimeDelta* timestamp, +void GpuVideoDecoder::GetBufferData(int32_t id, + base::TimeDelta* timestamp, gfx::Rect* visible_rect, gfx::Size* natural_size) { for (std::list<BufferData>::const_iterator it = @@ -372,14 +376,14 @@ int GpuVideoDecoder::GetMaxDecodeRequests() const { return kMaxInFlightDecodes; } -void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, +void GpuVideoDecoder::ProvidePictureBuffers(uint32_t count, const gfx::Size& size, - uint32 texture_target) { + uint32_t texture_target) { DVLOG(3) << "ProvidePictureBuffers(" << count << ", " << size.width() << "x" << size.height() << ")"; DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); - std::vector<uint32> texture_ids; + std::vector<uint32_t> texture_ids; std::vector<gpu::Mailbox> texture_mailboxes; decoder_texture_target_ = texture_target; if (!factories_->CreateTextures(count, @@ -410,7 +414,7 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, vda_->AssignPictureBuffers(picture_buffers); } -void GpuVideoDecoder::DismissPictureBuffer(int32 id) { +void GpuVideoDecoder::DismissPictureBuffer(int32_t id) { DVLOG(3) << "DismissPictureBuffer(" << id << ")"; DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); @@ -511,8 +515,8 @@ void GpuVideoDecoder::DeliverFrame( void GpuVideoDecoder::ReleaseMailbox( base::WeakPtr<GpuVideoDecoder> decoder, media::GpuVideoAcceleratorFactories* factories, - int64 picture_buffer_id, - uint32 texture_id, + int64_t picture_buffer_id, + uint32_t texture_id, const gpu::SyncToken& release_sync_token) { DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread()); factories->WaitSyncToken(release_sync_token); @@ -526,14 +530,14 @@ void GpuVideoDecoder::ReleaseMailbox( factories->DeleteTexture(texture_id); } -void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id) { +void GpuVideoDecoder::ReusePictureBuffer(int64_t picture_buffer_id) { DVLOG(3) << "ReusePictureBuffer(" << picture_buffer_id << ")"; DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); DCHECK(!picture_buffers_at_display_.empty()); PictureBufferTextureMap::iterator display_iterator = picture_buffers_at_display_.find(picture_buffer_id); - uint32 texture_id = display_iterator->second; + uint32_t texture_id = display_iterator->second; DCHECK(display_iterator != picture_buffers_at_display_.end()); picture_buffers_at_display_.erase(display_iterator); @@ -573,11 +577,11 @@ void GpuVideoDecoder::PutSHM(scoped_ptr<SHMBuffer> shm_buffer) { available_shm_segments_.push_back(shm_buffer.release()); } -void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { +void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32_t id) { DVLOG(3) << "NotifyEndOfBitstreamBuffer(" << id << ")"; DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); - std::map<int32, PendingDecoderBuffer>::iterator it = + std::map<int32_t, PendingDecoderBuffer>::iterator it = bitstream_buffers_in_decoder_.find(id); if (it == bitstream_buffers_in_decoder_.end()) { NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); @@ -610,7 +614,7 @@ GpuVideoDecoder::~GpuVideoDecoder() { } available_shm_segments_.clear(); - for (std::map<int32, PendingDecoderBuffer>::iterator it = + for (std::map<int32_t, PendingDecoderBuffer>::iterator it = bitstream_buffers_in_decoder_.begin(); it != bitstream_buffers_in_decoder_.end(); ++it) { delete it->second.shm_buffer; diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h index 81c7d6c..b079e01 100644 --- a/media/filters/gpu_video_decoder.h +++ b/media/filters/gpu_video_decoder.h @@ -59,12 +59,12 @@ class MEDIA_EXPORT GpuVideoDecoder // VideoDecodeAccelerator::Client implementation. void NotifyCdmAttached(bool success) override; - void ProvidePictureBuffers(uint32 count, + void ProvidePictureBuffers(uint32_t count, const gfx::Size& size, - uint32 texture_target) override; - void DismissPictureBuffer(int32 id) override; + uint32_t texture_target) override; + void DismissPictureBuffer(int32_t id) override; void PictureReady(const media::Picture& picture) override; - void NotifyEndOfBitstreamBuffer(int32 id) override; + void NotifyEndOfBitstreamBuffer(int32_t id) override; void NotifyFlushDone() override; void NotifyResetDone() override; void NotifyError(media::VideoDecodeAccelerator::Error error) override; @@ -101,7 +101,7 @@ class MEDIA_EXPORT GpuVideoDecoder DecodeCB done_cb; }; - typedef std::map<int32, PictureBuffer> PictureBufferMap; + typedef std::map<int32_t, PictureBuffer> PictureBufferMap; // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the // CDM has been completely attached to the pipeline. @@ -112,16 +112,18 @@ class MEDIA_EXPORT GpuVideoDecoder // Static method is to allow it to run even after GVD is deleted. static void ReleaseMailbox(base::WeakPtr<GpuVideoDecoder> decoder, media::GpuVideoAcceleratorFactories* factories, - int64 picture_buffer_id, - uint32 texture_id, + int64_t picture_buffer_id, + uint32_t texture_id, const gpu::SyncToken& release_sync_token); // Indicate the picture buffer can be reused by the decoder. - void ReusePictureBuffer(int64 picture_buffer_id); + void ReusePictureBuffer(int64_t picture_buffer_id); void RecordBufferData( const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); - void GetBufferData(int32 id, base::TimeDelta* timetamp, - gfx::Rect* visible_rect, gfx::Size* natural_size); + void GetBufferData(int32_t id, + base::TimeDelta* timetamp, + gfx::Rect* visible_rect, + gfx::Size* natural_size); void DestroyVDA(); @@ -174,23 +176,25 @@ class MEDIA_EXPORT GpuVideoDecoder // steady-state of the decoder. std::vector<SHMBuffer*> available_shm_segments_; - std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_; + std::map<int32_t, PendingDecoderBuffer> bitstream_buffers_in_decoder_; PictureBufferMap assigned_picture_buffers_; // PictureBuffers given to us by VDA via PictureReady, which we sent forward // as VideoFrames to be rendered via decode_cb_, and which will be returned // to us via ReusePictureBuffer. - typedef std::map<int32 /* picture_buffer_id */, uint32 /* texture_id */> + typedef std::map<int32_t /* picture_buffer_id */, uint32_t /* texture_id */> PictureBufferTextureMap; PictureBufferTextureMap picture_buffers_at_display_; // The texture target used for decoded pictures. - uint32 decoder_texture_target_; + uint32_t decoder_texture_target_; struct BufferData { - BufferData(int32 bbid, base::TimeDelta ts, const gfx::Rect& visible_rect, + BufferData(int32_t bbid, + base::TimeDelta ts, + const gfx::Rect& visible_rect, const gfx::Size& natural_size); ~BufferData(); - int32 bitstream_buffer_id; + int32_t bitstream_buffer_id; base::TimeDelta timestamp; gfx::Rect visible_rect; gfx::Size natural_size; @@ -199,8 +203,8 @@ class MEDIA_EXPORT GpuVideoDecoder // picture_buffer_id and the frame wrapping the corresponding Picture, for // frames that have been decoded but haven't been requested by a Decode() yet. - int32 next_picture_buffer_id_; - int32 next_bitstream_buffer_id_; + int32_t next_picture_buffer_id_; + int32_t next_bitstream_buffer_id_; // Set during ProvidePictureBuffers(), used for checking and implementing // HasAvailableOutputFrames(). diff --git a/media/filters/h264_bit_reader.cc b/media/filters/h264_bit_reader.cc index 9894d97..8f7dda0 100644 --- a/media/filters/h264_bit_reader.cc +++ b/media/filters/h264_bit_reader.cc @@ -17,7 +17,7 @@ H264BitReader::H264BitReader() H264BitReader::~H264BitReader() {} -bool H264BitReader::Initialize(const uint8* data, off_t size) { +bool H264BitReader::Initialize(const uint8_t* data, off_t size) { DCHECK(data); if (size < 1) diff --git a/media/filters/h264_bit_reader.h b/media/filters/h264_bit_reader.h index 01cfd74..f201131 100644 --- a/media/filters/h264_bit_reader.h +++ b/media/filters/h264_bit_reader.h @@ -7,9 +7,10 @@ #ifndef MEDIA_FILTERS_H264_BIT_READER_H_ #define MEDIA_FILTERS_H264_BIT_READER_H_ +#include <stdint.h> #include <sys/types.h> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" namespace media { @@ -28,7 +29,7 @@ class MEDIA_EXPORT H264BitReader { // Return false on insufficient size of stream.. // TODO(posciak,fischman): consider replacing Initialize() with // heap-allocating and creating bit readers on demand instead. - bool Initialize(const uint8* data, off_t size); + bool Initialize(const uint8_t* data, off_t size); // Read |num_bits| next bits from stream and return in |*out|, first bit // from the stream starting at |num_bits| position in |*out|. @@ -52,7 +53,7 @@ class MEDIA_EXPORT H264BitReader { bool UpdateCurrByte(); // Pointer to the next unread (not in curr_byte_) byte in the stream. - const uint8* data_; + const uint8_t* data_; // Bytes left in the stream (without the curr_byte_). off_t bytes_left_; diff --git a/media/filters/h264_bitstream_buffer.cc b/media/filters/h264_bitstream_buffer.cc index 48463a5..cb81b08 100644 --- a/media/filters/h264_bitstream_buffer.cc +++ b/media/filters/h264_bitstream_buffer.cc @@ -31,7 +31,7 @@ void H264BitstreamBuffer::Reset() { } void H264BitstreamBuffer::Grow() { - data_ = static_cast<uint8*>(realloc(data_, capacity_ + kGrowBytes)); + data_ = static_cast<uint8_t*>(realloc(data_, capacity_ + kGrowBytes)); CHECK(data_) << "Failed growing the buffer"; capacity_ += kGrowBytes; } @@ -60,16 +60,16 @@ void H264BitstreamBuffer::FlushReg() { bits_left_in_reg_ = kRegBitSize; } -void H264BitstreamBuffer::AppendU64(size_t num_bits, uint64 val) { +void H264BitstreamBuffer::AppendU64(size_t num_bits, uint64_t val) { CHECK_LE(num_bits, kRegBitSize); while (num_bits > 0) { if (bits_left_in_reg_ == 0) FlushReg(); - uint64 bits_to_write = + uint64_t bits_to_write = num_bits > bits_left_in_reg_ ? bits_left_in_reg_ : num_bits; - uint64 val_to_write = (val >> (num_bits - bits_to_write)); + uint64_t val_to_write = (val >> (num_bits - bits_to_write)); if (bits_to_write < 64) val_to_write &= ((1ull << bits_to_write) - 1); reg_ <<= bits_to_write; @@ -84,7 +84,7 @@ void H264BitstreamBuffer::AppendBool(bool val) { FlushReg(); reg_ <<= 1; - reg_ |= (static_cast<uint64>(val) & 1); + reg_ |= (static_cast<uint64_t>(val) & 1); --bits_left_in_reg_; } @@ -142,7 +142,7 @@ size_t H264BitstreamBuffer::BytesInBuffer() { return pos_; } -uint8* H264BitstreamBuffer::data() { +uint8_t* H264BitstreamBuffer::data() { DCHECK(data_); DCHECK_FINISHED(); diff --git a/media/filters/h264_bitstream_buffer.h b/media/filters/h264_bitstream_buffer.h index cbe2047..5c8f01a 100644 --- a/media/filters/h264_bitstream_buffer.h +++ b/media/filters/h264_bitstream_buffer.h @@ -33,7 +33,7 @@ class MEDIA_EXPORT H264BitstreamBuffer { // |val| is interpreted in the host endianness. template <typename T> void AppendBits(size_t num_bits, T val) { - AppendU64(num_bits, static_cast<uint64>(val)); + AppendU64(num_bits, static_cast<uint64_t>(val)); } void AppendBits(size_t num_bits, bool val) { @@ -68,7 +68,7 @@ class MEDIA_EXPORT H264BitstreamBuffer { // Return a pointer to the stream. FinishNALU() must be called before // accessing the stream, otherwise some bits may still be cached and not // in the buffer. - uint8* data(); + uint8_t* data(); private: FRIEND_TEST_ALL_PREFIXES(H264BitstreamBufferAppendBitsTest, @@ -78,13 +78,13 @@ class MEDIA_EXPORT H264BitstreamBuffer { void Grow(); // Append |num_bits| bits from U64 value |val| (in host endianness). - void AppendU64(size_t num_bits, uint64 val); + void AppendU64(size_t num_bits, uint64_t val); // Flush any cached bits in the reg with byte granularity, i.e. enough // bytes to flush all pending bits, but not more. void FlushReg(); - typedef uint64 RegType; + typedef uint64_t RegType; enum { // Sizes of reg_. kRegByteSize = sizeof(RegType), @@ -112,7 +112,7 @@ class MEDIA_EXPORT H264BitstreamBuffer { size_t pos_; // Buffer for stream data. - uint8* data_; + uint8_t* data_; }; } // namespace media diff --git a/media/filters/h264_bitstream_buffer_unittest.cc b/media/filters/h264_bitstream_buffer_unittest.cc index 53f33d3..64b18d9 100644 --- a/media/filters/h264_bitstream_buffer_unittest.cc +++ b/media/filters/h264_bitstream_buffer_unittest.cc @@ -8,29 +8,29 @@ namespace media { namespace { -const uint64 kTestPattern = 0xfedcba0987654321; +const uint64_t kTestPattern = 0xfedcba0987654321; } class H264BitstreamBufferAppendBitsTest - : public ::testing::TestWithParam<uint64> {}; + : public ::testing::TestWithParam<uint64_t> {}; // TODO(posciak): More tests! TEST_P(H264BitstreamBufferAppendBitsTest, AppendAndVerifyBits) { H264BitstreamBuffer b; - uint64 num_bits = GetParam(); + uint64_t num_bits = GetParam(); // TODO(posciak): Tests for >64 bits. ASSERT_LE(num_bits, 64u); - uint64 num_bytes = (num_bits + 7) / 8; + uint64_t num_bytes = (num_bits + 7) / 8; b.AppendBits(num_bits, kTestPattern); b.FlushReg(); EXPECT_EQ(b.BytesInBuffer(), num_bytes); - uint8* ptr = b.data(); - uint64 got = 0; - uint64 expected = kTestPattern; + uint8_t* ptr = b.data(); + uint64_t got = 0; + uint64_t expected = kTestPattern; if (num_bits < 64) expected &= ((1ull << num_bits) - 1); @@ -42,7 +42,7 @@ TEST_P(H264BitstreamBufferAppendBitsTest, AppendAndVerifyBits) { ptr++; } if (num_bits > 0) { - uint64 temp = (*ptr & 0xff); + uint64_t temp = (*ptr & 0xff); temp >>= (8 - num_bits); got |= temp; } @@ -51,6 +51,6 @@ TEST_P(H264BitstreamBufferAppendBitsTest, AppendAndVerifyBits) { INSTANTIATE_TEST_CASE_P(AppendNumBits, H264BitstreamBufferAppendBitsTest, - ::testing::Range(static_cast<uint64>(1), - static_cast<uint64>(65))); + ::testing::Range(static_cast<uint64_t>(1), + static_cast<uint64_t>(65))); } // namespace media diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc index 299f388..e10b935 100644 --- a/media/filters/h264_parser.cc +++ b/media/filters/h264_parser.cc @@ -133,13 +133,14 @@ void H264Parser::Reset() { encrypted_ranges_.clear(); } -void H264Parser::SetStream(const uint8* stream, off_t stream_size) { +void H264Parser::SetStream(const uint8_t* stream, off_t stream_size) { std::vector<SubsampleEntry> subsamples; SetEncryptedStream(stream, stream_size, subsamples); } void H264Parser::SetEncryptedStream( - const uint8* stream, off_t stream_size, + const uint8_t* stream, + off_t stream_size, const std::vector<SubsampleEntry>& subsamples) { DCHECK(stream); DCHECK_GT(stream_size, 0); @@ -148,12 +149,13 @@ void H264Parser::SetEncryptedStream( bytes_left_ = stream_size; encrypted_ranges_.clear(); - const uint8* start = stream; - const uint8* stream_end = stream_ + bytes_left_; + const uint8_t* start = stream; + const uint8_t* stream_end = stream_ + bytes_left_; for (size_t i = 0; i < subsamples.size() && start < stream_end; ++i) { start += subsamples[i].clear_bytes; - const uint8* end = std::min(start + subsamples[i].cypher_bytes, stream_end); + const uint8_t* end = + std::min(start + subsamples[i].cypher_bytes, stream_end); encrypted_ranges_.Add(start, end); start = end; } @@ -179,13 +181,15 @@ const H264SPS* H264Parser::GetSPS(int sps_id) const { return it->second; } -static inline bool IsStartCode(const uint8* data) { +static inline bool IsStartCode(const uint8_t* data) { return data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x01; } // static -bool H264Parser::FindStartCode(const uint8* data, off_t data_size, - off_t* offset, off_t* start_code_size) { +bool H264Parser::FindStartCode(const uint8_t* data, + off_t data_size, + off_t* offset, + off_t* start_code_size) { DCHECK_GE(data_size, 0); off_t bytes_left = data_size; @@ -235,7 +239,7 @@ bool H264Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) { stream_ += nalu_start_off; bytes_left_ -= nalu_start_off; - const uint8* nalu_data = stream_ + annexb_start_code_size; + const uint8_t* nalu_data = stream_ + annexb_start_code_size; off_t max_nalu_data_size = bytes_left_ - annexb_start_code_size; if (max_nalu_data_size <= 0) { DVLOG(3) << "End of stream"; @@ -262,16 +266,16 @@ bool H264Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) { } bool H264Parser::FindStartCodeInClearRanges( - const uint8* data, + const uint8_t* data, off_t data_size, - const Ranges<const uint8*>& encrypted_ranges, + const Ranges<const uint8_t*>& encrypted_ranges, off_t* offset, off_t* start_code_size) { if (encrypted_ranges.size() == 0) return FindStartCode(data, data_size, offset, start_code_size); DCHECK_GE(data_size, 0); - const uint8* start = data; + const uint8_t* start = data; do { off_t bytes_left = data_size - (start - data); @@ -280,9 +284,9 @@ bool H264Parser::FindStartCodeInClearRanges( // Construct a Ranges object that represents the region occupied // by the start code and the 1 byte needed to read the NAL unit type. - const uint8* start_code = start + *offset; - const uint8* start_code_end = start_code + *start_code_size; - Ranges<const uint8*> start_code_range; + const uint8_t* start_code = start + *offset; + const uint8_t* start_code_end = start_code + *start_code_size; + Ranges<const uint8_t*> start_code_range; start_code_range.Add(start_code, start_code_end + 1); if (encrypted_ranges.IntersectionWith(start_code_range).size() > 0) { diff --git a/media/filters/h264_parser.h b/media/filters/h264_parser.h index 389fe0d..7aec208 100644 --- a/media/filters/h264_parser.h +++ b/media/filters/h264_parser.h @@ -12,7 +12,6 @@ #include <map> #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/base/ranges.h" #include "media/filters/h264_bit_reader.h" @@ -52,7 +51,7 @@ struct MEDIA_EXPORT H264NALU { // After (without) start code; we don't own the underlying memory // and a shallow copy should be made when copying this struct. - const uint8* data; + const uint8_t* data; off_t size; // From after start code to start code of next NALU (or EOS). int nal_ref_idc; @@ -235,7 +234,7 @@ struct MEDIA_EXPORT H264SliceHeader { bool idr_pic_flag; // from NAL header int nal_ref_idc; // from NAL header - const uint8* nalu_data; // from NAL header + const uint8_t* nalu_data; // from NAL header off_t nalu_size; // from NAL header off_t header_bit_size; // calculated @@ -338,15 +337,19 @@ class MEDIA_EXPORT H264Parser { // - |*offset| is between 0 and |data_size| included. // It is strictly less than |data_size| if |data_size| > 0. // - |*start_code_size| is either 0, 3 or 4. - static bool FindStartCode(const uint8* data, off_t data_size, - off_t* offset, off_t* start_code_size); + static bool FindStartCode(const uint8_t* data, + off_t data_size, + off_t* offset, + off_t* start_code_size); // Wrapper for FindStartCode() that skips over start codes that // may appear inside of |encrypted_ranges_|. // Returns true if a start code was found. Otherwise returns false. - static bool FindStartCodeInClearRanges(const uint8* data, off_t data_size, - const Ranges<const uint8*>& ranges, - off_t* offset, off_t* start_code_size); + static bool FindStartCodeInClearRanges(const uint8_t* data, + off_t data_size, + const Ranges<const uint8_t*>& ranges, + off_t* offset, + off_t* start_code_size); H264Parser(); ~H264Parser(); @@ -355,8 +358,9 @@ class MEDIA_EXPORT H264Parser { // |stream| owned by caller. // |subsamples| contains information about what parts of |stream| are // encrypted. - void SetStream(const uint8* stream, off_t stream_size); - void SetEncryptedStream(const uint8* stream, off_t stream_size, + void SetStream(const uint8_t* stream, off_t stream_size); + void SetEncryptedStream(const uint8_t* stream, + off_t stream_size, const std::vector<SubsampleEntry>& subsamples); // Read the stream to find the next NALU, identify it and return @@ -448,7 +452,7 @@ class MEDIA_EXPORT H264Parser { Result ParseDecRefPicMarking(H264SliceHeader* shdr); // Pointer to the current NALU in the stream. - const uint8* stream_; + const uint8_t* stream_; // Bytes left in the stream after the current NALU. off_t bytes_left_; @@ -463,7 +467,7 @@ class MEDIA_EXPORT H264Parser { // Ranges of encrypted bytes in the buffer passed to // SetEncryptedStream(). - Ranges<const uint8*> encrypted_ranges_; + Ranges<const uint8_t*> encrypted_ranges_; DISALLOW_COPY_AND_ASSIGN(H264Parser); }; diff --git a/media/filters/h264_to_annex_b_bitstream_converter.cc b/media/filters/h264_to_annex_b_bitstream_converter.cc index 49456dd..5194911 100644 --- a/media/filters/h264_to_annex_b_bitstream_converter.cc +++ b/media/filters/h264_to_annex_b_bitstream_converter.cc @@ -10,8 +10,8 @@ namespace media { -static const uint8 kStartCodePrefix[3] = {0, 0, 1}; -static const uint32 kParamSetStartCodeSize = 1 + sizeof(kStartCodePrefix); +static const uint8_t kStartCodePrefix[3] = {0, 0, 1}; +static const uint32_t kParamSetStartCodeSize = 1 + sizeof(kStartCodePrefix); // Helper function which determines whether NAL unit of given type marks // access unit boundary. @@ -37,7 +37,7 @@ H264ToAnnexBBitstreamConverter::H264ToAnnexBBitstreamConverter() H264ToAnnexBBitstreamConverter::~H264ToAnnexBBitstreamConverter() {} bool H264ToAnnexBBitstreamConverter::ParseConfiguration( - const uint8* configuration_record, + const uint8_t* configuration_record, int configuration_record_size, mp4::AVCDecoderConfigurationRecord* avc_config) { DCHECK(configuration_record); @@ -54,9 +54,9 @@ bool H264ToAnnexBBitstreamConverter::ParseConfiguration( return true; } -uint32 H264ToAnnexBBitstreamConverter::GetConfigSize( +uint32_t H264ToAnnexBBitstreamConverter::GetConfigSize( const mp4::AVCDecoderConfigurationRecord& avc_config) const { - uint32 config_size = 0; + uint32_t config_size = 0; for (size_t i = 0; i < avc_config.sps_list.size(); ++i) config_size += kParamSetStartCodeSize + avc_config.sps_list[i].size(); @@ -67,12 +67,12 @@ uint32 H264ToAnnexBBitstreamConverter::GetConfigSize( return config_size; } -uint32 H264ToAnnexBBitstreamConverter::CalculateNeededOutputBufferSize( - const uint8* input, - uint32 input_size, +uint32_t H264ToAnnexBBitstreamConverter::CalculateNeededOutputBufferSize( + const uint8_t* input, + uint32_t input_size, const mp4::AVCDecoderConfigurationRecord* avc_config) const { - uint32 output_size = 0; - uint32 data_left = input_size; + uint32_t output_size = 0; + uint32_t data_left = input_size; bool first_nal_in_this_access_unit = first_nal_unit_in_access_unit_; if (input_size == 0) @@ -96,8 +96,8 @@ uint32 H264ToAnnexBBitstreamConverter::CalculateNeededOutputBufferSize( } // Read the next NAL unit length from the input buffer - uint8 size_of_len_field; - uint32 nal_unit_length; + uint8_t size_of_len_field; + uint32_t nal_unit_length; for (nal_unit_length = 0, size_of_len_field = nal_unit_length_field_width_; size_of_len_field > 0; input++, size_of_len_field--, data_left--) { @@ -131,10 +131,10 @@ uint32 H264ToAnnexBBitstreamConverter::CalculateNeededOutputBufferSize( bool H264ToAnnexBBitstreamConverter::ConvertAVCDecoderConfigToByteStream( const mp4::AVCDecoderConfigurationRecord& avc_config, - uint8* output, - uint32* output_size) { - uint8* out = output; - uint32 out_size = *output_size; + uint8_t* output, + uint32_t* output_size) { + uint8_t* out = output; + uint32_t out_size = *output_size; *output_size = 0; for (size_t i = 0; i < avc_config.sps_list.size(); ++i) { if (!WriteParamSet(avc_config.sps_list[i], &out, &out_size)) @@ -153,12 +153,14 @@ bool H264ToAnnexBBitstreamConverter::ConvertAVCDecoderConfigToByteStream( } bool H264ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream( - const uint8* input, uint32 input_size, + const uint8_t* input, + uint32_t input_size, const mp4::AVCDecoderConfigurationRecord* avc_config, - uint8* output, uint32* output_size) { - const uint8* inscan = input; // We read the input from here progressively - uint8* outscan = output; // We write the output to here progressively - uint32 data_left = input_size; + uint8_t* output, + uint32_t* output_size) { + const uint8_t* inscan = input; // We read the input from here progressively + uint8_t* outscan = output; // We write the output to here progressively + uint32_t data_left = input_size; if (input_size == 0 || *output_size == 0) { *output_size = 0; @@ -173,8 +175,8 @@ bool H264ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream( // Do the actual conversion for the actual input packet int nal_unit_count = 0; while (data_left > 0) { - uint8 i; - uint32 nal_unit_length; + uint8_t i; + uint32_t nal_unit_length; // Read the next NAL unit length from the input buffer by scanning // the input stream with the specific length field width @@ -201,11 +203,11 @@ bool H264ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream( // before all NAL units if the first one isn't an AUD. if (avc_config && (nal_unit_type != H264NALU::kAUD || nal_unit_count > 1)) { - uint32 output_bytes_used = outscan - output; + uint32_t output_bytes_used = outscan - output; DCHECK_GE(*output_size, output_bytes_used); - uint32 config_size = *output_size - output_bytes_used; + uint32_t config_size = *output_size - output_bytes_used; if (!ConvertAVCDecoderConfigToByteStream(*avc_config, outscan, &config_size)) { @@ -216,12 +218,13 @@ bool H264ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream( outscan += config_size; avc_config = NULL; } - uint32 start_code_len; + uint32_t start_code_len; first_nal_unit_in_access_unit_ ? start_code_len = sizeof(kStartCodePrefix) + 1 : start_code_len = sizeof(kStartCodePrefix); - if (static_cast<uint32>(outscan - output) + - start_code_len + nal_unit_length > *output_size) { + if (static_cast<uint32_t>(outscan - output) + start_code_len + + nal_unit_length > + *output_size) { *output_size = 0; return false; // Error: too small output buffer } @@ -252,22 +255,22 @@ bool H264ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream( // No need for trailing zero bits. } // Successful conversion, output the freshly allocated bitstream buffer. - *output_size = static_cast<uint32>(outscan - output); + *output_size = static_cast<uint32_t>(outscan - output); return true; } bool H264ToAnnexBBitstreamConverter::WriteParamSet( - const std::vector<uint8>& param_set, - uint8** out, - uint32* out_size) const { - uint32 bytes_left = *out_size; + const std::vector<uint8_t>& param_set, + uint8_t** out, + uint32_t* out_size) const { + uint32_t bytes_left = *out_size; if (bytes_left < kParamSetStartCodeSize || bytes_left - kParamSetStartCodeSize < param_set.size()) { return false; } - uint8* start = *out; - uint8* buf = start; + uint8_t* start = *out; + uint8_t* buf = start; // Write the 4 byte Annex B start code. *buf++ = 0; // zero byte diff --git a/media/filters/h264_to_annex_b_bitstream_converter.h b/media/filters/h264_to_annex_b_bitstream_converter.h index b6a27d0..ce5fe35 100644 --- a/media/filters/h264_to_annex_b_bitstream_converter.h +++ b/media/filters/h264_to_annex_b_bitstream_converter.h @@ -5,9 +5,11 @@ #ifndef MEDIA_FILTERS_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ +#include <stdint.h> + #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" namespace media { @@ -40,14 +42,13 @@ class MEDIA_EXPORT H264ToAnnexBBitstreamConverter { // Returns true if |configuration_record| was successfully parsed. False // is returned if a parsing error occurred. // |avc_config| only contains valid data when true is returned. - bool ParseConfiguration( - const uint8* configuration_record, - int configuration_record_size, - mp4::AVCDecoderConfigurationRecord* avc_config); + bool ParseConfiguration(const uint8_t* configuration_record, + int configuration_record_size, + mp4::AVCDecoderConfigurationRecord* avc_config); // Returns the buffer size needed to store the parameter sets in |avc_config| // in Annex B form. - uint32 GetConfigSize( + uint32_t GetConfigSize( const mp4::AVCDecoderConfigurationRecord& avc_config) const; // Calculates needed buffer size for the bitstream converted into bytestream. @@ -67,9 +68,9 @@ class MEDIA_EXPORT H264ToAnnexBBitstreamConverter { // Required buffer size for the output NAL unit buffer when converted // to bytestream format, or 0 if could not determine the size of // the output buffer from the data in |input| and |avc_config|. - uint32 CalculateNeededOutputBufferSize( - const uint8* input, - uint32 input_size, + uint32_t CalculateNeededOutputBufferSize( + const uint8_t* input, + uint32_t input_size, const mp4::AVCDecoderConfigurationRecord* avc_config) const; // ConvertAVCDecoderConfigToByteStream converts the @@ -94,8 +95,8 @@ class MEDIA_EXPORT H264ToAnnexBBitstreamConverter { // of converted data) bool ConvertAVCDecoderConfigToByteStream( const mp4::AVCDecoderConfigurationRecord& avc_config, - uint8* output, - uint32* output_size); + uint8_t* output, + uint32_t* output_size); // ConvertNalUnitStreamToByteStream converts the NAL unit from MP4 format // to bytestream format. Client is responsible for making sure the output @@ -121,11 +122,11 @@ class MEDIA_EXPORT H264ToAnnexBBitstreamConverter { // false if conversion not successful (output_size will hold the amount // of converted data) bool ConvertNalUnitStreamToByteStream( - const uint8* input, - uint32 input_size, + const uint8_t* input, + uint32_t input_size, const mp4::AVCDecoderConfigurationRecord* avc_config, - uint8* output, - uint32* output_size); + uint8_t* output, + uint32_t* output_size); private: // Writes Annex B start code and |param_set| to |*out|. @@ -135,16 +136,16 @@ class MEDIA_EXPORT H264ToAnnexBBitstreamConverter { // written. On a successful write, |*out| is updated to point to the first // byte after the data that was written. |*out_size| is updated to reflect // the new number of bytes left in |*out|. - bool WriteParamSet(const std::vector<uint8>& param_set, - uint8** out, - uint32* out_size) const; + bool WriteParamSet(const std::vector<uint8_t>& param_set, + uint8_t** out, + uint32_t* out_size) const; // Flag for indicating whether global parameter sets have been processed. bool configuration_processed_; // Flag for indicating whether next NAL unit starts new access unit. bool first_nal_unit_in_access_unit_; // Variable to hold interleaving field's length in bytes. - uint8 nal_unit_length_field_width_; + uint8_t nal_unit_length_field_width_; DISALLOW_COPY_AND_ASSIGN(H264ToAnnexBBitstreamConverter); }; diff --git a/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc b/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc index bbc8299..40193da 100644 --- a/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc +++ b/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc @@ -22,254 +22,271 @@ class H264ToAnnexBBitstreamConverterTest : public testing::Test { DISALLOW_COPY_AND_ASSIGN(H264ToAnnexBBitstreamConverterTest); }; -static const uint8 kHeaderDataOkWithFieldLen4[] = { - 0x01, 0x42, 0x00, 0x28, 0xFF, 0xE1, 0x00, 0x08, 0x67, 0x42, 0x00, 0x28, - 0xE9, 0x05, 0x89, 0xC8, 0x01, 0x00, 0x04, 0x68, 0xCE, 0x06, 0xF2, 0x00 -}; - -static const uint8 kPacketDataOkWithFieldLen4[] = { - 0x00, 0x00, 0x0B, 0xF7, 0x65, 0xB8, 0x40, 0x57, 0x0B, 0xF0, - 0xDF, 0xF8, 0x00, 0x1F, 0x78, 0x98, 0x54, 0xAC, 0xF2, 0x00, 0x04, 0x9D, 0x26, - 0xE0, 0x3B, 0x5C, 0x00, 0x0A, 0x00, 0x8F, 0x9E, 0x86, 0x63, 0x1B, 0x46, 0xE7, - 0xD6, 0x45, 0x88, 0x88, 0xEA, 0x10, 0x89, 0x79, 0x01, 0x34, 0x30, 0x01, 0x8E, - 0x7D, 0x1A, 0x39, 0x45, 0x4E, 0x69, 0x86, 0x12, 0xF2, 0xE7, 0xCF, 0x50, 0xF8, - 0x26, 0x54, 0x17, 0xBE, 0x3F, 0xC4, 0x80, 0x32, 0xD8, 0x02, 0x32, 0xE4, 0xAE, - 0xDD, 0x39, 0x11, 0x8E, 0x54, 0x42, 0xAE, 0xBD, 0x12, 0xA4, 0xCE, 0xE2, 0x98, - 0x91, 0x05, 0xC4, 0xA8, 0x20, 0xC7, 0xB3, 0xD9, 0x47, 0x73, 0x09, 0xD5, 0xCF, - 0x62, 0x57, 0x3F, 0xFF, 0xFD, 0xB9, 0x94, 0x2B, 0x3D, 0x12, 0x1A, 0x84, 0x0B, - 0x28, 0xAD, 0x5C, 0x9E, 0x5C, 0xC3, 0xBB, 0xBD, 0x7F, 0xFE, 0x09, 0x87, 0x74, - 0x39, 0x1C, 0xA5, 0x0E, 0x44, 0xD8, 0x5D, 0x41, 0xDB, 0xAA, 0xBC, 0x05, 0x16, - 0xA3, 0x98, 0xEE, 0xEE, 0x9C, 0xA0, 0xF1, 0x23, 0x90, 0xF0, 0x5E, 0x9F, 0xF4, - 0xFA, 0x7F, 0x4B, 0x69, 0x66, 0x49, 0x52, 0xDD, 0xD6, 0xC0, 0x0F, 0x8C, 0x6E, - 0x80, 0xDD, 0x7A, 0xDF, 0x10, 0xCD, 0x4B, 0x54, 0x6F, 0xFC, 0x7D, 0x34, 0xBA, - 0x8B, 0xD4, 0xD9, 0x30, 0x18, 0x9F, 0x39, 0x04, 0x9F, 0xCB, 0xDB, 0x1B, 0xA7, - 0x70, 0x96, 0xAF, 0xFF, 0x6F, 0xB5, 0xBF, 0x58, 0x01, 0x98, 0xCD, 0xF2, 0x66, - 0x28, 0x1A, 0xC4, 0x9E, 0x58, 0x40, 0x39, 0xAE, 0x07, 0x11, 0x3F, 0xF2, 0x9B, - 0x06, 0x9C, 0xB8, 0xC9, 0x16, 0x12, 0x09, 0x8E, 0xD2, 0xD4, 0xF5, 0xC6, 0x77, - 0x40, 0x0F, 0xFD, 0x12, 0x19, 0x55, 0x1A, 0x8E, 0x9C, 0x18, 0x8B, 0x0D, 0x18, - 0xFA, 0xBA, 0x7F, 0xBB, 0x83, 0xBB, 0x85, 0xA0, 0xCC, 0xAF, 0xF6, 0xEA, 0x81, - 0x10, 0x18, 0x8E, 0x10, 0x00, 0xCB, 0x7F, 0x27, 0x08, 0x06, 0xDE, 0x3C, 0x20, - 0xE5, 0xFE, 0xCC, 0x4F, 0xB3, 0x41, 0xE0, 0xCC, 0x4C, 0x26, 0xC1, 0xC0, 0x2C, - 0x16, 0x12, 0xAA, 0x04, 0x83, 0x51, 0x4E, 0xCA, 0x00, 0xCF, 0x42, 0x9C, 0x06, - 0x2D, 0x06, 0xDD, 0x1D, 0x08, 0x75, 0xE0, 0x89, 0xC7, 0x62, 0x68, 0x2E, 0xBF, - 0x4D, 0x2D, 0x0A, 0xC4, 0x86, 0xF6, 0x2F, 0xA1, 0x49, 0xA7, 0x0F, 0xDB, 0x1F, - 0x82, 0xEC, 0xC1, 0x62, 0xFB, 0x7F, 0xF1, 0xAE, 0xA6, 0x1A, 0xD5, 0x6B, 0x06, - 0x5E, 0xB6, 0x02, 0x50, 0xAE, 0x2D, 0xF9, 0xD9, 0x95, 0xAD, 0x01, 0x8C, 0x53, - 0x01, 0xAF, 0xCE, 0xE5, 0xA5, 0xBB, 0x95, 0x8A, 0x85, 0x70, 0x77, 0xE3, 0x9A, - 0x68, 0x1B, 0xDF, 0x47, 0xF9, 0xF4, 0xBD, 0x80, 0x7D, 0x76, 0x9A, 0x69, 0xFC, - 0xBE, 0x14, 0x0D, 0x87, 0x09, 0x12, 0x98, 0x20, 0x05, 0x46, 0xB7, 0xAE, 0x10, - 0xB7, 0x01, 0xB7, 0xDE, 0x3B, 0xDD, 0x7A, 0x8A, 0x55, 0x73, 0xAD, 0xDF, 0x69, - 0xDE, 0xD0, 0x51, 0x97, 0xA0, 0xE6, 0x5E, 0xBA, 0xBA, 0x80, 0x0F, 0x4E, 0x9A, - 0x68, 0x36, 0xE6, 0x9F, 0x5B, 0x39, 0xC0, 0x90, 0xA1, 0xC0, 0xC3, 0x82, 0xE4, - 0x50, 0xEA, 0x60, 0x7A, 0xDD, 0x5F, 0x8B, 0x5F, 0xAF, 0xFC, 0x74, 0xAF, 0xDC, - 0x56, 0xF7, 0x2E, 0x3E, 0x97, 0x6E, 0x2B, 0xF3, 0xAF, 0xFE, 0x7D, 0x32, 0xDC, - 0x56, 0xF8, 0xAF, 0xB5, 0xA3, 0xBB, 0x00, 0x5B, 0x84, 0x3D, 0x9F, 0x0B, 0x40, - 0x88, 0x61, 0x5F, 0x4F, 0x4F, 0xB0, 0xB3, 0x07, 0x81, 0x3E, 0xF2, 0xFB, 0x50, - 0xCA, 0x77, 0x40, 0x12, 0xA8, 0xE6, 0x11, 0x8E, 0xD6, 0x8A, 0xC6, 0xD6, 0x8C, - 0x1D, 0x63, 0x55, 0x3D, 0x34, 0xEA, 0xC3, 0xC6, 0x6A, 0xD2, 0x8C, 0xB0, 0x1D, - 0x5E, 0x4A, 0x7A, 0x8B, 0xD5, 0x99, 0x80, 0x84, 0x32, 0xFB, 0xB7, 0x02, 0x6E, - 0x61, 0xFE, 0xAC, 0x1B, 0x5D, 0x10, 0x23, 0x24, 0xC3, 0x8C, 0x7B, 0x58, 0x2C, - 0x4D, 0x04, 0x74, 0x84, 0x25, 0x10, 0x4E, 0x94, 0x29, 0x4D, 0x88, 0xAE, 0x65, - 0x53, 0xB9, 0x95, 0x4E, 0xE7, 0xDD, 0xEE, 0xF2, 0x70, 0x1F, 0x26, 0x4F, 0xA8, - 0xBC, 0x3D, 0x35, 0x02, 0x3B, 0xC0, 0x98, 0x70, 0x38, 0x18, 0xE5, 0x1E, 0x05, - 0xAC, 0x28, 0xAA, 0x46, 0x1A, 0xB0, 0x19, 0x99, 0x18, 0x35, 0x78, 0x1E, 0x41, - 0x60, 0x0D, 0x4F, 0x7E, 0xEC, 0x37, 0xC3, 0x30, 0x73, 0x2A, 0x69, 0xFE, 0xEF, - 0x27, 0xEE, 0x13, 0xCC, 0xD0, 0xDB, 0xE6, 0x45, 0xEC, 0x5C, 0xB5, 0x71, 0x54, - 0x2E, 0xB1, 0xE9, 0x88, 0xB4, 0x3F, 0x6F, 0xFD, 0xF7, 0xFF, 0x9D, 0x2D, 0x52, - 0x2E, 0xAE, 0xC9, 0x95, 0xDE, 0xBF, 0xDF, 0xFF, 0xBF, 0x21, 0xB3, 0x2B, 0xF5, - 0xF7, 0xF7, 0xD1, 0xA0, 0xF0, 0x76, 0x68, 0x37, 0xDB, 0x8F, 0x85, 0x4D, 0xA8, - 0x1A, 0xF9, 0x7F, 0x75, 0xA7, 0x93, 0xF5, 0x03, 0xC1, 0xF2, 0x60, 0x8A, 0x92, - 0x53, 0xF5, 0xD1, 0xC1, 0x56, 0x4B, 0x68, 0x05, 0x16, 0x88, 0x61, 0xE7, 0x14, - 0xC8, 0x0D, 0xF0, 0xDF, 0xEF, 0x46, 0x4A, 0xED, 0x0B, 0xD1, 0xD1, 0xD1, 0xA4, - 0x85, 0xA3, 0x2C, 0x1D, 0xDE, 0x45, 0x14, 0xA1, 0x8E, 0xA8, 0xD9, 0x8C, 0xAB, - 0x47, 0x31, 0xF1, 0x00, 0x15, 0xAD, 0x80, 0x20, 0xAA, 0xE4, 0x57, 0xF8, 0x05, - 0x14, 0x58, 0x0B, 0xD3, 0x63, 0x00, 0x8F, 0x44, 0x15, 0x7F, 0x19, 0xC7, 0x0A, - 0xE0, 0x49, 0x32, 0xFE, 0x36, 0x0E, 0xF3, 0x66, 0x10, 0x2B, 0x11, 0x73, 0x3D, - 0x19, 0x92, 0x22, 0x20, 0x75, 0x1F, 0xF1, 0xDB, 0x96, 0x73, 0xCF, 0x1B, 0x53, - 0xFF, 0xD2, 0x23, 0xF2, 0xB6, 0xAA, 0xB6, 0x44, 0xA3, 0x73, 0x7E, 0x00, 0x2D, - 0x4D, 0x4D, 0x87, 0xE0, 0x84, 0x55, 0xD6, 0x03, 0xB8, 0xD8, 0x90, 0xEF, 0xC0, - 0x76, 0x5D, 0x69, 0x02, 0x00, 0x0E, 0x17, 0xD0, 0x02, 0x96, 0x50, 0xEA, 0xAB, - 0xBF, 0x0D, 0xAF, 0xCB, 0xD3, 0xFF, 0xAA, 0x9D, 0x7F, 0xD6, 0xBD, 0x2C, 0x14, - 0xB4, 0xCD, 0x20, 0x73, 0xB4, 0xF4, 0x38, 0x96, 0xDE, 0xB0, 0x6B, 0xE5, 0x1B, - 0xFD, 0x0E, 0x0B, 0xA4, 0x81, 0xBF, 0xC8, 0xA0, 0x21, 0x76, 0x7B, 0x25, 0x3F, - 0xE6, 0x84, 0x40, 0x1A, 0xDA, 0x25, 0x5A, 0xFF, 0x73, 0x6B, 0x14, 0x1B, 0xF7, - 0x08, 0xFA, 0x26, 0x73, 0x7A, 0x58, 0x02, 0x1A, 0xE6, 0x63, 0xB6, 0x45, 0x7B, - 0xE3, 0xE0, 0x80, 0x14, 0x42, 0xA8, 0x7D, 0xF3, 0x80, 0x9B, 0x01, 0x43, 0x82, - 0x82, 0x8C, 0xBE, 0x0D, 0xFD, 0xAE, 0x88, 0xA8, 0xB9, 0xC3, 0xEE, 0xFF, 0x46, - 0x00, 0x84, 0xE6, 0xB4, 0x0C, 0xA9, 0x66, 0xC6, 0x74, 0x72, 0xAA, 0xA4, 0x3A, - 0xB0, 0x1B, 0x06, 0xB4, 0xDB, 0xE8, 0xC2, 0x17, 0xA2, 0xBC, 0xBE, 0x5C, 0x0F, - 0x2A, 0x76, 0xD5, 0xEE, 0x39, 0x36, 0x7C, 0x25, 0x94, 0x15, 0x3C, 0xC9, 0xB9, - 0x93, 0x07, 0x19, 0xAF, 0xE6, 0x70, 0xC3, 0xF5, 0xD4, 0x17, 0x87, 0x57, 0x77, - 0x7D, 0xCF, 0x0D, 0xDD, 0xDE, 0xB7, 0xFF, 0xB4, 0xDA, 0x20, 0x45, 0x1A, 0x45, - 0xF4, 0x58, 0x01, 0xBC, 0xEB, 0x3F, 0x16, 0x7F, 0x4C, 0x15, 0x84, 0x8C, 0xE5, - 0xF6, 0x96, 0xA6, 0xA1, 0xB9, 0xB2, 0x7F, 0x6B, 0xFF, 0x31, 0xF2, 0xF5, 0xC9, - 0xFF, 0x61, 0xEE, 0xB5, 0x84, 0xAE, 0x68, 0x41, 0xEA, 0xD0, 0xF0, 0xA5, 0xCE, - 0x0C, 0xE6, 0x4C, 0x6D, 0x6D, 0x94, 0x08, 0xC9, 0xA9, 0x4A, 0x60, 0x6D, 0x01, - 0x3B, 0xEF, 0x4D, 0x99, 0x8D, 0x42, 0x2A, 0x6B, 0x8A, 0xC7, 0xFA, 0xA9, 0x90, - 0x40, 0x00, 0x90, 0xF3, 0xA0, 0x75, 0x8E, 0xD5, 0xFE, 0xE7, 0xBD, 0x02, 0x87, - 0x0C, 0x7D, 0xF0, 0xAF, 0x1E, 0x5F, 0x8D, 0xC8, 0xE1, 0xD4, 0x56, 0x08, 0xBF, - 0x76, 0x80, 0xD4, 0x18, 0x89, 0x2D, 0x57, 0xDF, 0x66, 0xD0, 0x46, 0x68, 0x77, - 0x55, 0x47, 0xF5, 0x7C, 0xF7, 0xA6, 0x66, 0xD6, 0x5A, 0x64, 0x55, 0xD4, 0x80, - 0xC4, 0x55, 0xE9, 0x36, 0x3F, 0x5E, 0xE2, 0x5C, 0x7F, 0x5F, 0xCE, 0x7F, 0xE1, - 0x0C, 0x82, 0x3D, 0x6B, 0x6E, 0xA2, 0xEA, 0x3B, 0x1F, 0xE8, 0x9E, 0xC7, 0x4E, - 0x24, 0x3D, 0xDD, 0xFA, 0xEB, 0x71, 0xDF, 0xFE, 0x15, 0xFE, 0x41, 0x9B, 0xB4, - 0x4E, 0xAB, 0x51, 0xE5, 0x1F, 0x7D, 0x2D, 0xAC, 0xD0, 0x66, 0xD9, 0xA1, 0x59, - 0x78, 0xC6, 0xEF, 0xC4, 0x43, 0x08, 0x65, 0x18, 0x73, 0xDE, 0x2A, 0xAD, 0x72, - 0xE7, 0x5A, 0x7E, 0x33, 0x04, 0x72, 0x38, 0x57, 0x47, 0x73, 0x10, 0x1D, 0x88, - 0x57, 0x4C, 0xDF, 0xA7, 0x78, 0x16, 0xFB, 0x01, 0x21, 0x28, 0x2D, 0xB6, 0x7E, - 0x05, 0x18, 0x32, 0x52, 0xC3, 0x49, 0x0B, 0x32, 0x18, 0x12, 0x93, 0x54, 0x15, - 0x3B, 0xC8, 0x6D, 0x4A, 0x77, 0xEF, 0x0A, 0x46, 0x83, 0x89, 0x5C, 0x8B, 0xCB, - 0x18, 0xA6, 0xDC, 0x97, 0x6F, 0xEE, 0xEE, 0x00, 0x6A, 0xF1, 0x10, 0xFE, 0x07, - 0x0C, 0xE0, 0x53, 0xD2, 0xB8, 0x45, 0xF4, 0x6E, 0x16, 0x4B, 0xC9, 0x9C, 0xC7, - 0x93, 0x83, 0x23, 0x1D, 0x4D, 0x00, 0xB9, 0x4F, 0x86, 0x51, 0xF0, 0x29, 0x69, - 0x41, 0x21, 0xC5, 0x4A, 0xC6, 0x6D, 0xD1, 0x81, 0x38, 0xDB, 0x7C, 0x06, 0xA8, - 0x26, 0x8E, 0x71, 0x00, 0x4C, 0x44, 0x14, 0x05, 0xF2, 0x1C, 0x00, 0x49, 0xFC, - 0x29, 0x6A, 0xF9, 0x9E, 0xD1, 0x35, 0x4B, 0xB7, 0xE5, 0xDB, 0xFC, 0x01, 0x04, - 0x3F, 0x70, 0x33, 0x56, 0x87, 0x69, 0x01, 0xB4, 0xCE, 0x1C, 0x4D, 0x2E, 0x83, - 0x51, 0x51, 0xD0, 0x37, 0x3B, 0xB4, 0xBA, 0x47, 0xF5, 0xFF, 0xBF, 0xFA, 0xD5, - 0x03, 0x65, 0xD3, 0x28, 0x9F, 0x38, 0x57, 0xFE, 0x71, 0xD8, 0x9C, 0x16, 0xEE, - 0x72, 0x19, 0x03, 0x17, 0x6E, 0xC0, 0xEC, 0x49, 0x3D, 0x96, 0xE2, 0x30, 0x97, - 0x97, 0x84, 0x38, 0x6B, 0xE8, 0x2E, 0xAB, 0x0E, 0x2E, 0x03, 0x52, 0xBA, 0x68, - 0x55, 0xBA, 0x1D, 0x2C, 0x47, 0xAA, 0x72, 0xAE, 0x02, 0x31, 0x6E, 0xA1, 0xDC, - 0xAD, 0x0F, 0x4A, 0x46, 0xC9, 0xF2, 0xA9, 0xAB, 0xFD, 0x87, 0x89, 0x5C, 0xB3, - 0x75, 0x7E, 0xE3, 0xDE, 0x9F, 0xC4, 0x02, 0x1E, 0xA2, 0xF8, 0x8B, 0xD3, 0x00, - 0x83, 0x96, 0xC4, 0xD0, 0xB9, 0x62, 0xB9, 0x69, 0xEC, 0x56, 0xDF, 0x7D, 0x91, - 0x4B, 0x68, 0x27, 0xA8, 0x61, 0x78, 0xA7, 0x95, 0x66, 0x51, 0x41, 0xF6, 0xCE, - 0x78, 0xD3, 0x9A, 0x91, 0xA0, 0x31, 0x09, 0x47, 0xB8, 0x47, 0xB8, 0x44, 0xE1, - 0x13, 0x86, 0x7E, 0x92, 0x80, 0xC6, 0x1A, 0xF7, 0x79, 0x7E, 0xF1, 0x5D, 0x9F, - 0x17, 0x2D, 0x80, 0x00, 0x79, 0x34, 0x7D, 0xE3, 0xAD, 0x60, 0x00, 0x20, 0x07, - 0x80, 0x00, 0x40, 0x01, 0xF8, 0xA1, 0x86, 0xB1, 0xEE, 0x21, 0x63, 0x85, 0x60, - 0x51, 0x84, 0x90, 0x7E, 0x92, 0x09, 0x39, 0x1C, 0x16, 0x87, 0x5C, 0xA6, 0x09, - 0x90, 0x06, 0x34, 0x6E, 0xB8, 0x8D, 0x5D, 0xAC, 0x77, 0x97, 0xB5, 0x4D, 0x30, - 0xFD, 0x39, 0xD0, 0x50, 0x00, 0xC9, 0x98, 0x04, 0x86, 0x00, 0x0D, 0xD8, 0x3E, - 0x34, 0xC2, 0xA6, 0x25, 0xF8, 0x20, 0xCC, 0x6D, 0x9E, 0x63, 0x05, 0x30, 0xC4, - 0xC6, 0xCC, 0x54, 0x31, 0x9F, 0x3C, 0xF5, 0x86, 0xB9, 0x08, 0x18, 0xC3, 0x1E, - 0xB9, 0xA0, 0x0C, 0x45, 0x2C, 0x54, 0x32, 0x8B, 0x85, 0x86, 0x59, 0xC3, 0xB3, - 0x50, 0x5A, 0xFE, 0xBA, 0xF7, 0x4D, 0xC9, 0x9C, 0x9E, 0x01, 0xDF, 0xD7, 0x6E, - 0xB5, 0x15, 0x53, 0x08, 0x57, 0xA4, 0x71, 0x36, 0x80, 0x46, 0x05, 0x21, 0x48, - 0x7B, 0x91, 0xC8, 0xAA, 0xFF, 0x07, 0x9F, 0x78, 0x68, 0xCF, 0x3C, 0xEF, 0xFF, - 0xBC, 0xB6, 0xA2, 0x36, 0xB7, 0x9F, 0x54, 0xF6, 0x6F, 0x5D, 0xDD, 0x75, 0xD4, - 0x3C, 0x75, 0xE8, 0xCF, 0x15, 0x02, 0x5B, 0x94, 0xC3, 0xA2, 0x41, 0x63, 0xA1, - 0x14, 0xF6, 0xC0, 0x57, 0x15, 0x9F, 0x0C, 0x3F, 0x80, 0xF2, 0x98, 0xEE, 0x41, - 0x85, 0xEE, 0xBC, 0xAA, 0xE9, 0x59, 0xAA, 0xA0, 0x92, 0xCA, 0x00, 0xF3, 0x50, - 0xCC, 0xFF, 0xAD, 0x97, 0x69, 0xA7, 0xF2, 0x0B, 0x8F, 0xD7, 0xD7, 0x82, 0x3A, - 0xBB, 0x98, 0x1D, 0xCB, 0x89, 0x0B, 0x9B, 0x05, 0xF7, 0xD0, 0x1A, 0x60, 0xF3, - 0x29, 0x16, 0x12, 0xF8, 0xF4, 0xF1, 0x4A, 0x05, 0x9B, 0x57, 0x12, 0x7E, 0x3A, - 0x4A, 0x8D, 0xA6, 0xDF, 0xB6, 0xDD, 0xDF, 0xC3, 0xF0, 0xD2, 0xD4, 0xD7, 0x41, - 0xA6, 0x00, 0x76, 0x8C, 0x75, 0x08, 0xF0, 0x19, 0xD8, 0x14, 0x63, 0x55, 0x52, - 0x18, 0x30, 0x98, 0xD0, 0x3F, 0x65, 0x52, 0xB3, 0x88, 0x6D, 0x17, 0x39, 0x93, - 0xCA, 0x3B, 0xB4, 0x1D, 0x8D, 0xDF, 0xDF, 0xAD, 0x72, 0xDA, 0x74, 0xAF, 0xBD, - 0x31, 0xF9, 0x12, 0x61, 0x45, 0x29, 0x4C, 0x2B, 0x61, 0xA1, 0x12, 0x90, 0x53, - 0xE7, 0x5A, 0x9D, 0x44, 0xC8, 0x3A, 0x83, 0xDC, 0x34, 0x4C, 0x07, 0xAF, 0xDB, - 0x90, 0xCD, 0x03, 0xA4, 0x64, 0x78, 0xBD, 0x55, 0xB2, 0x56, 0x59, 0x32, 0xAB, - 0x13, 0x2C, 0xC9, 0x77, 0xF8, 0x3B, 0xDF, 0xFF, 0xAC, 0x07, 0xB9, 0x08, 0x7B, - 0xE9, 0x82, 0xB9, 0x59, 0xC7, 0xFF, 0x86, 0x2C, 0x12, 0x7C, 0xC6, 0x65, 0x3C, - 0x71, 0xB8, 0x98, 0x9F, 0xA2, 0x45, 0x03, 0xA5, 0xD9, 0xC3, 0xCF, 0xFA, 0xEB, - 0x89, 0xAD, 0x03, 0xEE, 0xDD, 0x76, 0xD3, 0x4F, 0x10, 0x6F, 0xF0, 0xC1, 0x60, - 0x0C, 0x00, 0xD4, 0x76, 0x12, 0x0A, 0x8D, 0xDC, 0xFD, 0x5E, 0x0B, 0x26, 0x2F, - 0x01, 0x1D, 0xB9, 0xE7, 0x73, 0xD4, 0xF2, 0xCB, 0xD8, 0x78, 0x21, 0x52, 0x4B, - 0x83, 0x3C, 0x44, 0x72, 0x0E, 0xB1, 0x4E, 0x37, 0xBC, 0xC7, 0x50, 0xFA, 0x07, - 0x80, 0x71, 0x10, 0x0B, 0x24, 0xD1, 0x7E, 0xDA, 0x7F, 0xA7, 0x2F, 0x40, 0xAA, - 0xD3, 0xF5, 0x44, 0x10, 0x56, 0x4E, 0x3B, 0xF1, 0x6E, 0x9A, 0xA0, 0xEA, 0x85, - 0x66, 0x16, 0xFB, 0x5C, 0x0B, 0x2B, 0x74, 0x18, 0xAF, 0x3D, 0x04, 0x3E, 0xCE, - 0x88, 0x9B, 0x3E, 0xF4, 0xB9, 0x00, 0x60, 0x0E, 0xE1, 0xE2, 0xCB, 0x12, 0xB9, - 0x6D, 0x5A, 0xC7, 0x55, 0x1D, 0xB9, 0x79, 0xAC, 0x43, 0x43, 0xE6, 0x3B, 0xDD, - 0x7E, 0x9F, 0x78, 0xD3, 0xEA, 0xA3, 0x11, 0xFF, 0xDB, 0xBB, 0xB8, 0x97, 0x37, - 0x15, 0xDB, 0xF1, 0x97, 0x96, 0xC7, 0xFC, 0xE5, 0xBF, 0xF2, 0x86, 0xC0, 0xFA, - 0x9B, 0x4C, 0x00, 0x04, 0x03, 0xA5, 0xB6, 0xB7, 0x9C, 0xD9, 0xAB, 0x09, 0x77, - 0x51, 0x18, 0x3B, 0xAD, 0x61, 0x6C, 0xFC, 0x51, 0x96, 0xFB, 0x19, 0xC8, 0x52, - 0x35, 0x07, 0x00, 0x63, 0x87, 0x14, 0x04, 0xFA, 0x7A, 0x48, 0x3E, 0x00, 0x47, - 0x29, 0x07, 0x74, 0x97, 0x74, 0x84, 0xEB, 0xB2, 0x16, 0xB2, 0x31, 0x81, 0xCE, - 0x2A, 0x31, 0xA7, 0xB1, 0xEB, 0x83, 0x34, 0x7A, 0x73, 0xD7, 0x2F, 0xFF, 0xBC, - 0xFF, 0xE5, 0xAA, 0xF2, 0xB5, 0x6E, 0x9E, 0xA5, 0x70, 0x8A, 0x8C, 0xDF, 0x6A, - 0x06, 0x16, 0xC1, 0xAB, 0x59, 0x70, 0xD9, 0x3D, 0x47, 0x7C, 0xDD, 0xEF, 0xDF, - 0x2F, 0xFF, 0x42, 0x6B, 0xBA, 0x4B, 0xBF, 0xF8, 0x7F, 0xF2, 0x03, 0x0D, 0x79, - 0xBC, 0x03, 0x76, 0x64, 0x1C, 0x0D, 0x7B, 0xD7, 0xBD, 0xB0, 0x6C, 0xD8, 0x61, - 0x17, 0x17, 0x8C, 0xED, 0x4E, 0x20, 0xEB, 0x55, 0x33, 0x39, 0xE9, 0x7E, 0xBE, - 0x8E, 0x05, 0x4B, 0x78, 0x96, 0x85, 0xCC, 0x68, 0xC9, 0x78, 0xAF, 0xAE, 0x44, - 0x36, 0x61, 0xD3, 0x53, 0xEB, 0xB3, 0x3E, 0x4F, 0x97, 0xE2, 0x8D, 0xAE, 0x90, - 0xED, 0xB5, 0x4F, 0x8E, 0xE4, 0x7A, 0x44, 0xCF, 0x9D, 0xC5, 0x77, 0x4D, 0xAB, - 0x4F, 0xE5, 0xC5, 0x73, 0xA0, 0xC8, 0xA5, 0xBB, 0x4B, 0x7D, 0xD5, 0xFB, 0xFB, - 0xFF, 0x61, 0xFD, 0xAA, 0x1A, 0x62, 0x7E, 0x3C, 0x66, 0x34, 0x15, 0x64, 0x25, - 0xEC, 0x7C, 0x9D, 0x6A, 0x64, 0x4D, 0x80, 0xD5, 0x4F, 0xFE, 0x8E, 0xEE, 0x18, - 0x53, 0xC1, 0x09, 0x51, 0xF7, 0xC0, 0xA6, 0xB2, 0x9B, 0x19, 0x2B, 0x14, 0x66, - 0x66, 0x4B, 0x39, 0x62, 0x1D, 0x84, 0xB9, 0x02, 0x84, 0xAC, 0xC1, 0xDA, 0x6C, - 0x80, 0xCD, 0x40, 0x20, 0x20, 0x19, 0x51, 0xDC, 0x2B, 0x7D, 0x5D, 0x7F, 0xE3, - 0x86, 0x8E, 0xC3, 0x35, 0xFE, 0x5C, 0xF6, 0x1C, 0xFF, 0x05, 0x9E, 0xB5, 0xB6, - 0xBB, 0xBE, 0xF7, 0x2F, 0xB7, 0xE1, 0xF5, 0x33, 0x86, 0xA0, 0x47, 0xDE, 0xF7, - 0xE9, 0x3B, 0xBE, 0x7E, 0x9B, 0x17, 0xFC, 0xFD, 0x2E, 0x40, 0x86, 0x41, 0x75, - 0xF1, 0xB2, 0x18, 0xA9, 0xDE, 0x2D, 0xD6, 0x04, 0x20, 0xA4, 0xBA, 0x81, 0xBC, - 0x1D, 0x5A, 0xD6, 0xF7, 0xF6, 0xB8, 0x42, 0xF7, 0xF5, 0x3D, 0x97, 0xAC, 0xCD, - 0x6F, 0xAD, 0xDB, 0x4F, 0x5A, 0x2E, 0x64, 0xB9, 0x5D, 0xDD, 0x8B, 0x4A, 0x35, - 0x44, 0xFE, 0x3D, 0xC6, 0x77, 0x7A, 0xBF, 0xDA, 0xAC, 0x9E, 0xB0, 0xA2, 0xB9, - 0x6C, 0xAF, 0x02, 0xDD, 0xF2, 0x71, 0x2B, 0xEF, 0xD3, 0x51, 0x0E, 0x07, 0x11, - 0xBD, 0xED, 0x39, 0x7F, 0xD9, 0xB8, 0xBD, 0xEE, 0x35, 0xE9, 0x5C, 0x67, 0x42, - 0xDA, 0x05, 0x6E, 0x39, 0xCE, 0x55, 0xFB, 0x26, 0xB7, 0x90, 0x4B, 0xDA, 0x91, - 0x48, 0xFD, 0xDE, 0xB2, 0xEC, 0x88, 0x9A, 0x46, 0x1A, 0x4C, 0xD4, 0x05, 0x12, - 0x85, 0x57, 0x37, 0x22, 0xD3, 0x0E, 0x4F, 0x79, 0xE3, 0x81, 0xA9, 0x2B, 0x5F, - 0xD7, 0x6D, 0xBD, 0x21, 0x98, 0x6F, 0x7D, 0xF5, 0x32, 0x7A, 0x6E, 0xF8, 0x20, - 0x01, 0x50, 0x90, 0x7A, 0x88, 0x3E, 0x0D, 0x57, 0xB1, 0x58, 0x65, 0xE6, 0x82, - 0xCE, 0x08, 0x69, 0x8B, 0x87, 0x62, 0x36, 0xB1, 0x7B, 0xDE, 0x74, 0xBD, 0xFE, - 0x10, 0xBE, 0x26, 0xAB, 0x7E, 0xB7, 0x8D, 0xF7, 0x83, 0x2E, 0x0F, 0xAF, 0x7E, - 0xBC, 0x17, 0x31, 0xFF, 0xB0, 0x4F, 0x7F, 0x4B, 0x13, 0x83, 0xDF, 0xEE, 0x23, - 0xD3, 0xE7, 0xC8, 0xAF, 0x75, 0xAB, 0xEA, 0xBD, 0x7D, 0xD2, 0x9D, 0xE9, 0xC1, - 0x18, 0x8B, 0x7C, 0x9F, 0x51, 0xDC, 0x37, 0xA3, 0xDB, 0xFC, 0xD4, 0x6A, 0x91, - 0x44, 0x7F, 0x72, 0xC5, 0xD9, 0xC8, 0x37, 0x38, 0x63, 0x0D, 0x59, 0x8B, 0x7F, - 0x7D, 0x96, 0xC1, 0x5F, 0x4C, 0x7C, 0x88, 0xCB, 0x65, 0x07, 0x2B, 0x0E, 0x1D, - 0x24, 0xAA, 0x20, 0x2E, 0x6C, 0x33, 0xAB, 0xEF, 0x23, 0xE5, 0xE3, 0x6C, 0xA3, - 0xA5, 0x2D, 0x01, 0xDF, 0x26, 0x92, 0x52, 0xF5, 0xE6, 0x3E, 0xE3, 0xDD, 0xC6, - 0xED, 0x42, 0x0F, 0x71, 0x7B, 0xD1, 0xF4, 0x06, 0xF6, 0x82, 0xD5, 0x13, 0xB3, - 0x60, 0x31, 0x09, 0x89, 0x63, 0x15, 0xD2, 0xCB, 0xAA, 0x77, 0xFD, 0xF4, 0xEB, - 0xF4, 0xED, 0x2E, 0xE2, 0xBA, 0x27, 0x2E, 0x74, 0xD2, 0x91, 0x7F, 0x0F, 0xDE, - 0x25, 0xFE, 0x78, 0x20, 0x05, 0x0A, 0x6A, 0xFE, 0x89, 0x14, 0x23, 0xF3, 0xF5, - 0x3A, 0x1E, 0xF3, 0x22, 0xCE, 0x12, 0x82, 0x24, 0x11, 0x05, 0x04, 0x71, 0x99, - 0xE5, 0xF0, 0xA6, 0xDB, 0x7B, 0xF5, 0x8F, 0xF9, 0x3C, 0x02, 0x0C, 0x46, 0xFD, - 0xB6, 0xEA, 0x06, 0x11, 0xF4, 0x1E, 0x7A, 0x20, 0x6A, 0x54, 0xBB, 0x4A, 0x60, - 0xB0, 0x30, 0x28, 0x9A, 0xF3, 0x3B, 0xE9, 0xBD, 0xD6, 0x04, 0xCA, 0x3A, 0x33, - 0x37, 0x5F, 0xB7, 0xAD, 0xE7, 0x9C, 0xE2, 0x95, 0x21, 0xF7, 0xB5, 0xC4, 0xF0, - 0xD1, 0x51, 0x09, 0x44, 0x3F, 0x07, 0xFC, 0x5F, 0x37, 0xFD, 0x7D, 0x7E, 0xD5, - 0xF7, 0xEB, 0x69, 0xB9, 0x54, 0x98, 0x5A, 0x2A, 0x56, 0xE3, 0xC0, 0x21, 0x57, - 0xD1, 0xEB, 0x75, 0x15, 0xED, 0xAC, 0xAF, 0x5D, 0xFF, 0xC2, 0xFE, 0x4E, 0xFB, - 0xBA, 0x13, 0xB8, 0x87, 0xFA, 0x4E, 0x5E, 0x5C, 0x24, 0x15, 0x5B, 0x2B, 0x2C, - 0x32, 0x68, 0x1F, 0x30, 0x5F, 0xC1, 0xF7, 0xE7, 0xE1, 0x9C, 0x00, 0xC1, 0x9C, - 0xB1, 0xAB, 0xFA, 0xFF, 0xC1, 0x1E, 0x72, 0xA1, 0x46, 0x9E, 0x2E, 0xCD, 0x76, - 0x96, 0x4F, 0x14, 0xDC, 0x68, 0xC1, 0x10, 0x9F, 0xDF, 0xEB, 0x5A, 0xBA, 0x8D, - 0x91, 0x4E, 0x76, 0xE9, 0x3A, 0x43, 0x2D, 0x88, 0xD2, 0x81, 0x0C, 0xEC, 0x6F, - 0xB7, 0xA4, 0x8B, 0x97, 0x4F, 0xC4, 0x1E, 0xF3, 0x0F, 0xF5, 0x66, 0x66, 0xBF, - 0x6C, 0x3F, 0xFB, 0x6E, 0x2B, 0x48, 0x6C, 0x7B, 0xD1, 0x2E, 0x64, 0xD1, 0x0B, - 0x6E, 0x5B, 0x05, 0x16, 0xDD, 0xCB, 0x1B, 0xDE, 0xA2, 0xB9, 0xA8, 0x94, 0xD6, - 0x5A, 0x5B, 0xE2, 0xC9, 0xBC, 0xD5, 0xAB, 0x64, 0x5B, 0x0F, 0x9A, 0xFD, 0xC7, - 0x2E, 0xB7, 0xEF, 0xAE, 0xE9, 0x1F, 0x32, 0xD2, 0xCA, 0xA0, 0x37, 0x63, 0x86, - 0x72, 0x41, 0x07, 0xBC, 0xAB, 0x6F, 0xFF, 0xB7, 0x16, 0xAA, 0xA9, 0x58, 0x9E, - 0x43, 0x9C, 0x22, 0x8D, 0x48, 0xCE, 0xE5, 0xEF, 0xE0, 0x7D, 0x47, 0x87, 0x5A, - 0xA8, 0x5B, 0x06, 0xA9, 0x47, 0xF0, 0x26, 0xB4, 0x99, 0xD8, 0xA3, 0x64, 0xED, - 0x73, 0xB3, 0x96, 0xB4, 0x21, 0x19, 0xA5, 0xC1, 0xDC, 0x88, 0x2E, 0xEE, 0xF2, - 0x77, 0x91, 0xEC, 0xFB, 0xD5, 0xF9, 0xF8, 0x90, 0x47, 0xAD, 0xF5, 0xEB, 0x96, - 0x6D, 0xF1, 0x1C, 0xE0, 0xDC, 0x74, 0x1C, 0xE6, 0x2E, 0xE1, 0x76, 0x9D, 0xEE, - 0xF4, 0xEF, 0xA5, 0x31, 0x03, 0x87, 0x0E, 0x2C, 0x84, 0xA5, 0xF1, 0x22, 0xBE, - 0x48, 0xA9, 0xCD, 0x09, 0x07, 0xC1, 0xF0, 0xD4, 0xE7, 0x03, 0x82, 0x39, 0xE2, - 0xA0, 0x0B, 0xDE, 0xAC, 0x37, 0xAC, 0x62, 0x97, 0x8E, 0x79, 0xCE, 0x52, 0x24, - 0x78, 0xF9, 0x17, 0xD2, 0xF1, 0x5D, 0x2D, 0xA1, 0xDF, 0x12, 0x2C, 0x83, 0xE5, - 0x1A, 0x28, 0x9A, 0x2D, 0xED, 0x8A, 0xBF, 0xFC, 0x41, 0xC3, 0xEB, 0x0E, 0x91, - 0xDB, 0xF2, 0xA1, 0xC8, 0xA8, 0x01, 0x8B, 0xF2, 0xF3, 0x59, 0xB7, 0xA7, 0x6F, - 0x80, 0xFF, 0x0B, 0x46, 0xE1, 0x63, 0xA7, 0x5F, 0x6B, 0xBE, 0x33, 0x71, 0xBE, - 0x3A, 0xAF, 0xA9, 0x53, 0x5D, 0x3B, 0xB2, 0xF6, 0xEB, 0x42, 0x1C, 0x3E, 0x3F, - 0x1D, 0x6A, 0x34, 0xAE, 0xB1, 0x05, 0xA1, 0x32, 0x6C, 0xB5, 0xE4, 0xD3, 0xBB, - 0xE8, 0x10, 0x14, 0x9E, 0x68, 0x6A, 0x24, 0x51, 0xA5, 0x66, 0x64, 0xCC, 0xC4, - 0x2D, 0x96, 0xA2, 0xC7, 0x2D, 0x1F, 0x0A, 0x0F, 0x6B, 0xD9, 0xAD, 0xA3, 0x11, - 0x8F, 0x00, 0xAA, 0x06, 0xC2, 0x1E, 0xF3, 0xE8, 0x5A, 0x37, 0x4C, 0xD6, 0x4B, - 0x6B, 0x01, 0xC9, 0xB0, 0xB6, 0xB9, 0x92, 0xED, 0x1D, 0x08, 0xB0, 0x80, 0x06, - 0x20, 0xEA, 0xEE, 0xF9, 0x1D, 0xA4, 0x57, 0x73, 0x2E, 0x1B, 0xA5, 0xAF, 0xF6, - 0xAF, 0xAE, 0x04, 0x7C, 0x4C, 0x7E, 0xC8, 0xDB, 0xC0, 0xFB, 0x37, 0xC8, 0x7E, - 0xFE, 0x47, 0x0A, 0x3C, 0xFA, 0x61, 0xE7, 0xEB, 0x1B, 0xF3, 0x7C, 0x32, 0xE3, - 0x7C, 0x37, 0x66, 0x7C, 0x53, 0x07, 0xC2, 0x37, 0xA3, 0xBD, 0xF7, 0xFA, 0xE3, - 0x8A, 0x76, 0xCB, 0x6C, 0xC8, 0x13, 0xC4, 0x53, 0x53, 0xDB, 0xAD, 0x37, 0x1A, - 0xEB, 0xE0 -}; +static const uint8_t kHeaderDataOkWithFieldLen4[] = { + 0x01, 0x42, 0x00, 0x28, 0xFF, 0xE1, 0x00, 0x08, 0x67, 0x42, 0x00, 0x28, + 0xE9, 0x05, 0x89, 0xC8, 0x01, 0x00, 0x04, 0x68, 0xCE, 0x06, 0xF2, 0x00}; + +static const uint8_t kPacketDataOkWithFieldLen4[] = { + 0x00, 0x00, 0x0B, 0xF7, 0x65, 0xB8, 0x40, 0x57, 0x0B, 0xF0, 0xDF, 0xF8, + 0x00, 0x1F, 0x78, 0x98, 0x54, 0xAC, 0xF2, 0x00, 0x04, 0x9D, 0x26, 0xE0, + 0x3B, 0x5C, 0x00, 0x0A, 0x00, 0x8F, 0x9E, 0x86, 0x63, 0x1B, 0x46, 0xE7, + 0xD6, 0x45, 0x88, 0x88, 0xEA, 0x10, 0x89, 0x79, 0x01, 0x34, 0x30, 0x01, + 0x8E, 0x7D, 0x1A, 0x39, 0x45, 0x4E, 0x69, 0x86, 0x12, 0xF2, 0xE7, 0xCF, + 0x50, 0xF8, 0x26, 0x54, 0x17, 0xBE, 0x3F, 0xC4, 0x80, 0x32, 0xD8, 0x02, + 0x32, 0xE4, 0xAE, 0xDD, 0x39, 0x11, 0x8E, 0x54, 0x42, 0xAE, 0xBD, 0x12, + 0xA4, 0xCE, 0xE2, 0x98, 0x91, 0x05, 0xC4, 0xA8, 0x20, 0xC7, 0xB3, 0xD9, + 0x47, 0x73, 0x09, 0xD5, 0xCF, 0x62, 0x57, 0x3F, 0xFF, 0xFD, 0xB9, 0x94, + 0x2B, 0x3D, 0x12, 0x1A, 0x84, 0x0B, 0x28, 0xAD, 0x5C, 0x9E, 0x5C, 0xC3, + 0xBB, 0xBD, 0x7F, 0xFE, 0x09, 0x87, 0x74, 0x39, 0x1C, 0xA5, 0x0E, 0x44, + 0xD8, 0x5D, 0x41, 0xDB, 0xAA, 0xBC, 0x05, 0x16, 0xA3, 0x98, 0xEE, 0xEE, + 0x9C, 0xA0, 0xF1, 0x23, 0x90, 0xF0, 0x5E, 0x9F, 0xF4, 0xFA, 0x7F, 0x4B, + 0x69, 0x66, 0x49, 0x52, 0xDD, 0xD6, 0xC0, 0x0F, 0x8C, 0x6E, 0x80, 0xDD, + 0x7A, 0xDF, 0x10, 0xCD, 0x4B, 0x54, 0x6F, 0xFC, 0x7D, 0x34, 0xBA, 0x8B, + 0xD4, 0xD9, 0x30, 0x18, 0x9F, 0x39, 0x04, 0x9F, 0xCB, 0xDB, 0x1B, 0xA7, + 0x70, 0x96, 0xAF, 0xFF, 0x6F, 0xB5, 0xBF, 0x58, 0x01, 0x98, 0xCD, 0xF2, + 0x66, 0x28, 0x1A, 0xC4, 0x9E, 0x58, 0x40, 0x39, 0xAE, 0x07, 0x11, 0x3F, + 0xF2, 0x9B, 0x06, 0x9C, 0xB8, 0xC9, 0x16, 0x12, 0x09, 0x8E, 0xD2, 0xD4, + 0xF5, 0xC6, 0x77, 0x40, 0x0F, 0xFD, 0x12, 0x19, 0x55, 0x1A, 0x8E, 0x9C, + 0x18, 0x8B, 0x0D, 0x18, 0xFA, 0xBA, 0x7F, 0xBB, 0x83, 0xBB, 0x85, 0xA0, + 0xCC, 0xAF, 0xF6, 0xEA, 0x81, 0x10, 0x18, 0x8E, 0x10, 0x00, 0xCB, 0x7F, + 0x27, 0x08, 0x06, 0xDE, 0x3C, 0x20, 0xE5, 0xFE, 0xCC, 0x4F, 0xB3, 0x41, + 0xE0, 0xCC, 0x4C, 0x26, 0xC1, 0xC0, 0x2C, 0x16, 0x12, 0xAA, 0x04, 0x83, + 0x51, 0x4E, 0xCA, 0x00, 0xCF, 0x42, 0x9C, 0x06, 0x2D, 0x06, 0xDD, 0x1D, + 0x08, 0x75, 0xE0, 0x89, 0xC7, 0x62, 0x68, 0x2E, 0xBF, 0x4D, 0x2D, 0x0A, + 0xC4, 0x86, 0xF6, 0x2F, 0xA1, 0x49, 0xA7, 0x0F, 0xDB, 0x1F, 0x82, 0xEC, + 0xC1, 0x62, 0xFB, 0x7F, 0xF1, 0xAE, 0xA6, 0x1A, 0xD5, 0x6B, 0x06, 0x5E, + 0xB6, 0x02, 0x50, 0xAE, 0x2D, 0xF9, 0xD9, 0x95, 0xAD, 0x01, 0x8C, 0x53, + 0x01, 0xAF, 0xCE, 0xE5, 0xA5, 0xBB, 0x95, 0x8A, 0x85, 0x70, 0x77, 0xE3, + 0x9A, 0x68, 0x1B, 0xDF, 0x47, 0xF9, 0xF4, 0xBD, 0x80, 0x7D, 0x76, 0x9A, + 0x69, 0xFC, 0xBE, 0x14, 0x0D, 0x87, 0x09, 0x12, 0x98, 0x20, 0x05, 0x46, + 0xB7, 0xAE, 0x10, 0xB7, 0x01, 0xB7, 0xDE, 0x3B, 0xDD, 0x7A, 0x8A, 0x55, + 0x73, 0xAD, 0xDF, 0x69, 0xDE, 0xD0, 0x51, 0x97, 0xA0, 0xE6, 0x5E, 0xBA, + 0xBA, 0x80, 0x0F, 0x4E, 0x9A, 0x68, 0x36, 0xE6, 0x9F, 0x5B, 0x39, 0xC0, + 0x90, 0xA1, 0xC0, 0xC3, 0x82, 0xE4, 0x50, 0xEA, 0x60, 0x7A, 0xDD, 0x5F, + 0x8B, 0x5F, 0xAF, 0xFC, 0x74, 0xAF, 0xDC, 0x56, 0xF7, 0x2E, 0x3E, 0x97, + 0x6E, 0x2B, 0xF3, 0xAF, 0xFE, 0x7D, 0x32, 0xDC, 0x56, 0xF8, 0xAF, 0xB5, + 0xA3, 0xBB, 0x00, 0x5B, 0x84, 0x3D, 0x9F, 0x0B, 0x40, 0x88, 0x61, 0x5F, + 0x4F, 0x4F, 0xB0, 0xB3, 0x07, 0x81, 0x3E, 0xF2, 0xFB, 0x50, 0xCA, 0x77, + 0x40, 0x12, 0xA8, 0xE6, 0x11, 0x8E, 0xD6, 0x8A, 0xC6, 0xD6, 0x8C, 0x1D, + 0x63, 0x55, 0x3D, 0x34, 0xEA, 0xC3, 0xC6, 0x6A, 0xD2, 0x8C, 0xB0, 0x1D, + 0x5E, 0x4A, 0x7A, 0x8B, 0xD5, 0x99, 0x80, 0x84, 0x32, 0xFB, 0xB7, 0x02, + 0x6E, 0x61, 0xFE, 0xAC, 0x1B, 0x5D, 0x10, 0x23, 0x24, 0xC3, 0x8C, 0x7B, + 0x58, 0x2C, 0x4D, 0x04, 0x74, 0x84, 0x25, 0x10, 0x4E, 0x94, 0x29, 0x4D, + 0x88, 0xAE, 0x65, 0x53, 0xB9, 0x95, 0x4E, 0xE7, 0xDD, 0xEE, 0xF2, 0x70, + 0x1F, 0x26, 0x4F, 0xA8, 0xBC, 0x3D, 0x35, 0x02, 0x3B, 0xC0, 0x98, 0x70, + 0x38, 0x18, 0xE5, 0x1E, 0x05, 0xAC, 0x28, 0xAA, 0x46, 0x1A, 0xB0, 0x19, + 0x99, 0x18, 0x35, 0x78, 0x1E, 0x41, 0x60, 0x0D, 0x4F, 0x7E, 0xEC, 0x37, + 0xC3, 0x30, 0x73, 0x2A, 0x69, 0xFE, 0xEF, 0x27, 0xEE, 0x13, 0xCC, 0xD0, + 0xDB, 0xE6, 0x45, 0xEC, 0x5C, 0xB5, 0x71, 0x54, 0x2E, 0xB1, 0xE9, 0x88, + 0xB4, 0x3F, 0x6F, 0xFD, 0xF7, 0xFF, 0x9D, 0x2D, 0x52, 0x2E, 0xAE, 0xC9, + 0x95, 0xDE, 0xBF, 0xDF, 0xFF, 0xBF, 0x21, 0xB3, 0x2B, 0xF5, 0xF7, 0xF7, + 0xD1, 0xA0, 0xF0, 0x76, 0x68, 0x37, 0xDB, 0x8F, 0x85, 0x4D, 0xA8, 0x1A, + 0xF9, 0x7F, 0x75, 0xA7, 0x93, 0xF5, 0x03, 0xC1, 0xF2, 0x60, 0x8A, 0x92, + 0x53, 0xF5, 0xD1, 0xC1, 0x56, 0x4B, 0x68, 0x05, 0x16, 0x88, 0x61, 0xE7, + 0x14, 0xC8, 0x0D, 0xF0, 0xDF, 0xEF, 0x46, 0x4A, 0xED, 0x0B, 0xD1, 0xD1, + 0xD1, 0xA4, 0x85, 0xA3, 0x2C, 0x1D, 0xDE, 0x45, 0x14, 0xA1, 0x8E, 0xA8, + 0xD9, 0x8C, 0xAB, 0x47, 0x31, 0xF1, 0x00, 0x15, 0xAD, 0x80, 0x20, 0xAA, + 0xE4, 0x57, 0xF8, 0x05, 0x14, 0x58, 0x0B, 0xD3, 0x63, 0x00, 0x8F, 0x44, + 0x15, 0x7F, 0x19, 0xC7, 0x0A, 0xE0, 0x49, 0x32, 0xFE, 0x36, 0x0E, 0xF3, + 0x66, 0x10, 0x2B, 0x11, 0x73, 0x3D, 0x19, 0x92, 0x22, 0x20, 0x75, 0x1F, + 0xF1, 0xDB, 0x96, 0x73, 0xCF, 0x1B, 0x53, 0xFF, 0xD2, 0x23, 0xF2, 0xB6, + 0xAA, 0xB6, 0x44, 0xA3, 0x73, 0x7E, 0x00, 0x2D, 0x4D, 0x4D, 0x87, 0xE0, + 0x84, 0x55, 0xD6, 0x03, 0xB8, 0xD8, 0x90, 0xEF, 0xC0, 0x76, 0x5D, 0x69, + 0x02, 0x00, 0x0E, 0x17, 0xD0, 0x02, 0x96, 0x50, 0xEA, 0xAB, 0xBF, 0x0D, + 0xAF, 0xCB, 0xD3, 0xFF, 0xAA, 0x9D, 0x7F, 0xD6, 0xBD, 0x2C, 0x14, 0xB4, + 0xCD, 0x20, 0x73, 0xB4, 0xF4, 0x38, 0x96, 0xDE, 0xB0, 0x6B, 0xE5, 0x1B, + 0xFD, 0x0E, 0x0B, 0xA4, 0x81, 0xBF, 0xC8, 0xA0, 0x21, 0x76, 0x7B, 0x25, + 0x3F, 0xE6, 0x84, 0x40, 0x1A, 0xDA, 0x25, 0x5A, 0xFF, 0x73, 0x6B, 0x14, + 0x1B, 0xF7, 0x08, 0xFA, 0x26, 0x73, 0x7A, 0x58, 0x02, 0x1A, 0xE6, 0x63, + 0xB6, 0x45, 0x7B, 0xE3, 0xE0, 0x80, 0x14, 0x42, 0xA8, 0x7D, 0xF3, 0x80, + 0x9B, 0x01, 0x43, 0x82, 0x82, 0x8C, 0xBE, 0x0D, 0xFD, 0xAE, 0x88, 0xA8, + 0xB9, 0xC3, 0xEE, 0xFF, 0x46, 0x00, 0x84, 0xE6, 0xB4, 0x0C, 0xA9, 0x66, + 0xC6, 0x74, 0x72, 0xAA, 0xA4, 0x3A, 0xB0, 0x1B, 0x06, 0xB4, 0xDB, 0xE8, + 0xC2, 0x17, 0xA2, 0xBC, 0xBE, 0x5C, 0x0F, 0x2A, 0x76, 0xD5, 0xEE, 0x39, + 0x36, 0x7C, 0x25, 0x94, 0x15, 0x3C, 0xC9, 0xB9, 0x93, 0x07, 0x19, 0xAF, + 0xE6, 0x70, 0xC3, 0xF5, 0xD4, 0x17, 0x87, 0x57, 0x77, 0x7D, 0xCF, 0x0D, + 0xDD, 0xDE, 0xB7, 0xFF, 0xB4, 0xDA, 0x20, 0x45, 0x1A, 0x45, 0xF4, 0x58, + 0x01, 0xBC, 0xEB, 0x3F, 0x16, 0x7F, 0x4C, 0x15, 0x84, 0x8C, 0xE5, 0xF6, + 0x96, 0xA6, 0xA1, 0xB9, 0xB2, 0x7F, 0x6B, 0xFF, 0x31, 0xF2, 0xF5, 0xC9, + 0xFF, 0x61, 0xEE, 0xB5, 0x84, 0xAE, 0x68, 0x41, 0xEA, 0xD0, 0xF0, 0xA5, + 0xCE, 0x0C, 0xE6, 0x4C, 0x6D, 0x6D, 0x94, 0x08, 0xC9, 0xA9, 0x4A, 0x60, + 0x6D, 0x01, 0x3B, 0xEF, 0x4D, 0x99, 0x8D, 0x42, 0x2A, 0x6B, 0x8A, 0xC7, + 0xFA, 0xA9, 0x90, 0x40, 0x00, 0x90, 0xF3, 0xA0, 0x75, 0x8E, 0xD5, 0xFE, + 0xE7, 0xBD, 0x02, 0x87, 0x0C, 0x7D, 0xF0, 0xAF, 0x1E, 0x5F, 0x8D, 0xC8, + 0xE1, 0xD4, 0x56, 0x08, 0xBF, 0x76, 0x80, 0xD4, 0x18, 0x89, 0x2D, 0x57, + 0xDF, 0x66, 0xD0, 0x46, 0x68, 0x77, 0x55, 0x47, 0xF5, 0x7C, 0xF7, 0xA6, + 0x66, 0xD6, 0x5A, 0x64, 0x55, 0xD4, 0x80, 0xC4, 0x55, 0xE9, 0x36, 0x3F, + 0x5E, 0xE2, 0x5C, 0x7F, 0x5F, 0xCE, 0x7F, 0xE1, 0x0C, 0x82, 0x3D, 0x6B, + 0x6E, 0xA2, 0xEA, 0x3B, 0x1F, 0xE8, 0x9E, 0xC7, 0x4E, 0x24, 0x3D, 0xDD, + 0xFA, 0xEB, 0x71, 0xDF, 0xFE, 0x15, 0xFE, 0x41, 0x9B, 0xB4, 0x4E, 0xAB, + 0x51, 0xE5, 0x1F, 0x7D, 0x2D, 0xAC, 0xD0, 0x66, 0xD9, 0xA1, 0x59, 0x78, + 0xC6, 0xEF, 0xC4, 0x43, 0x08, 0x65, 0x18, 0x73, 0xDE, 0x2A, 0xAD, 0x72, + 0xE7, 0x5A, 0x7E, 0x33, 0x04, 0x72, 0x38, 0x57, 0x47, 0x73, 0x10, 0x1D, + 0x88, 0x57, 0x4C, 0xDF, 0xA7, 0x78, 0x16, 0xFB, 0x01, 0x21, 0x28, 0x2D, + 0xB6, 0x7E, 0x05, 0x18, 0x32, 0x52, 0xC3, 0x49, 0x0B, 0x32, 0x18, 0x12, + 0x93, 0x54, 0x15, 0x3B, 0xC8, 0x6D, 0x4A, 0x77, 0xEF, 0x0A, 0x46, 0x83, + 0x89, 0x5C, 0x8B, 0xCB, 0x18, 0xA6, 0xDC, 0x97, 0x6F, 0xEE, 0xEE, 0x00, + 0x6A, 0xF1, 0x10, 0xFE, 0x07, 0x0C, 0xE0, 0x53, 0xD2, 0xB8, 0x45, 0xF4, + 0x6E, 0x16, 0x4B, 0xC9, 0x9C, 0xC7, 0x93, 0x83, 0x23, 0x1D, 0x4D, 0x00, + 0xB9, 0x4F, 0x86, 0x51, 0xF0, 0x29, 0x69, 0x41, 0x21, 0xC5, 0x4A, 0xC6, + 0x6D, 0xD1, 0x81, 0x38, 0xDB, 0x7C, 0x06, 0xA8, 0x26, 0x8E, 0x71, 0x00, + 0x4C, 0x44, 0x14, 0x05, 0xF2, 0x1C, 0x00, 0x49, 0xFC, 0x29, 0x6A, 0xF9, + 0x9E, 0xD1, 0x35, 0x4B, 0xB7, 0xE5, 0xDB, 0xFC, 0x01, 0x04, 0x3F, 0x70, + 0x33, 0x56, 0x87, 0x69, 0x01, 0xB4, 0xCE, 0x1C, 0x4D, 0x2E, 0x83, 0x51, + 0x51, 0xD0, 0x37, 0x3B, 0xB4, 0xBA, 0x47, 0xF5, 0xFF, 0xBF, 0xFA, 0xD5, + 0x03, 0x65, 0xD3, 0x28, 0x9F, 0x38, 0x57, 0xFE, 0x71, 0xD8, 0x9C, 0x16, + 0xEE, 0x72, 0x19, 0x03, 0x17, 0x6E, 0xC0, 0xEC, 0x49, 0x3D, 0x96, 0xE2, + 0x30, 0x97, 0x97, 0x84, 0x38, 0x6B, 0xE8, 0x2E, 0xAB, 0x0E, 0x2E, 0x03, + 0x52, 0xBA, 0x68, 0x55, 0xBA, 0x1D, 0x2C, 0x47, 0xAA, 0x72, 0xAE, 0x02, + 0x31, 0x6E, 0xA1, 0xDC, 0xAD, 0x0F, 0x4A, 0x46, 0xC9, 0xF2, 0xA9, 0xAB, + 0xFD, 0x87, 0x89, 0x5C, 0xB3, 0x75, 0x7E, 0xE3, 0xDE, 0x9F, 0xC4, 0x02, + 0x1E, 0xA2, 0xF8, 0x8B, 0xD3, 0x00, 0x83, 0x96, 0xC4, 0xD0, 0xB9, 0x62, + 0xB9, 0x69, 0xEC, 0x56, 0xDF, 0x7D, 0x91, 0x4B, 0x68, 0x27, 0xA8, 0x61, + 0x78, 0xA7, 0x95, 0x66, 0x51, 0x41, 0xF6, 0xCE, 0x78, 0xD3, 0x9A, 0x91, + 0xA0, 0x31, 0x09, 0x47, 0xB8, 0x47, 0xB8, 0x44, 0xE1, 0x13, 0x86, 0x7E, + 0x92, 0x80, 0xC6, 0x1A, 0xF7, 0x79, 0x7E, 0xF1, 0x5D, 0x9F, 0x17, 0x2D, + 0x80, 0x00, 0x79, 0x34, 0x7D, 0xE3, 0xAD, 0x60, 0x00, 0x20, 0x07, 0x80, + 0x00, 0x40, 0x01, 0xF8, 0xA1, 0x86, 0xB1, 0xEE, 0x21, 0x63, 0x85, 0x60, + 0x51, 0x84, 0x90, 0x7E, 0x92, 0x09, 0x39, 0x1C, 0x16, 0x87, 0x5C, 0xA6, + 0x09, 0x90, 0x06, 0x34, 0x6E, 0xB8, 0x8D, 0x5D, 0xAC, 0x77, 0x97, 0xB5, + 0x4D, 0x30, 0xFD, 0x39, 0xD0, 0x50, 0x00, 0xC9, 0x98, 0x04, 0x86, 0x00, + 0x0D, 0xD8, 0x3E, 0x34, 0xC2, 0xA6, 0x25, 0xF8, 0x20, 0xCC, 0x6D, 0x9E, + 0x63, 0x05, 0x30, 0xC4, 0xC6, 0xCC, 0x54, 0x31, 0x9F, 0x3C, 0xF5, 0x86, + 0xB9, 0x08, 0x18, 0xC3, 0x1E, 0xB9, 0xA0, 0x0C, 0x45, 0x2C, 0x54, 0x32, + 0x8B, 0x85, 0x86, 0x59, 0xC3, 0xB3, 0x50, 0x5A, 0xFE, 0xBA, 0xF7, 0x4D, + 0xC9, 0x9C, 0x9E, 0x01, 0xDF, 0xD7, 0x6E, 0xB5, 0x15, 0x53, 0x08, 0x57, + 0xA4, 0x71, 0x36, 0x80, 0x46, 0x05, 0x21, 0x48, 0x7B, 0x91, 0xC8, 0xAA, + 0xFF, 0x07, 0x9F, 0x78, 0x68, 0xCF, 0x3C, 0xEF, 0xFF, 0xBC, 0xB6, 0xA2, + 0x36, 0xB7, 0x9F, 0x54, 0xF6, 0x6F, 0x5D, 0xDD, 0x75, 0xD4, 0x3C, 0x75, + 0xE8, 0xCF, 0x15, 0x02, 0x5B, 0x94, 0xC3, 0xA2, 0x41, 0x63, 0xA1, 0x14, + 0xF6, 0xC0, 0x57, 0x15, 0x9F, 0x0C, 0x3F, 0x80, 0xF2, 0x98, 0xEE, 0x41, + 0x85, 0xEE, 0xBC, 0xAA, 0xE9, 0x59, 0xAA, 0xA0, 0x92, 0xCA, 0x00, 0xF3, + 0x50, 0xCC, 0xFF, 0xAD, 0x97, 0x69, 0xA7, 0xF2, 0x0B, 0x8F, 0xD7, 0xD7, + 0x82, 0x3A, 0xBB, 0x98, 0x1D, 0xCB, 0x89, 0x0B, 0x9B, 0x05, 0xF7, 0xD0, + 0x1A, 0x60, 0xF3, 0x29, 0x16, 0x12, 0xF8, 0xF4, 0xF1, 0x4A, 0x05, 0x9B, + 0x57, 0x12, 0x7E, 0x3A, 0x4A, 0x8D, 0xA6, 0xDF, 0xB6, 0xDD, 0xDF, 0xC3, + 0xF0, 0xD2, 0xD4, 0xD7, 0x41, 0xA6, 0x00, 0x76, 0x8C, 0x75, 0x08, 0xF0, + 0x19, 0xD8, 0x14, 0x63, 0x55, 0x52, 0x18, 0x30, 0x98, 0xD0, 0x3F, 0x65, + 0x52, 0xB3, 0x88, 0x6D, 0x17, 0x39, 0x93, 0xCA, 0x3B, 0xB4, 0x1D, 0x8D, + 0xDF, 0xDF, 0xAD, 0x72, 0xDA, 0x74, 0xAF, 0xBD, 0x31, 0xF9, 0x12, 0x61, + 0x45, 0x29, 0x4C, 0x2B, 0x61, 0xA1, 0x12, 0x90, 0x53, 0xE7, 0x5A, 0x9D, + 0x44, 0xC8, 0x3A, 0x83, 0xDC, 0x34, 0x4C, 0x07, 0xAF, 0xDB, 0x90, 0xCD, + 0x03, 0xA4, 0x64, 0x78, 0xBD, 0x55, 0xB2, 0x56, 0x59, 0x32, 0xAB, 0x13, + 0x2C, 0xC9, 0x77, 0xF8, 0x3B, 0xDF, 0xFF, 0xAC, 0x07, 0xB9, 0x08, 0x7B, + 0xE9, 0x82, 0xB9, 0x59, 0xC7, 0xFF, 0x86, 0x2C, 0x12, 0x7C, 0xC6, 0x65, + 0x3C, 0x71, 0xB8, 0x98, 0x9F, 0xA2, 0x45, 0x03, 0xA5, 0xD9, 0xC3, 0xCF, + 0xFA, 0xEB, 0x89, 0xAD, 0x03, 0xEE, 0xDD, 0x76, 0xD3, 0x4F, 0x10, 0x6F, + 0xF0, 0xC1, 0x60, 0x0C, 0x00, 0xD4, 0x76, 0x12, 0x0A, 0x8D, 0xDC, 0xFD, + 0x5E, 0x0B, 0x26, 0x2F, 0x01, 0x1D, 0xB9, 0xE7, 0x73, 0xD4, 0xF2, 0xCB, + 0xD8, 0x78, 0x21, 0x52, 0x4B, 0x83, 0x3C, 0x44, 0x72, 0x0E, 0xB1, 0x4E, + 0x37, 0xBC, 0xC7, 0x50, 0xFA, 0x07, 0x80, 0x71, 0x10, 0x0B, 0x24, 0xD1, + 0x7E, 0xDA, 0x7F, 0xA7, 0x2F, 0x40, 0xAA, 0xD3, 0xF5, 0x44, 0x10, 0x56, + 0x4E, 0x3B, 0xF1, 0x6E, 0x9A, 0xA0, 0xEA, 0x85, 0x66, 0x16, 0xFB, 0x5C, + 0x0B, 0x2B, 0x74, 0x18, 0xAF, 0x3D, 0x04, 0x3E, 0xCE, 0x88, 0x9B, 0x3E, + 0xF4, 0xB9, 0x00, 0x60, 0x0E, 0xE1, 0xE2, 0xCB, 0x12, 0xB9, 0x6D, 0x5A, + 0xC7, 0x55, 0x1D, 0xB9, 0x79, 0xAC, 0x43, 0x43, 0xE6, 0x3B, 0xDD, 0x7E, + 0x9F, 0x78, 0xD3, 0xEA, 0xA3, 0x11, 0xFF, 0xDB, 0xBB, 0xB8, 0x97, 0x37, + 0x15, 0xDB, 0xF1, 0x97, 0x96, 0xC7, 0xFC, 0xE5, 0xBF, 0xF2, 0x86, 0xC0, + 0xFA, 0x9B, 0x4C, 0x00, 0x04, 0x03, 0xA5, 0xB6, 0xB7, 0x9C, 0xD9, 0xAB, + 0x09, 0x77, 0x51, 0x18, 0x3B, 0xAD, 0x61, 0x6C, 0xFC, 0x51, 0x96, 0xFB, + 0x19, 0xC8, 0x52, 0x35, 0x07, 0x00, 0x63, 0x87, 0x14, 0x04, 0xFA, 0x7A, + 0x48, 0x3E, 0x00, 0x47, 0x29, 0x07, 0x74, 0x97, 0x74, 0x84, 0xEB, 0xB2, + 0x16, 0xB2, 0x31, 0x81, 0xCE, 0x2A, 0x31, 0xA7, 0xB1, 0xEB, 0x83, 0x34, + 0x7A, 0x73, 0xD7, 0x2F, 0xFF, 0xBC, 0xFF, 0xE5, 0xAA, 0xF2, 0xB5, 0x6E, + 0x9E, 0xA5, 0x70, 0x8A, 0x8C, 0xDF, 0x6A, 0x06, 0x16, 0xC1, 0xAB, 0x59, + 0x70, 0xD9, 0x3D, 0x47, 0x7C, 0xDD, 0xEF, 0xDF, 0x2F, 0xFF, 0x42, 0x6B, + 0xBA, 0x4B, 0xBF, 0xF8, 0x7F, 0xF2, 0x03, 0x0D, 0x79, 0xBC, 0x03, 0x76, + 0x64, 0x1C, 0x0D, 0x7B, 0xD7, 0xBD, 0xB0, 0x6C, 0xD8, 0x61, 0x17, 0x17, + 0x8C, 0xED, 0x4E, 0x20, 0xEB, 0x55, 0x33, 0x39, 0xE9, 0x7E, 0xBE, 0x8E, + 0x05, 0x4B, 0x78, 0x96, 0x85, 0xCC, 0x68, 0xC9, 0x78, 0xAF, 0xAE, 0x44, + 0x36, 0x61, 0xD3, 0x53, 0xEB, 0xB3, 0x3E, 0x4F, 0x97, 0xE2, 0x8D, 0xAE, + 0x90, 0xED, 0xB5, 0x4F, 0x8E, 0xE4, 0x7A, 0x44, 0xCF, 0x9D, 0xC5, 0x77, + 0x4D, 0xAB, 0x4F, 0xE5, 0xC5, 0x73, 0xA0, 0xC8, 0xA5, 0xBB, 0x4B, 0x7D, + 0xD5, 0xFB, 0xFB, 0xFF, 0x61, 0xFD, 0xAA, 0x1A, 0x62, 0x7E, 0x3C, 0x66, + 0x34, 0x15, 0x64, 0x25, 0xEC, 0x7C, 0x9D, 0x6A, 0x64, 0x4D, 0x80, 0xD5, + 0x4F, 0xFE, 0x8E, 0xEE, 0x18, 0x53, 0xC1, 0x09, 0x51, 0xF7, 0xC0, 0xA6, + 0xB2, 0x9B, 0x19, 0x2B, 0x14, 0x66, 0x66, 0x4B, 0x39, 0x62, 0x1D, 0x84, + 0xB9, 0x02, 0x84, 0xAC, 0xC1, 0xDA, 0x6C, 0x80, 0xCD, 0x40, 0x20, 0x20, + 0x19, 0x51, 0xDC, 0x2B, 0x7D, 0x5D, 0x7F, 0xE3, 0x86, 0x8E, 0xC3, 0x35, + 0xFE, 0x5C, 0xF6, 0x1C, 0xFF, 0x05, 0x9E, 0xB5, 0xB6, 0xBB, 0xBE, 0xF7, + 0x2F, 0xB7, 0xE1, 0xF5, 0x33, 0x86, 0xA0, 0x47, 0xDE, 0xF7, 0xE9, 0x3B, + 0xBE, 0x7E, 0x9B, 0x17, 0xFC, 0xFD, 0x2E, 0x40, 0x86, 0x41, 0x75, 0xF1, + 0xB2, 0x18, 0xA9, 0xDE, 0x2D, 0xD6, 0x04, 0x20, 0xA4, 0xBA, 0x81, 0xBC, + 0x1D, 0x5A, 0xD6, 0xF7, 0xF6, 0xB8, 0x42, 0xF7, 0xF5, 0x3D, 0x97, 0xAC, + 0xCD, 0x6F, 0xAD, 0xDB, 0x4F, 0x5A, 0x2E, 0x64, 0xB9, 0x5D, 0xDD, 0x8B, + 0x4A, 0x35, 0x44, 0xFE, 0x3D, 0xC6, 0x77, 0x7A, 0xBF, 0xDA, 0xAC, 0x9E, + 0xB0, 0xA2, 0xB9, 0x6C, 0xAF, 0x02, 0xDD, 0xF2, 0x71, 0x2B, 0xEF, 0xD3, + 0x51, 0x0E, 0x07, 0x11, 0xBD, 0xED, 0x39, 0x7F, 0xD9, 0xB8, 0xBD, 0xEE, + 0x35, 0xE9, 0x5C, 0x67, 0x42, 0xDA, 0x05, 0x6E, 0x39, 0xCE, 0x55, 0xFB, + 0x26, 0xB7, 0x90, 0x4B, 0xDA, 0x91, 0x48, 0xFD, 0xDE, 0xB2, 0xEC, 0x88, + 0x9A, 0x46, 0x1A, 0x4C, 0xD4, 0x05, 0x12, 0x85, 0x57, 0x37, 0x22, 0xD3, + 0x0E, 0x4F, 0x79, 0xE3, 0x81, 0xA9, 0x2B, 0x5F, 0xD7, 0x6D, 0xBD, 0x21, + 0x98, 0x6F, 0x7D, 0xF5, 0x32, 0x7A, 0x6E, 0xF8, 0x20, 0x01, 0x50, 0x90, + 0x7A, 0x88, 0x3E, 0x0D, 0x57, 0xB1, 0x58, 0x65, 0xE6, 0x82, 0xCE, 0x08, + 0x69, 0x8B, 0x87, 0x62, 0x36, 0xB1, 0x7B, 0xDE, 0x74, 0xBD, 0xFE, 0x10, + 0xBE, 0x26, 0xAB, 0x7E, 0xB7, 0x8D, 0xF7, 0x83, 0x2E, 0x0F, 0xAF, 0x7E, + 0xBC, 0x17, 0x31, 0xFF, 0xB0, 0x4F, 0x7F, 0x4B, 0x13, 0x83, 0xDF, 0xEE, + 0x23, 0xD3, 0xE7, 0xC8, 0xAF, 0x75, 0xAB, 0xEA, 0xBD, 0x7D, 0xD2, 0x9D, + 0xE9, 0xC1, 0x18, 0x8B, 0x7C, 0x9F, 0x51, 0xDC, 0x37, 0xA3, 0xDB, 0xFC, + 0xD4, 0x6A, 0x91, 0x44, 0x7F, 0x72, 0xC5, 0xD9, 0xC8, 0x37, 0x38, 0x63, + 0x0D, 0x59, 0x8B, 0x7F, 0x7D, 0x96, 0xC1, 0x5F, 0x4C, 0x7C, 0x88, 0xCB, + 0x65, 0x07, 0x2B, 0x0E, 0x1D, 0x24, 0xAA, 0x20, 0x2E, 0x6C, 0x33, 0xAB, + 0xEF, 0x23, 0xE5, 0xE3, 0x6C, 0xA3, 0xA5, 0x2D, 0x01, 0xDF, 0x26, 0x92, + 0x52, 0xF5, 0xE6, 0x3E, 0xE3, 0xDD, 0xC6, 0xED, 0x42, 0x0F, 0x71, 0x7B, + 0xD1, 0xF4, 0x06, 0xF6, 0x82, 0xD5, 0x13, 0xB3, 0x60, 0x31, 0x09, 0x89, + 0x63, 0x15, 0xD2, 0xCB, 0xAA, 0x77, 0xFD, 0xF4, 0xEB, 0xF4, 0xED, 0x2E, + 0xE2, 0xBA, 0x27, 0x2E, 0x74, 0xD2, 0x91, 0x7F, 0x0F, 0xDE, 0x25, 0xFE, + 0x78, 0x20, 0x05, 0x0A, 0x6A, 0xFE, 0x89, 0x14, 0x23, 0xF3, 0xF5, 0x3A, + 0x1E, 0xF3, 0x22, 0xCE, 0x12, 0x82, 0x24, 0x11, 0x05, 0x04, 0x71, 0x99, + 0xE5, 0xF0, 0xA6, 0xDB, 0x7B, 0xF5, 0x8F, 0xF9, 0x3C, 0x02, 0x0C, 0x46, + 0xFD, 0xB6, 0xEA, 0x06, 0x11, 0xF4, 0x1E, 0x7A, 0x20, 0x6A, 0x54, 0xBB, + 0x4A, 0x60, 0xB0, 0x30, 0x28, 0x9A, 0xF3, 0x3B, 0xE9, 0xBD, 0xD6, 0x04, + 0xCA, 0x3A, 0x33, 0x37, 0x5F, 0xB7, 0xAD, 0xE7, 0x9C, 0xE2, 0x95, 0x21, + 0xF7, 0xB5, 0xC4, 0xF0, 0xD1, 0x51, 0x09, 0x44, 0x3F, 0x07, 0xFC, 0x5F, + 0x37, 0xFD, 0x7D, 0x7E, 0xD5, 0xF7, 0xEB, 0x69, 0xB9, 0x54, 0x98, 0x5A, + 0x2A, 0x56, 0xE3, 0xC0, 0x21, 0x57, 0xD1, 0xEB, 0x75, 0x15, 0xED, 0xAC, + 0xAF, 0x5D, 0xFF, 0xC2, 0xFE, 0x4E, 0xFB, 0xBA, 0x13, 0xB8, 0x87, 0xFA, + 0x4E, 0x5E, 0x5C, 0x24, 0x15, 0x5B, 0x2B, 0x2C, 0x32, 0x68, 0x1F, 0x30, + 0x5F, 0xC1, 0xF7, 0xE7, 0xE1, 0x9C, 0x00, 0xC1, 0x9C, 0xB1, 0xAB, 0xFA, + 0xFF, 0xC1, 0x1E, 0x72, 0xA1, 0x46, 0x9E, 0x2E, 0xCD, 0x76, 0x96, 0x4F, + 0x14, 0xDC, 0x68, 0xC1, 0x10, 0x9F, 0xDF, 0xEB, 0x5A, 0xBA, 0x8D, 0x91, + 0x4E, 0x76, 0xE9, 0x3A, 0x43, 0x2D, 0x88, 0xD2, 0x81, 0x0C, 0xEC, 0x6F, + 0xB7, 0xA4, 0x8B, 0x97, 0x4F, 0xC4, 0x1E, 0xF3, 0x0F, 0xF5, 0x66, 0x66, + 0xBF, 0x6C, 0x3F, 0xFB, 0x6E, 0x2B, 0x48, 0x6C, 0x7B, 0xD1, 0x2E, 0x64, + 0xD1, 0x0B, 0x6E, 0x5B, 0x05, 0x16, 0xDD, 0xCB, 0x1B, 0xDE, 0xA2, 0xB9, + 0xA8, 0x94, 0xD6, 0x5A, 0x5B, 0xE2, 0xC9, 0xBC, 0xD5, 0xAB, 0x64, 0x5B, + 0x0F, 0x9A, 0xFD, 0xC7, 0x2E, 0xB7, 0xEF, 0xAE, 0xE9, 0x1F, 0x32, 0xD2, + 0xCA, 0xA0, 0x37, 0x63, 0x86, 0x72, 0x41, 0x07, 0xBC, 0xAB, 0x6F, 0xFF, + 0xB7, 0x16, 0xAA, 0xA9, 0x58, 0x9E, 0x43, 0x9C, 0x22, 0x8D, 0x48, 0xCE, + 0xE5, 0xEF, 0xE0, 0x7D, 0x47, 0x87, 0x5A, 0xA8, 0x5B, 0x06, 0xA9, 0x47, + 0xF0, 0x26, 0xB4, 0x99, 0xD8, 0xA3, 0x64, 0xED, 0x73, 0xB3, 0x96, 0xB4, + 0x21, 0x19, 0xA5, 0xC1, 0xDC, 0x88, 0x2E, 0xEE, 0xF2, 0x77, 0x91, 0xEC, + 0xFB, 0xD5, 0xF9, 0xF8, 0x90, 0x47, 0xAD, 0xF5, 0xEB, 0x96, 0x6D, 0xF1, + 0x1C, 0xE0, 0xDC, 0x74, 0x1C, 0xE6, 0x2E, 0xE1, 0x76, 0x9D, 0xEE, 0xF4, + 0xEF, 0xA5, 0x31, 0x03, 0x87, 0x0E, 0x2C, 0x84, 0xA5, 0xF1, 0x22, 0xBE, + 0x48, 0xA9, 0xCD, 0x09, 0x07, 0xC1, 0xF0, 0xD4, 0xE7, 0x03, 0x82, 0x39, + 0xE2, 0xA0, 0x0B, 0xDE, 0xAC, 0x37, 0xAC, 0x62, 0x97, 0x8E, 0x79, 0xCE, + 0x52, 0x24, 0x78, 0xF9, 0x17, 0xD2, 0xF1, 0x5D, 0x2D, 0xA1, 0xDF, 0x12, + 0x2C, 0x83, 0xE5, 0x1A, 0x28, 0x9A, 0x2D, 0xED, 0x8A, 0xBF, 0xFC, 0x41, + 0xC3, 0xEB, 0x0E, 0x91, 0xDB, 0xF2, 0xA1, 0xC8, 0xA8, 0x01, 0x8B, 0xF2, + 0xF3, 0x59, 0xB7, 0xA7, 0x6F, 0x80, 0xFF, 0x0B, 0x46, 0xE1, 0x63, 0xA7, + 0x5F, 0x6B, 0xBE, 0x33, 0x71, 0xBE, 0x3A, 0xAF, 0xA9, 0x53, 0x5D, 0x3B, + 0xB2, 0xF6, 0xEB, 0x42, 0x1C, 0x3E, 0x3F, 0x1D, 0x6A, 0x34, 0xAE, 0xB1, + 0x05, 0xA1, 0x32, 0x6C, 0xB5, 0xE4, 0xD3, 0xBB, 0xE8, 0x10, 0x14, 0x9E, + 0x68, 0x6A, 0x24, 0x51, 0xA5, 0x66, 0x64, 0xCC, 0xC4, 0x2D, 0x96, 0xA2, + 0xC7, 0x2D, 0x1F, 0x0A, 0x0F, 0x6B, 0xD9, 0xAD, 0xA3, 0x11, 0x8F, 0x00, + 0xAA, 0x06, 0xC2, 0x1E, 0xF3, 0xE8, 0x5A, 0x37, 0x4C, 0xD6, 0x4B, 0x6B, + 0x01, 0xC9, 0xB0, 0xB6, 0xB9, 0x92, 0xED, 0x1D, 0x08, 0xB0, 0x80, 0x06, + 0x20, 0xEA, 0xEE, 0xF9, 0x1D, 0xA4, 0x57, 0x73, 0x2E, 0x1B, 0xA5, 0xAF, + 0xF6, 0xAF, 0xAE, 0x04, 0x7C, 0x4C, 0x7E, 0xC8, 0xDB, 0xC0, 0xFB, 0x37, + 0xC8, 0x7E, 0xFE, 0x47, 0x0A, 0x3C, 0xFA, 0x61, 0xE7, 0xEB, 0x1B, 0xF3, + 0x7C, 0x32, 0xE3, 0x7C, 0x37, 0x66, 0x7C, 0x53, 0x07, 0xC2, 0x37, 0xA3, + 0xBD, 0xF7, 0xFA, 0xE3, 0x8A, 0x76, 0xCB, 0x6C, 0xC8, 0x13, 0xC4, 0x53, + 0x53, 0xDB, 0xAD, 0x37, 0x1A, 0xEB, 0xE0}; TEST_F(H264ToAnnexBBitstreamConverterTest, Success) { // Initialize converter. - scoped_ptr<uint8[]> output; + scoped_ptr<uint8_t[]> output; H264ToAnnexBBitstreamConverter converter; // Parse the headers. @@ -277,11 +294,11 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, Success) { kHeaderDataOkWithFieldLen4, sizeof(kHeaderDataOkWithFieldLen4), &avc_config_)); - uint32 config_size = converter.GetConfigSize(avc_config_); + uint32_t config_size = converter.GetConfigSize(avc_config_); EXPECT_GT(config_size, 0U); // Go on with converting the headers. - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(output.get() != NULL); EXPECT_TRUE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, @@ -289,15 +306,14 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, Success) { &config_size)); // Calculate buffer size for actual NAL unit. - uint32 output_size = converter.CalculateNeededOutputBufferSize( - kPacketDataOkWithFieldLen4, - sizeof(kPacketDataOkWithFieldLen4), + uint32_t output_size = converter.CalculateNeededOutputBufferSize( + kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4), &avc_config_); EXPECT_GT(output_size, 0U); - output.reset(new uint8[output_size]); + output.reset(new uint8_t[output_size]); EXPECT_TRUE(output.get() != NULL); - uint32 output_size_left_for_nal_unit = output_size; + uint32_t output_size_left_for_nal_unit = output_size; // Do the conversion for actual NAL unit. EXPECT_TRUE(converter.ConvertNalUnitStreamToByteStream( kPacketDataOkWithFieldLen4, @@ -313,7 +329,7 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureHeaderBufferOverflow) { // Simulate 10 sps AVCDecoderConfigurationRecord, // which would extend beyond the buffer. - uint8 corrupted_header[sizeof(kHeaderDataOkWithFieldLen4)]; + uint8_t corrupted_header[sizeof(kHeaderDataOkWithFieldLen4)]; memcpy(corrupted_header, kHeaderDataOkWithFieldLen4, sizeof(kHeaderDataOkWithFieldLen4)); // 6th byte, 5 LSBs contain the number of sps's. @@ -328,7 +344,7 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureHeaderBufferOverflow) { TEST_F(H264ToAnnexBBitstreamConverterTest, FailureNalUnitBreakage) { // Initialize converter. - scoped_ptr<uint8[]> output; + scoped_ptr<uint8_t[]> output; H264ToAnnexBBitstreamConverter converter; // Parse the headers. @@ -336,11 +352,11 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureNalUnitBreakage) { kHeaderDataOkWithFieldLen4, sizeof(kHeaderDataOkWithFieldLen4), &avc_config_)); - uint32 config_size = converter.GetConfigSize(avc_config_); + uint32_t config_size = converter.GetConfigSize(avc_config_); EXPECT_GT(config_size, 0U); // Go on with converting the headers. - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(output.get() != NULL); EXPECT_TRUE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, @@ -348,24 +364,22 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureNalUnitBreakage) { &config_size)); // Simulate NAL unit broken in middle by writing only some of the data. - uint8 corrupted_nal_unit[sizeof(kPacketDataOkWithFieldLen4) - 100]; + uint8_t corrupted_nal_unit[sizeof(kPacketDataOkWithFieldLen4) - 100]; memcpy(corrupted_nal_unit, kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4) - 100); // Calculate buffer size for actual NAL unit, should return 0 because of // incomplete input buffer. - uint32 output_size = converter.CalculateNeededOutputBufferSize( - corrupted_nal_unit, - sizeof(corrupted_nal_unit), - &avc_config_); + uint32_t output_size = converter.CalculateNeededOutputBufferSize( + corrupted_nal_unit, sizeof(corrupted_nal_unit), &avc_config_); EXPECT_EQ(output_size, 0U); // Ignore the error and try to go on with conversion simulating wrong usage. output_size = sizeof(kPacketDataOkWithFieldLen4); - output.reset(new uint8[output_size]); + output.reset(new uint8_t[output_size]); EXPECT_TRUE(output.get() != NULL); - uint32 output_size_left_for_nal_unit = output_size; + uint32_t output_size_left_for_nal_unit = output_size; // Do the conversion for actual NAL unit, expecting failure. EXPECT_FALSE(converter.ConvertNalUnitStreamToByteStream( corrupted_nal_unit, @@ -378,7 +392,7 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureNalUnitBreakage) { TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { // Initialize converter. - scoped_ptr<uint8[]> output; + scoped_ptr<uint8_t[]> output; H264ToAnnexBBitstreamConverter converter; // Parse the headers. @@ -386,13 +400,13 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { kHeaderDataOkWithFieldLen4, sizeof(kHeaderDataOkWithFieldLen4), &avc_config_)); - uint32 config_size = converter.GetConfigSize(avc_config_); + uint32_t config_size = converter.GetConfigSize(avc_config_); EXPECT_GT(config_size, 0U); - uint32 real_config_size = config_size; + uint32_t real_config_size = config_size; // Go on with converting the headers with too small buffer. config_size -= 10; - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(output.get() != NULL); EXPECT_FALSE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, @@ -402,7 +416,7 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { // Still too small (but only 1 byte short). config_size = real_config_size - 1; - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(output.get() != NULL); EXPECT_FALSE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, @@ -412,7 +426,7 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { // Finally, retry with valid buffer. config_size = real_config_size; - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(output.get() != NULL); EXPECT_TRUE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, @@ -420,17 +434,16 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { &config_size)); // Calculate buffer size for actual NAL unit. - uint32 output_size = converter.CalculateNeededOutputBufferSize( - kPacketDataOkWithFieldLen4, - sizeof(kPacketDataOkWithFieldLen4), + uint32_t output_size = converter.CalculateNeededOutputBufferSize( + kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4), &avc_config_); EXPECT_GT(output_size, 0U); // Simulate too small output buffer. output_size -= 1; - output.reset(new uint8[output_size]); + output.reset(new uint8_t[output_size]); EXPECT_TRUE(output.get() != NULL); - uint32 output_size_left_for_nal_unit = output_size; + uint32_t output_size_left_for_nal_unit = output_size; // Do the conversion for actual NAL unit (expect failure). EXPECT_FALSE(converter.ConvertNalUnitStreamToByteStream( kPacketDataOkWithFieldLen4, @@ -442,22 +455,20 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) { } // Generated from crash dump in http://crbug.com/234449 using xxd -i [file]. -static const uint8 kCorruptedPacketConfiguration[] = { - 0x01, 0x64, 0x00, 0x15, 0xff, 0xe1, 0x00, 0x17, 0x67, 0x64, 0x00, 0x15, - 0xac, 0xc8, 0xc1, 0x41, 0xfb, 0x0e, 0x10, 0x00, 0x00, 0x3e, 0x90, 0x00, - 0x0e, 0xa6, 0x00, 0xf1, 0x62, 0xd3, 0x80, 0x01, 0x00, 0x06, 0x68, 0xea, - 0xc0, 0xbc, 0xb2, 0x2c -}; +static const uint8_t kCorruptedPacketConfiguration[] = { + 0x01, 0x64, 0x00, 0x15, 0xff, 0xe1, 0x00, 0x17, 0x67, 0x64, + 0x00, 0x15, 0xac, 0xc8, 0xc1, 0x41, 0xfb, 0x0e, 0x10, 0x00, + 0x00, 0x3e, 0x90, 0x00, 0x0e, 0xa6, 0x00, 0xf1, 0x62, 0xd3, + 0x80, 0x01, 0x00, 0x06, 0x68, 0xea, 0xc0, 0xbc, 0xb2, 0x2c}; -static const uint8 kCorruptedPacketData[] = { - 0x00, 0x00, 0x00, 0x15, 0x01, 0x9f, 0x6e, 0xbc, 0x85, 0x3f, 0x0f, 0x87, - 0x47, 0xa8, 0xd7, 0x5b, 0xfc, 0xb8, 0xfd, 0x3f, 0x57, 0x0e, 0xac, 0xf5, - 0x4c, 0x01, 0x2e, 0x57 -}; +static const uint8_t kCorruptedPacketData[] = { + 0x00, 0x00, 0x00, 0x15, 0x01, 0x9f, 0x6e, 0xbc, 0x85, 0x3f, + 0x0f, 0x87, 0x47, 0xa8, 0xd7, 0x5b, 0xfc, 0xb8, 0xfd, 0x3f, + 0x57, 0x0e, 0xac, 0xf5, 0x4c, 0x01, 0x2e, 0x57}; TEST_F(H264ToAnnexBBitstreamConverterTest, CorruptedPacket) { // Initialize converter. - scoped_ptr<uint8[]> output; + scoped_ptr<uint8_t[]> output; H264ToAnnexBBitstreamConverter converter; // Parse the headers. @@ -465,21 +476,19 @@ TEST_F(H264ToAnnexBBitstreamConverterTest, CorruptedPacket) { kCorruptedPacketConfiguration, sizeof(kCorruptedPacketConfiguration), &avc_config_)); - uint32 config_size = converter.GetConfigSize(avc_config_); + uint32_t config_size = converter.GetConfigSize(avc_config_); EXPECT_GT(config_size, 0U); // Go on with converting the headers. - output.reset(new uint8[config_size]); + output.reset(new uint8_t[config_size]); EXPECT_TRUE(converter.ConvertAVCDecoderConfigToByteStream( avc_config_, output.get(), &config_size)); // Expect an error here. - uint32 output_size = converter.CalculateNeededOutputBufferSize( - kCorruptedPacketData, - sizeof(kCorruptedPacketData), - &avc_config_); + uint32_t output_size = converter.CalculateNeededOutputBufferSize( + kCorruptedPacketData, sizeof(kCorruptedPacketData), &avc_config_); EXPECT_EQ(output_size, 0U); } diff --git a/media/filters/h265_parser.cc b/media/filters/h265_parser.cc index 30a8233..d710ddb 100644 --- a/media/filters/h265_parser.cc +++ b/media/filters/h265_parser.cc @@ -47,13 +47,14 @@ void H265Parser::Reset() { encrypted_ranges_.clear(); } -void H265Parser::SetStream(const uint8* stream, off_t stream_size) { +void H265Parser::SetStream(const uint8_t* stream, off_t stream_size) { std::vector<SubsampleEntry> subsamples; SetEncryptedStream(stream, stream_size, subsamples); } void H265Parser::SetEncryptedStream( - const uint8* stream, off_t stream_size, + const uint8_t* stream, + off_t stream_size, const std::vector<SubsampleEntry>& subsamples) { DCHECK(stream); DCHECK_GT(stream_size, 0); @@ -62,12 +63,13 @@ void H265Parser::SetEncryptedStream( bytes_left_ = stream_size; encrypted_ranges_.clear(); - const uint8* start = stream; - const uint8* stream_end = stream_ + bytes_left_; + const uint8_t* start = stream; + const uint8_t* stream_end = stream_ + bytes_left_; for (size_t i = 0; i < subsamples.size() && start < stream_end; ++i) { start += subsamples[i].clear_bytes; - const uint8* end = std::min(start + subsamples[i].cypher_bytes, stream_end); + const uint8_t* end = + std::min(start + subsamples[i].cypher_bytes, stream_end); encrypted_ranges_.Add(start, end); start = end; } @@ -90,7 +92,7 @@ bool H265Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) { stream_ += nalu_start_off; bytes_left_ -= nalu_start_off; - const uint8* nalu_data = stream_ + annexb_start_code_size; + const uint8_t* nalu_data = stream_ + annexb_start_code_size; off_t max_nalu_data_size = bytes_left_ - annexb_start_code_size; if (max_nalu_data_size <= 0) { DVLOG(3) << "End of stream"; diff --git a/media/filters/h265_parser.h b/media/filters/h265_parser.h index f3cf713..f8e7402 100644 --- a/media/filters/h265_parser.h +++ b/media/filters/h265_parser.h @@ -12,7 +12,6 @@ #include <map> #include <vector> -#include "base/basictypes.h" #include "base/macros.h" #include "media/base/media_export.h" #include "media/base/ranges.h" @@ -83,7 +82,7 @@ struct MEDIA_EXPORT H265NALU { // After (without) start code; we don't own the underlying memory // and a shallow copy should be made when copying this struct. - const uint8* data; + const uint8_t* data; off_t size; // From after start code to start code of next NALU (or EOS). int nal_unit_type; @@ -109,8 +108,9 @@ class MEDIA_EXPORT H265Parser { // |stream| owned by caller. // |subsamples| contains information about what parts of |stream| are // encrypted. - void SetStream(const uint8* stream, off_t stream_size); - void SetEncryptedStream(const uint8* stream, off_t stream_size, + void SetStream(const uint8_t* stream, off_t stream_size); + void SetEncryptedStream(const uint8_t* stream, + off_t stream_size, const std::vector<SubsampleEntry>& subsamples); // Read the stream to find the next NALU, identify it and return @@ -132,7 +132,7 @@ class MEDIA_EXPORT H265Parser { bool LocateNALU(off_t* nalu_size, off_t* start_code_size); // Pointer to the current NALU in the stream. - const uint8* stream_; + const uint8_t* stream_; // Bytes left in the stream after the current NALU. off_t bytes_left_; @@ -141,7 +141,7 @@ class MEDIA_EXPORT H265Parser { // Ranges of encrypted bytes in the buffer passed to // SetEncryptedStream(). - Ranges<const uint8*> encrypted_ranges_; + Ranges<const uint8_t*> encrypted_ranges_; DISALLOW_COPY_AND_ASSIGN(H265Parser); }; diff --git a/media/filters/in_memory_url_protocol.cc b/media/filters/in_memory_url_protocol.cc index da8a7dd..8c1883a 100644 --- a/media/filters/in_memory_url_protocol.cc +++ b/media/filters/in_memory_url_protocol.cc @@ -8,21 +8,21 @@ namespace media { -InMemoryUrlProtocol::InMemoryUrlProtocol(const uint8* data, int64 size, +InMemoryUrlProtocol::InMemoryUrlProtocol(const uint8_t* data, + int64_t size, bool streaming) : data_(data), size_(size >= 0 ? size : 0), position_(0), - streaming_(streaming) { -} + streaming_(streaming) {} InMemoryUrlProtocol::~InMemoryUrlProtocol() {} -int InMemoryUrlProtocol::Read(int size, uint8* data) { +int InMemoryUrlProtocol::Read(int size, uint8_t* data) { if (size < 0) return AVERROR(EIO); - int64 available_bytes = size_ - position_; + int64_t available_bytes = size_ - position_; if (size > available_bytes) size = available_bytes; @@ -34,7 +34,7 @@ int InMemoryUrlProtocol::Read(int size, uint8* data) { return size; } -bool InMemoryUrlProtocol::GetPosition(int64* position_out) { +bool InMemoryUrlProtocol::GetPosition(int64_t* position_out) { if (!position_out) return false; @@ -42,14 +42,14 @@ bool InMemoryUrlProtocol::GetPosition(int64* position_out) { return true; } -bool InMemoryUrlProtocol::SetPosition(int64 position) { +bool InMemoryUrlProtocol::SetPosition(int64_t position) { if (position < 0 || position > size_) return false; position_ = position; return true; } -bool InMemoryUrlProtocol::GetSize(int64* size_out) { +bool InMemoryUrlProtocol::GetSize(int64_t* size_out) { if (!size_out) return false; diff --git a/media/filters/in_memory_url_protocol.h b/media/filters/in_memory_url_protocol.h index 02d09d4..f4b8fa4 100644 --- a/media/filters/in_memory_url_protocol.h +++ b/media/filters/in_memory_url_protocol.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_ #define MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "media/filters/ffmpeg_glue.h" @@ -18,20 +17,20 @@ namespace media { // this object. class MEDIA_EXPORT InMemoryUrlProtocol : public FFmpegURLProtocol { public: - InMemoryUrlProtocol(const uint8* buf, int64 size, bool streaming); + InMemoryUrlProtocol(const uint8_t* buf, int64_t size, bool streaming); virtual ~InMemoryUrlProtocol(); // FFmpegURLProtocol methods. - int Read(int size, uint8* data) override; - bool GetPosition(int64* position_out) override; - bool SetPosition(int64 position) override; - bool GetSize(int64* size_out) override; + int Read(int size, uint8_t* data) override; + bool GetPosition(int64_t* position_out) override; + bool SetPosition(int64_t position) override; + bool GetSize(int64_t* size_out) override; bool IsStreaming() override; private: - const uint8* data_; - int64 size_; - int64 position_; + const uint8_t* data_; + int64_t size_; + int64_t position_; bool streaming_; DISALLOW_IMPLICIT_CONSTRUCTORS(InMemoryUrlProtocol); diff --git a/media/filters/in_memory_url_protocol_unittest.cc b/media/filters/in_memory_url_protocol_unittest.cc index 7b615cd..7f4a964 100644 --- a/media/filters/in_memory_url_protocol_unittest.cc +++ b/media/filters/in_memory_url_protocol_unittest.cc @@ -8,12 +8,13 @@ namespace media { -static const uint8 kData[] = { 0x01, 0x02, 0x03, 0x04 }; +static const uint8_t kData[] = {0x01, 0x02, 0x03, 0x04}; TEST(InMemoryUrlProtocolTest, ReadFromLargeBuffer) { - InMemoryUrlProtocol protocol(kData, std::numeric_limits<int64>::max(), false); + InMemoryUrlProtocol protocol(kData, std::numeric_limits<int64_t>::max(), + false); - uint8 out[sizeof(kData)]; + uint8_t out[sizeof(kData)]; EXPECT_EQ(4, protocol.Read(sizeof(out), out)); EXPECT_EQ(0, memcmp(out, kData, sizeof(out))); } @@ -21,14 +22,14 @@ TEST(InMemoryUrlProtocolTest, ReadFromLargeBuffer) { TEST(InMemoryUrlProtocolTest, ReadWithNegativeSize) { InMemoryUrlProtocol protocol(kData, sizeof(kData), false); - uint8 out[sizeof(kData)]; + uint8_t out[sizeof(kData)]; EXPECT_EQ(AVERROR(EIO), protocol.Read(-2, out)); } TEST(InMemoryUrlProtocolTest, ReadWithZeroSize) { InMemoryUrlProtocol protocol(kData, sizeof(kData), false); - uint8 out; + uint8_t out; EXPECT_EQ(0, protocol.Read(0, &out)); } @@ -38,7 +39,7 @@ TEST(InMemoryUrlProtocolTest, SetPosition) { EXPECT_FALSE(protocol.SetPosition(-1)); EXPECT_FALSE(protocol.SetPosition(sizeof(kData) + 1)); - uint8 out; + uint8_t out; EXPECT_TRUE(protocol.SetPosition(sizeof(kData))); EXPECT_EQ(0, protocol.Read(1, &out)); diff --git a/media/filters/opus_audio_decoder.cc b/media/filters/opus_audio_decoder.cc index 2fd9950..429ef1f 100644 --- a/media/filters/opus_audio_decoder.cc +++ b/media/filters/opus_audio_decoder.cc @@ -20,8 +20,10 @@ namespace media { -static uint16 ReadLE16(const uint8* data, size_t data_size, int read_offset) { - uint16 value = 0; +static uint16_t ReadLE16(const uint8_t* data, + size_t data_size, + int read_offset) { + uint16_t value = 0; DCHECK_LE(read_offset + sizeof(value), data_size); memcpy(&value, data + read_offset, sizeof(value)); return base::ByteSwapToLE16(value); @@ -33,14 +35,14 @@ static uint16 ReadLE16(const uint8* data, size_t data_size, int read_offset) { // Maximum packet size used in Xiph's opusdec and FFmpeg's libopusdec. static const int kMaxOpusOutputPacketSizeSamples = 960 * 6; -static void RemapOpusChannelLayout(const uint8* opus_mapping, +static void RemapOpusChannelLayout(const uint8_t* opus_mapping, int num_channels, - uint8* channel_layout) { + uint8_t* channel_layout) { DCHECK_LE(num_channels, OPUS_MAX_VORBIS_CHANNELS); // Reorder the channels to produce the same ordering as FFmpeg, which is // what the pipeline expects. - const uint8* vorbis_layout_offset = + const uint8_t* vorbis_layout_offset = kFFmpegChannelDecodingLayouts[num_channels - 1]; for (int channel = 0; channel < num_channels; ++channel) channel_layout[channel] = opus_mapping[vorbis_layout_offset[channel]]; @@ -59,18 +61,19 @@ struct OpusExtraData { OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); } int channels; - uint16 skip_samples; + uint16_t skip_samples; int channel_mapping; int num_streams; int num_coupled; - int16 gain_db; - uint8 stream_map[OPUS_MAX_VORBIS_CHANNELS]; + int16_t gain_db; + uint8_t stream_map[OPUS_MAX_VORBIS_CHANNELS]; }; // Returns true when able to successfully parse and store Opus extra data in // |extra_data|. Based on opus header parsing code in libopusdec from FFmpeg, // and opus_header from Xiph's opus-tools project. -static bool ParseOpusExtraData(const uint8* data, int data_size, +static bool ParseOpusExtraData(const uint8_t* data, + int data_size, const AudioDecoderConfig& config, OpusExtraData* extra_data) { if (data_size < OPUS_EXTRADATA_SIZE) { @@ -89,8 +92,8 @@ static bool ParseOpusExtraData(const uint8* data, int data_size, extra_data->skip_samples = ReadLE16(data, data_size, OPUS_EXTRADATA_SKIP_SAMPLES_OFFSET); - extra_data->gain_db = - static_cast<int16>(ReadLE16(data, data_size, OPUS_EXTRADATA_GAIN_OFFSET)); + extra_data->gain_db = static_cast<int16_t>( + ReadLE16(data, data_size, OPUS_EXTRADATA_GAIN_OFFSET)); extra_data->channel_mapping = *(data + OPUS_EXTRADATA_CHANNEL_MAPPING_OFFSET); @@ -267,7 +270,7 @@ bool OpusAudioDecoder::ConfigureDecoder() { config_.seek_preroll(), opus_extra_data.skip_samples); } - uint8 channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; + uint8_t channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; memcpy(&channel_mapping, kDefaultOpusChannelLayout, OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); diff --git a/media/filters/opus_constants.h b/media/filters/opus_constants.h index f5ccad0..0def7c69 100644 --- a/media/filters/opus_constants.h +++ b/media/filters/opus_constants.h @@ -69,7 +69,7 @@ enum { // count, coupling information, and per channel mapping values: // - Byte 0: Number of streams. // - Byte 1: Number coupled. - // - Byte 2: Starting at byte 2 are |extra_data->channels| uint8 mapping + // - Byte 2: Starting at byte 2 are |extra_data->channels| uint8_t mapping // values. OPUS_EXTRADATA_NUM_STREAMS_OFFSET = OPUS_EXTRADATA_SIZE, OPUS_EXTRADATA_NUM_COUPLED_OFFSET = OPUS_EXTRADATA_NUM_STREAMS_OFFSET + 1, diff --git a/media/filters/source_buffer_platform.h b/media/filters/source_buffer_platform.h index 7feb05b..09a3f07 100644 --- a/media/filters/source_buffer_platform.h +++ b/media/filters/source_buffer_platform.h @@ -5,7 +5,8 @@ #ifndef MEDIA_FILTERS_SOURCE_BUFFER_PLATFORM_H_ #define MEDIA_FILTERS_SOURCE_BUFFER_PLATFORM_H_ -#include "base/basictypes.h" +#include <stddef.h> + #include "media/base/media_export.h" namespace media { diff --git a/media/filters/source_buffer_range.h b/media/filters/source_buffer_range.h index 13ba873..32a8321 100644 --- a/media/filters/source_buffer_range.h +++ b/media/filters/source_buffer_range.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "media/base/stream_parser_buffer.h" diff --git a/media/filters/source_buffer_stream.h b/media/filters/source_buffer_stream.h index 3c727d7..4a6d435 100644 --- a/media/filters/source_buffer_stream.h +++ b/media/filters/source_buffer_stream.h @@ -16,7 +16,6 @@ #include <utility> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/base/audio_decoder_config.h" #include "media/base/media_export.h" diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index adb3ada..808ec09 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc @@ -34,8 +34,8 @@ typedef StreamParser::BufferQueue BufferQueue; static const int kDefaultFramesPerSecond = 30; static const int kDefaultKeyframesPerSecond = 6; -static const uint8 kDataA = 0x11; -static const uint8 kDataB = 0x33; +static const uint8_t kDataA = 0x11; +static const uint8_t kDataB = 0x33; static const int kDataSize = 1; // Matchers for verifying common media log entry strings. @@ -118,8 +118,9 @@ class SourceBufferStreamTest : public testing::Test { base::TimeDelta(), true, &kDataA, kDataSize); } - void NewSegmentAppend(int starting_position, int number_of_buffers, - const uint8* data) { + void NewSegmentAppend(int starting_position, + int number_of_buffers, + const uint8_t* data) { AppendBuffers(starting_position, number_of_buffers, true, base::TimeDelta(), true, data, kDataSize); } @@ -142,8 +143,9 @@ class SourceBufferStreamTest : public testing::Test { base::TimeDelta(), true, &kDataA, kDataSize); } - void AppendBuffers(int starting_position, int number_of_buffers, - const uint8* data) { + void AppendBuffers(int starting_position, + int number_of_buffers, + const uint8_t* data) { AppendBuffers(starting_position, number_of_buffers, false, base::TimeDelta(), true, data, kDataSize); } @@ -220,8 +222,8 @@ class SourceBufferStreamTest : public testing::Test { std::stringstream ss; ss << "{ "; for (size_t i = 0; i < r.size(); ++i) { - int64 start = (r.start(i) / frame_duration_); - int64 end = (r.end(i) / frame_duration_) - 1; + int64_t start = (r.start(i) / frame_duration_); + int64_t end = (r.end(i) / frame_duration_) - 1; ss << "[" << start << "," << end << ") "; } ss << "}"; @@ -234,8 +236,8 @@ class SourceBufferStreamTest : public testing::Test { std::stringstream ss; ss << "{ "; for (size_t i = 0; i < r.size(); ++i) { - int64 start = r.start(i).InMilliseconds(); - int64 end = r.end(i).InMilliseconds(); + int64_t start = r.start(i).InMilliseconds(); + int64_t end = r.end(i).InMilliseconds(); ss << "[" << start << "," << end << ") "; } ss << "}"; @@ -253,22 +255,26 @@ class SourceBufferStreamTest : public testing::Test { NULL, 0); } - void CheckExpectedBuffers( - int starting_position, int ending_position, const uint8* data) { + void CheckExpectedBuffers(int starting_position, + int ending_position, + const uint8_t* data) { CheckExpectedBuffers(starting_position, ending_position, false, data, kDataSize); } - void CheckExpectedBuffers( - int starting_position, int ending_position, const uint8* data, - bool expect_keyframe) { + void CheckExpectedBuffers(int starting_position, + int ending_position, + const uint8_t* data, + bool expect_keyframe) { CheckExpectedBuffers(starting_position, ending_position, expect_keyframe, data, kDataSize); } - void CheckExpectedBuffers( - int starting_position, int ending_position, bool expect_keyframe, - const uint8* expected_data, int expected_size) { + void CheckExpectedBuffers(int starting_position, + int ending_position, + bool expect_keyframe, + const uint8_t* expected_data, + int expected_size) { int current_position = starting_position; for (; current_position <= ending_position; current_position++) { scoped_refptr<StreamParserBuffer> buffer; @@ -282,7 +288,7 @@ class SourceBufferStreamTest : public testing::Test { EXPECT_TRUE(buffer->is_key_frame()); if (expected_data) { - const uint8* actual_data = buffer->data(); + const uint8_t* actual_data = buffer->data(); const int actual_size = buffer->data_size(); EXPECT_EQ(expected_size, actual_size); for (int i = 0; i < std::min(actual_size, expected_size); i++) { @@ -434,7 +440,7 @@ class SourceBufferStreamTest : public testing::Test { bool begin_media_segment, base::TimeDelta first_buffer_offset, bool expect_success, - const uint8* data, + const uint8_t* data, int size) { if (begin_media_segment) stream_->OnNewMediaSegment(DecodeTimestamp::FromPresentationTime( @@ -1059,8 +1065,8 @@ TEST_F(SourceBufferStreamTest, Complete_Overlap_Selected_EdgeCase) { } TEST_F(SourceBufferStreamTest, Complete_Overlap_Selected_Multiple) { - static const uint8 kDataC = 0x55; - static const uint8 kDataD = 0x77; + static const uint8_t kDataC = 0x55; + static const uint8_t kDataD = 0x77; // Append 5 buffers at positions 5 through 9. NewSegmentAppend(5, 5, &kDataA); diff --git a/media/filters/video_renderer_algorithm.cc b/media/filters/video_renderer_algorithm.cc index 03ca751..230c464 100644 --- a/media/filters/video_renderer_algorithm.cc +++ b/media/filters/video_renderer_algorithm.cc @@ -426,7 +426,7 @@ void VideoRendererAlgorithm::AccountForMissedIntervals( } DCHECK_GT(render_interval_, base::TimeDelta()); - const int64 render_cycle_count = + const int64_t render_cycle_count = (deadline_min - last_deadline_max_) / render_interval_; // In the ideal case this value will be zero. diff --git a/media/filters/vp8_bool_decoder.h b/media/filters/vp8_bool_decoder.h index cea701b..50cbb44 100644 --- a/media/filters/vp8_bool_decoder.h +++ b/media/filters/vp8_bool_decoder.h @@ -45,7 +45,6 @@ #include <sys/types.h> -#include "base/basictypes.h" #include "base/logging.h" #include "media/base/media_export.h" diff --git a/media/filters/vpx_video_decoder.cc b/media/filters/vpx_video_decoder.cc index 1e041e6..4a3f66c 100644 --- a/media/filters/vpx_video_decoder.cc +++ b/media/filters/vpx_video_decoder.cc @@ -111,15 +111,16 @@ class VpxVideoDecoder::MemoryPool // |min_size| Minimum size needed by libvpx to decompress the next frame. // |fb| Pointer to the frame buffer to update. // Returns 0 on success. Returns < 0 on failure. - static int32 GetVP9FrameBuffer(void* user_priv, size_t min_size, - vpx_codec_frame_buffer* fb); + static int32_t GetVP9FrameBuffer(void* user_priv, + size_t min_size, + vpx_codec_frame_buffer* fb); // Callback that will be called by libvpx when the frame buffer is no longer // being used by libvpx. Parameters: // |user_priv| Private data passed to libvpx (pointer to memory pool). // |fb| Pointer to the frame buffer that's being released. - static int32 ReleaseVP9FrameBuffer(void* user_priv, - vpx_codec_frame_buffer* fb); + static int32_t ReleaseVP9FrameBuffer(void* user_priv, + vpx_codec_frame_buffer* fb); // Generates a "no_longer_needed" closure that holds a reference to this pool. base::Closure CreateFrameCallback(void* fb_priv_data); @@ -140,8 +141,8 @@ class VpxVideoDecoder::MemoryPool // before a buffer can be re-used. struct VP9FrameBuffer { VP9FrameBuffer() : ref_cnt(0) {} - std::vector<uint8> data; - uint32 ref_cnt; + std::vector<uint8_t> data; + uint32_t ref_cnt; }; // Gets the next available frame buffer for use by libvpx. @@ -193,8 +194,10 @@ VpxVideoDecoder::MemoryPool::GetFreeFrameBuffer(size_t min_size) { return frame_buffers_[i]; } -int32 VpxVideoDecoder::MemoryPool::GetVP9FrameBuffer( - void* user_priv, size_t min_size, vpx_codec_frame_buffer* fb) { +int32_t VpxVideoDecoder::MemoryPool::GetVP9FrameBuffer( + void* user_priv, + size_t min_size, + vpx_codec_frame_buffer* fb) { DCHECK(user_priv); DCHECK(fb); @@ -215,7 +218,7 @@ int32 VpxVideoDecoder::MemoryPool::GetVP9FrameBuffer( return 0; } -int32 VpxVideoDecoder::MemoryPool::ReleaseVP9FrameBuffer( +int32_t VpxVideoDecoder::MemoryPool::ReleaseVP9FrameBuffer( void* user_priv, vpx_codec_frame_buffer* fb) { DCHECK(user_priv); @@ -436,7 +439,7 @@ bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, DCHECK(video_frame); DCHECK(!buffer->end_of_stream()); - int64 timestamp = buffer->timestamp().InMicroseconds(); + int64_t timestamp = buffer->timestamp().InMicroseconds(); void* user_priv = reinterpret_cast<void*>(×tamp); { TRACE_EVENT1("video", "vpx_codec_decode", "timestamp", timestamp); @@ -485,7 +488,7 @@ bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, if (buffer->side_data_size() < 8) { // TODO(mcasas): Is this a warning or an error? DLOG(WARNING) << "Making Alpha channel opaque due to missing input"; - const uint32 kAlphaOpaqueValue = 255; + const uint32_t kAlphaOpaqueValue = 255; libyuv::SetPlane((*video_frame)->visible_data(VideoFrame::kAPlane), (*video_frame)->stride(VideoFrame::kAPlane), (*video_frame)->visible_rect().width(), @@ -495,13 +498,13 @@ bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, } // First 8 bytes of side data is |side_data_id| in big endian. - const uint64 side_data_id = base::NetToHost64( - *(reinterpret_cast<const uint64*>(buffer->side_data()))); + const uint64_t side_data_id = base::NetToHost64( + *(reinterpret_cast<const uint64_t*>(buffer->side_data()))); if (side_data_id != 1) return true; // Try and decode buffer->side_data() minus the first 8 bytes as a full frame. - int64 timestamp_alpha = buffer->timestamp().InMicroseconds(); + int64_t timestamp_alpha = buffer->timestamp().InMicroseconds(); void* user_priv_alpha = reinterpret_cast<void*>(×tamp_alpha); { TRACE_EVENT1("video", "vpx_codec_decode_alpha", "timestamp_alpha", diff --git a/media/filters/webvtt_util.h b/media/filters/webvtt_util.h index b71b66f..d5ffa73 100644 --- a/media/filters/webvtt_util.h +++ b/media/filters/webvtt_util.h @@ -10,10 +10,12 @@ namespace media { // Utility function to create side data item for decoder buffer. -template<typename T> -void MakeSideData(T id_begin, T id_end, - T settings_begin, T settings_end, - std::vector<uint8>* side_data) { +template <typename T> +void MakeSideData(T id_begin, + T id_end, + T settings_begin, + T settings_end, + std::vector<uint8_t>* side_data) { // The DecoderBuffer only supports a single side data item. In the case of // a WebVTT cue, we can have potentially two side data items. In order to // avoid disrupting DecoderBuffer any more than we need to, we copy both diff --git a/media/formats/common/offset_byte_queue.cc b/media/formats/common/offset_byte_queue.cc index 0bbff80..032ac1f 100644 --- a/media/formats/common/offset_byte_queue.cc +++ b/media/formats/common/offset_byte_queue.cc @@ -18,13 +18,13 @@ void OffsetByteQueue::Reset() { head_ = 0; } -void OffsetByteQueue::Push(const uint8* buf, int size) { +void OffsetByteQueue::Push(const uint8_t* buf, int size) { queue_.Push(buf, size); Sync(); DVLOG(4) << "Buffer pushed. head=" << head() << " tail=" << tail(); } -void OffsetByteQueue::Peek(const uint8** buf, int* size) { +void OffsetByteQueue::Peek(const uint8_t** buf, int* size) { *buf = size_ > 0 ? buf_ : NULL; *size = size_; } @@ -35,7 +35,7 @@ void OffsetByteQueue::Pop(int count) { Sync(); } -void OffsetByteQueue::PeekAt(int64 offset, const uint8** buf, int* size) { +void OffsetByteQueue::PeekAt(int64_t offset, const uint8_t** buf, int* size) { DCHECK(offset >= head()); if (offset < head() || offset >= tail()) { *buf = NULL; @@ -46,7 +46,7 @@ void OffsetByteQueue::PeekAt(int64 offset, const uint8** buf, int* size) { *size = tail() - offset; } -bool OffsetByteQueue::Trim(int64 max_offset) { +bool OffsetByteQueue::Trim(int64_t max_offset) { if (max_offset < head_) return true; if (max_offset > tail()) { Pop(size_); diff --git a/media/formats/common/offset_byte_queue.h b/media/formats/common/offset_byte_queue.h index 0996f07..326609d4 100644 --- a/media/formats/common/offset_byte_queue.h +++ b/media/formats/common/offset_byte_queue.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FORMATS_COMMON_OFFSET_BYTE_QUEUE_H_ #define MEDIA_FORMATS_COMMON_OFFSET_BYTE_QUEUE_H_ -#include "base/basictypes.h" #include "media/base/byte_queue.h" #include "media/base/media_export.h" @@ -22,8 +21,8 @@ class MEDIA_EXPORT OffsetByteQueue { // These work like their underlying ByteQueue counterparts. void Reset(); - void Push(const uint8* buf, int size); - void Peek(const uint8** buf, int* size); + void Push(const uint8_t* buf, int size); + void Peek(const uint8_t** buf, int* size); void Pop(int count); // Sets |buf| to point at the first buffered byte corresponding to |offset|, @@ -32,7 +31,7 @@ class MEDIA_EXPORT OffsetByteQueue { // It is an error if the offset is before the current head. It's not an error // if the current offset is beyond tail(), but you will of course get back // a null |buf| and a |size| of zero. - void PeekAt(int64 offset, const uint8** buf, int* size); + void PeekAt(int64_t offset, const uint8_t** buf, int* size); // Marks the bytes up to (but not including) |max_offset| as ready for // deletion. This is relatively inexpensive, but will not necessarily reduce @@ -42,21 +41,21 @@ class MEDIA_EXPORT OffsetByteQueue { // including the case where |max_offset| is less than the current head. // Returns false if |max_offset| > tail() (although all bytes currently // buffered are still cleared). - bool Trim(int64 max_offset); + bool Trim(int64_t max_offset); // The head and tail positions, in terms of the file's absolute offsets. // tail() is an exclusive bound. - int64 head() { return head_; } - int64 tail() { return head_ + size_; } + int64_t head() { return head_; } + int64_t tail() { return head_ + size_; } private: // Synchronize |buf_| and |size_| with |queue_|. void Sync(); ByteQueue queue_; - const uint8* buf_; + const uint8_t* buf_; int size_; - int64 head_; + int64_t head_; DISALLOW_COPY_AND_ASSIGN(OffsetByteQueue); }; diff --git a/media/formats/common/offset_byte_queue_unittest.cc b/media/formats/common/offset_byte_queue_unittest.cc index ee5914d..574def0 100644 --- a/media/formats/common/offset_byte_queue_unittest.cc +++ b/media/formats/common/offset_byte_queue_unittest.cc @@ -4,7 +4,6 @@ #include <string.h> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/formats/common/offset_byte_queue.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +13,7 @@ namespace media { class OffsetByteQueueTest : public testing::Test { public: void SetUp() override { - uint8 buf[256]; + uint8_t buf[256]; for (int i = 0; i < 256; i++) { buf[i] = i; } @@ -35,7 +34,7 @@ TEST_F(OffsetByteQueueTest, SetUp) { EXPECT_EQ(384, queue_->head()); EXPECT_EQ(512, queue_->tail()); - const uint8* buf; + const uint8_t* buf; int size; queue_->Peek(&buf, &size); @@ -45,7 +44,7 @@ TEST_F(OffsetByteQueueTest, SetUp) { } TEST_F(OffsetByteQueueTest, PeekAt) { - const uint8* buf; + const uint8_t* buf; int size; queue_->PeekAt(400, &buf, &size); @@ -67,7 +66,7 @@ TEST_F(OffsetByteQueueTest, Trim) { EXPECT_EQ(400, queue_->head()); EXPECT_EQ(512, queue_->tail()); - const uint8* buf; + const uint8_t* buf; int size; queue_->PeekAt(400, &buf, &size); EXPECT_EQ(queue_->tail() - 400, size); diff --git a/media/formats/common/stream_parser_test_base.cc b/media/formats/common/stream_parser_test_base.cc index b6555b9..29ca747 100644 --- a/media/formats/common/stream_parser_test_base.cc +++ b/media/formats/common/stream_parser_test_base.cc @@ -52,17 +52,18 @@ std::string StreamParserTestBase::ParseFile(const std::string& filename, return results_stream_.str(); } -std::string StreamParserTestBase::ParseData(const uint8* data, size_t length) { +std::string StreamParserTestBase::ParseData(const uint8_t* data, + size_t length) { results_stream_.clear(); EXPECT_TRUE(AppendDataInPieces(data, length, length)); return results_stream_.str(); } -bool StreamParserTestBase::AppendDataInPieces(const uint8* data, +bool StreamParserTestBase::AppendDataInPieces(const uint8_t* data, size_t length, size_t piece_size) { - const uint8* start = data; - const uint8* end = data + length; + const uint8_t* start = data; + const uint8_t* end = data + length; while (start < end) { size_t append_size = std::min(piece_size, static_cast<size_t>(end - start)); if (!parser_->Parse(start, append_size)) @@ -109,7 +110,7 @@ bool StreamParserTestBase::OnNewBuffers( } void StreamParserTestBase::OnKeyNeeded(EmeInitDataType type, - const std::vector<uint8>& init_data) { + const std::vector<uint8_t>& init_data) { DVLOG(1) << __FUNCTION__ << "(" << static_cast<int>(type) << ", " << init_data.size() << ")"; } diff --git a/media/formats/common/stream_parser_test_base.h b/media/formats/common/stream_parser_test_base.h index ea61dd3..f9e483a 100644 --- a/media/formats/common/stream_parser_test_base.h +++ b/media/formats/common/stream_parser_test_base.h @@ -41,7 +41,7 @@ class StreamParserTestBase { // Similar to ParseFile() except parses the given |data| in a single append of // size |length|. - std::string ParseData(const uint8* data, size_t length); + std::string ParseData(const uint8_t* data, size_t length); // The last AudioDecoderConfig handed to OnNewConfig(). const AudioDecoderConfig& last_audio_config() const { @@ -49,7 +49,9 @@ class StreamParserTestBase { } private: - bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size); + bool AppendDataInPieces(const uint8_t* data, + size_t length, + size_t piece_size); void OnInitDone(const StreamParser::InitParameters& params); bool OnNewConfig(const AudioDecoderConfig& audio_config, const VideoDecoderConfig& video_config, @@ -57,7 +59,7 @@ class StreamParserTestBase { bool OnNewBuffers(const StreamParser::BufferQueue& audio_buffers, const StreamParser::BufferQueue& video_buffers, const StreamParser::TextBufferQueueMap& text_map); - void OnKeyNeeded(EmeInitDataType type, const std::vector<uint8>& init_data); + void OnKeyNeeded(EmeInitDataType type, const std::vector<uint8_t>& init_data); void OnNewSegment(); void OnEndOfSegment(); diff --git a/media/formats/mp2t/es_adapter_video.h b/media/formats/mp2t/es_adapter_video.h index f231169..50c162e 100644 --- a/media/formats/mp2t/es_adapter_video.h +++ b/media/formats/mp2t/es_adapter_video.h @@ -54,7 +54,7 @@ class MEDIA_EXPORT EsAdapterVideo { private: typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; - typedef std::pair<int64, VideoDecoderConfig> ConfigEntry; + typedef std::pair<int64_t, VideoDecoderConfig> ConfigEntry; void ProcessPendingBuffers(bool flush); @@ -80,7 +80,7 @@ class MEDIA_EXPORT EsAdapterVideo { std::list<ConfigEntry> config_list_; // Global index of the first buffer in |buffer_list_|. - int64 buffer_index_; + int64_t buffer_index_; // List of buffer to be emitted and PTS of frames already emitted. BufferQueue buffer_list_; diff --git a/media/formats/mp2t/es_adapter_video_unittest.cc b/media/formats/mp2t/es_adapter_video_unittest.cc index 24feb85..eced6f3 100644 --- a/media/formats/mp2t/es_adapter_video_unittest.cc +++ b/media/formats/mp2t/es_adapter_video_unittest.cc @@ -35,7 +35,7 @@ StreamParserBuffer::BufferQueue GenerateFakeBuffers(const int* frame_pts_ms, const bool* is_key_frame, size_t frame_count) { - uint8 dummy_buffer[] = {0, 0, 0, 0}; + uint8_t dummy_buffer[] = {0, 0, 0, 0}; StreamParserBuffer::BufferQueue buffers(frame_count); for (size_t k = 0; k < frame_count; k++) { diff --git a/media/formats/mp2t/es_parser.cc b/media/formats/mp2t/es_parser.cc index cdd6e07..7512c0b 100644 --- a/media/formats/mp2t/es_parser.cc +++ b/media/formats/mp2t/es_parser.cc @@ -28,7 +28,8 @@ EsParser::EsParser() EsParser::~EsParser() { } -bool EsParser::Parse(const uint8* buf, int size, +bool EsParser::Parse(const uint8_t* buf, + int size, base::TimeDelta pts, DecodeTimestamp dts) { DCHECK(buf); @@ -38,7 +39,7 @@ bool EsParser::Parse(const uint8* buf, int size, // Link the end of the byte queue with the incoming timing descriptor. TimingDesc timing_desc(dts, pts); timing_desc_list_.push_back( - std::pair<int64, TimingDesc>(es_queue_->tail(), timing_desc)); + std::pair<int64_t, TimingDesc>(es_queue_->tail(), timing_desc)); } // Add the incoming bytes to the ES queue. @@ -52,7 +53,7 @@ void EsParser::Reset() { ResetInternal(); } -EsParser::TimingDesc EsParser::GetTimingDescriptor(int64 es_byte_count) { +EsParser::TimingDesc EsParser::GetTimingDescriptor(int64_t es_byte_count) { TimingDesc timing_desc; while (!timing_desc_list_.empty() && timing_desc_list_.front().first <= es_byte_count) { diff --git a/media/formats/mp2t/es_parser.h b/media/formats/mp2t/es_parser.h index b22fe5d..591c115 100644 --- a/media/formats/mp2t/es_parser.h +++ b/media/formats/mp2t/es_parser.h @@ -8,7 +8,6 @@ #include <list> #include <utility> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" @@ -31,7 +30,8 @@ class MEDIA_EXPORT EsParser { // ES parsing. // Should use kNoTimestamp when a timestamp is not valid. - bool Parse(const uint8* buf, int size, + bool Parse(const uint8_t* buf, + int size, base::TimeDelta pts, DecodeTimestamp dts); @@ -62,7 +62,7 @@ class MEDIA_EXPORT EsParser { // This timing descriptor and all the ones that come before (in stream order) // are removed from list |timing_desc_list_|. // If no timing descriptor is found, then the default TimingDesc is returned. - TimingDesc GetTimingDescriptor(int64 es_byte_count); + TimingDesc GetTimingDescriptor(int64_t es_byte_count); // Bytes of the ES stream that have not been emitted yet. scoped_ptr<media::OffsetByteQueue> es_queue_; @@ -79,7 +79,7 @@ class MEDIA_EXPORT EsParser { // in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 video, if a PTS is // present in the PES packet header, it shall refer to the first AVC access // unit that commences in this PES packet. - std::list<std::pair<int64, TimingDesc> > timing_desc_list_; + std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_; DISALLOW_COPY_AND_ASSIGN(EsParser); }; diff --git a/media/formats/mp2t/es_parser_adts.cc b/media/formats/mp2t/es_parser_adts.cc index adf1dbe..a32d9f1 100644 --- a/media/formats/mp2t/es_parser_adts.cc +++ b/media/formats/mp2t/es_parser_adts.cc @@ -6,7 +6,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "media/base/audio_timestamp_helper.h" @@ -20,24 +19,24 @@ namespace media { -static int ExtractAdtsFrameSize(const uint8* adts_header) { +static int ExtractAdtsFrameSize(const uint8_t* adts_header) { return ((static_cast<int>(adts_header[5]) >> 5) | (static_cast<int>(adts_header[4]) << 3) | ((static_cast<int>(adts_header[3]) & 0x3) << 11)); } -static size_t ExtractAdtsFrequencyIndex(const uint8* adts_header) { +static size_t ExtractAdtsFrequencyIndex(const uint8_t* adts_header) { return ((adts_header[2] >> 2) & 0xf); } -static size_t ExtractAdtsChannelConfig(const uint8* adts_header) { +static size_t ExtractAdtsChannelConfig(const uint8_t* adts_header) { return (((adts_header[3] >> 6) & 0x3) | ((adts_header[2] & 0x1) << 2)); } // Return true if buf corresponds to an ADTS syncword. // |buf| size must be at least 2. -static bool isAdtsSyncWord(const uint8* buf) { +static bool isAdtsSyncWord(const uint8_t* buf) { // The first 12 bits must be 1. // The layer field (2 bits) must be set to 0. return (buf[0] == 0xff) && ((buf[1] & 0xf6) == 0xf0); @@ -47,18 +46,18 @@ namespace mp2t { struct EsParserAdts::AdtsFrame { // Pointer to the ES data. - const uint8* data; + const uint8_t* data; // Frame size; int size; // Frame offset in the ES queue. - int64 queue_offset; + int64_t queue_offset; }; bool EsParserAdts::LookForAdtsFrame(AdtsFrame* adts_frame) { int es_size; - const uint8* es; + const uint8_t* es; es_queue_->Peek(&es, &es_size); int max_offset = es_size - kADTSHeaderMinSize; @@ -66,7 +65,7 @@ bool EsParserAdts::LookForAdtsFrame(AdtsFrame* adts_frame) { return false; for (int offset = 0; offset < max_offset; offset++) { - const uint8* cur_buf = &es[offset]; + const uint8_t* cur_buf = &es[offset]; if (!isAdtsSyncWord(cur_buf)) continue; @@ -182,7 +181,7 @@ void EsParserAdts::ResetInternal() { last_audio_decoder_config_ = AudioDecoderConfig(); } -bool EsParserAdts::UpdateAudioConfiguration(const uint8* adts_header) { +bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_header) { size_t frequency_index = ExtractAdtsFrequencyIndex(adts_header); if (frequency_index >= kADTSFrequencyTableSize) { // Frequency index 13 & 14 are reserved @@ -213,7 +212,7 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8* adts_header) { // The following code is written according to ISO 14496 Part 3 Table 1.13 - // Syntax of AudioSpecificConfig. - uint16 extra_data_int = static_cast<uint16>( + uint16_t extra_data_int = static_cast<uint16_t>( // Note: adts_profile is in the range [0,3], since the ADTS header only // allows two bits for its value. ((adts_profile + 1) << 11) + @@ -222,8 +221,8 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8* adts_header) { // channel_configuration is [0..7], per early out above. (channel_configuration << 3)); std::vector<uint8_t> extra_data; - extra_data.push_back(static_cast<uint8>(extra_data_int >> 8)); - extra_data.push_back(static_cast<uint8>(extra_data_int & 0xff)); + extra_data.push_back(static_cast<uint8_t>(extra_data_int >> 8)); + extra_data.push_back(static_cast<uint8_t>(extra_data_int & 0xff)); AudioDecoderConfig audio_decoder_config( kCodecAAC, diff --git a/media/formats/mp2t/es_parser_adts.h b/media/formats/mp2t/es_parser_adts.h index 740e3ba..87b1aad 100644 --- a/media/formats/mp2t/es_parser_adts.h +++ b/media/formats/mp2t/es_parser_adts.h @@ -58,7 +58,7 @@ class MEDIA_EXPORT EsParserAdts : public EsParser { // Signal any audio configuration change (if any). // Return false if the current audio config is not // a supported ADTS audio config. - bool UpdateAudioConfiguration(const uint8* adts_header); + bool UpdateAudioConfiguration(const uint8_t* adts_header); // Callbacks: // - to signal a new audio configuration, diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc index 8c59112..793e2aa 100644 --- a/media/formats/mp2t/es_parser_h264.cc +++ b/media/formats/mp2t/es_parser_h264.cc @@ -41,7 +41,7 @@ void EsParserH264::Flush() { // Simulate an additional AUD to force emitting the last access unit // which is assumed to be complete at this point. - uint8 aud[] = { 0x00, 0x00, 0x01, 0x09 }; + uint8_t aud[] = {0x00, 0x00, 0x01, 0x09}; es_queue_->Push(aud, sizeof(aud)); ParseFromEsQueue(); @@ -57,9 +57,9 @@ void EsParserH264::ResetInternal() { es_adapter_.Reset(); } -bool EsParserH264::FindAUD(int64* stream_pos) { +bool EsParserH264::FindAUD(int64_t* stream_pos) { while (true) { - const uint8* es; + const uint8_t* es; int size; es_queue_->PeekAt(*stream_pos, &es, &size); @@ -120,10 +120,10 @@ bool EsParserH264::ParseFromEsQueue() { bool is_key_frame = false; int pps_id_for_access_unit = -1; - const uint8* es; + const uint8_t* es; int size; es_queue_->PeekAt(current_access_unit_pos_, &es, &size); - int access_unit_size = base::checked_cast<int, int64>( + int access_unit_size = base::checked_cast<int, int64_t>( next_access_unit_pos_ - current_access_unit_pos_); DCHECK_LE(access_unit_size, size); h264_parser_->SetStream(es, access_unit_size); @@ -195,8 +195,10 @@ bool EsParserH264::ParseFromEsQueue() { return true; } -bool EsParserH264::EmitFrame(int64 access_unit_pos, int access_unit_size, - bool is_key_frame, int pps_id) { +bool EsParserH264::EmitFrame(int64_t access_unit_pos, + int access_unit_size, + bool is_key_frame, + int pps_id) { // Get the access unit timing info. // Note: |current_timing_desc.pts| might be |kNoTimestamp()| at this point // if: @@ -236,7 +238,7 @@ bool EsParserH264::EmitFrame(int64 access_unit_pos, int access_unit_size, DVLOG(LOG_LEVEL_ES) << "Emit frame: stream_pos=" << current_access_unit_pos_ << " size=" << access_unit_size; int es_size; - const uint8* es; + const uint8_t* es; es_queue_->PeekAt(current_access_unit_pos_, &es, &es_size); CHECK_GE(es_size, access_unit_size); diff --git a/media/formats/mp2t/es_parser_h264.h b/media/formats/mp2t/es_parser_h264.h index b37cfc1..1a52c57 100644 --- a/media/formats/mp2t/es_parser_h264.h +++ b/media/formats/mp2t/es_parser_h264.h @@ -8,7 +8,6 @@ #include <list> #include <utility> -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" @@ -57,12 +56,14 @@ class MEDIA_EXPORT EsParserH264 : public EsParser { // If found, |*stream_pos| corresponds to the position of the AUD start code // in the stream. Otherwise, |*stream_pos| corresponds to the last position // of the start code parser. - bool FindAUD(int64* stream_pos); + bool FindAUD(int64_t* stream_pos); // Emit a frame whose position in the ES queue starts at |access_unit_pos|. // Returns true if successful, false if no PTS is available for the frame. - bool EmitFrame(int64 access_unit_pos, int access_unit_size, - bool is_key_frame, int pps_id); + bool EmitFrame(int64_t access_unit_pos, + int access_unit_size, + bool is_key_frame, + int pps_id); // Update the video decoder config based on an H264 SPS. // Return true if successful. @@ -74,8 +75,8 @@ class MEDIA_EXPORT EsParserH264 : public EsParser { // - |current_access_unit_pos_| is pointing to an annexB syncword // representing the first NALU of an H264 access unit. scoped_ptr<H264Parser> h264_parser_; - int64 current_access_unit_pos_; - int64 next_access_unit_pos_; + int64_t current_access_unit_pos_; + int64_t next_access_unit_pos_; // Last video decoder config. VideoDecoderConfig last_video_decoder_config_; diff --git a/media/formats/mp2t/es_parser_h264_unittest.cc b/media/formats/mp2t/es_parser_h264_unittest.cc index 65f9a37..c134f44 100644 --- a/media/formats/mp2t/es_parser_h264_unittest.cc +++ b/media/formats/mp2t/es_parser_h264_unittest.cc @@ -104,10 +104,10 @@ void EsParserH264Test::GetAccessUnits() { } void EsParserH264Test::InsertAUD() { - uint8 aud[] = { 0x00, 0x00, 0x01, 0x09 }; + uint8_t aud[] = {0x00, 0x00, 0x01, 0x09}; - std::vector<uint8> stream_with_aud( - stream_.size() + access_units_.size() * sizeof(aud)); + std::vector<uint8_t> stream_with_aud(stream_.size() + + access_units_.size() * sizeof(aud)); std::vector<EsParserTestBase::Packet> access_units_with_aud( access_units_.size()); diff --git a/media/formats/mp2t/es_parser_mpeg1audio.cc b/media/formats/mp2t/es_parser_mpeg1audio.cc index 81abc2b..5032887 100644 --- a/media/formats/mp2t/es_parser_mpeg1audio.cc +++ b/media/formats/mp2t/es_parser_mpeg1audio.cc @@ -6,7 +6,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -24,7 +23,7 @@ namespace mp2t { struct EsParserMpeg1Audio::Mpeg1AudioFrame { // Pointer to the ES data. - const uint8* data; + const uint8_t* data; // Frame size. int size; @@ -33,7 +32,7 @@ struct EsParserMpeg1Audio::Mpeg1AudioFrame { int sample_count; // Frame offset in the ES queue. - int64 queue_offset; + int64_t queue_offset; }; EsParserMpeg1Audio::EsParserMpeg1Audio( @@ -108,7 +107,7 @@ void EsParserMpeg1Audio::ResetInternal() { bool EsParserMpeg1Audio::LookForMpeg1AudioFrame( Mpeg1AudioFrame* mpeg1audio_frame) { int es_size; - const uint8* es; + const uint8_t* es; es_queue_->Peek(&es, &es_size); int max_offset = es_size - MPEG1AudioStreamParser::kHeaderSize; @@ -116,7 +115,7 @@ bool EsParserMpeg1Audio::LookForMpeg1AudioFrame( return false; for (int offset = 0; offset < max_offset; offset++) { - const uint8* cur_buf = &es[offset]; + const uint8_t* cur_buf = &es[offset]; if (cur_buf[0] != 0xff) continue; @@ -161,7 +160,7 @@ bool EsParserMpeg1Audio::LookForMpeg1AudioFrame( } bool EsParserMpeg1Audio::UpdateAudioConfiguration( - const uint8* mpeg1audio_header) { + const uint8_t* mpeg1audio_header) { MPEG1AudioStreamParser::Header header; if (!MPEG1AudioStreamParser::ParseHeader(media_log_, mpeg1audio_header, &header)) { diff --git a/media/formats/mp2t/es_parser_mpeg1audio.h b/media/formats/mp2t/es_parser_mpeg1audio.h index 6ffb197..d1833e6 100644 --- a/media/formats/mp2t/es_parser_mpeg1audio.h +++ b/media/formats/mp2t/es_parser_mpeg1audio.h @@ -41,7 +41,7 @@ class MEDIA_EXPORT EsParserMpeg1Audio : public EsParser { private: // Used to link a PTS with a byte position in the ES stream. - typedef std::pair<int64, base::TimeDelta> EsPts; + typedef std::pair<int64_t, base::TimeDelta> EsPts; typedef std::list<EsPts> EsPtsList; struct Mpeg1AudioFrame; @@ -61,7 +61,7 @@ class MEDIA_EXPORT EsParserMpeg1Audio : public EsParser { // Signal any audio configuration change (if any). // Return false if the current audio config is not // a supported Mpeg1 audio config. - bool UpdateAudioConfiguration(const uint8* mpeg1audio_header); + bool UpdateAudioConfiguration(const uint8_t* mpeg1audio_header); void SkipMpeg1AudioFrame(const Mpeg1AudioFrame& mpeg1audio_frame); diff --git a/media/formats/mp2t/es_parser_test_base.h b/media/formats/mp2t/es_parser_test_base.h index 433bbe1..56930d4 100644 --- a/media/formats/mp2t/es_parser_test_base.h +++ b/media/formats/mp2t/es_parser_test_base.h @@ -64,7 +64,7 @@ class EsParserTestBase { std::vector<Packet> GenerateFixedSizePesPacket(size_t pes_size); // ES stream. - std::vector<uint8> stream_; + std::vector<uint8_t> stream_; // Number of decoder configs received from the ES parser. size_t config_count_; diff --git a/media/formats/mp2t/mp2t_stream_parser.cc b/media/formats/mp2t/mp2t_stream_parser.cc index 0075e6c..37d4797 100644 --- a/media/formats/mp2t/mp2t_stream_parser.cc +++ b/media/formats/mp2t/mp2t_stream_parser.cc @@ -239,14 +239,14 @@ void Mp2tStreamParser::Flush() { timestamp_unroller_.Reset(); } -bool Mp2tStreamParser::Parse(const uint8* buf, int size) { +bool Mp2tStreamParser::Parse(const uint8_t* buf, int size) { DVLOG(1) << "Mp2tStreamParser::Parse size=" << size; // Add the data to the parser state. ts_byte_queue_.Push(buf, size); while (true) { - const uint8* ts_buffer; + const uint8_t* ts_buffer; int ts_buffer_size; ts_byte_queue_.Peek(&ts_buffer, &ts_buffer_size); if (ts_buffer_size < TsPacket::kPacketSize) diff --git a/media/formats/mp2t/mp2t_stream_parser.h b/media/formats/mp2t/mp2t_stream_parser.h index 2bd7fa5..f1aff27 100644 --- a/media/formats/mp2t/mp2t_stream_parser.h +++ b/media/formats/mp2t/mp2t_stream_parser.h @@ -40,7 +40,7 @@ class MEDIA_EXPORT Mp2tStreamParser : public StreamParser { const base::Closure& end_of_segment_cb, const scoped_refptr<MediaLog>& media_log) override; void Flush() override; - bool Parse(const uint8* buf, int size) override; + bool Parse(const uint8_t* buf, int size) override; private: typedef std::map<int, PidState*> PidMap; diff --git a/media/formats/mp2t/mp2t_stream_parser_unittest.cc b/media/formats/mp2t/mp2t_stream_parser_unittest.cc index 6663a05..9bc2b3f 100644 --- a/media/formats/mp2t/mp2t_stream_parser_unittest.cc +++ b/media/formats/mp2t/mp2t_stream_parser_unittest.cc @@ -84,13 +84,15 @@ class Mp2tStreamParserTest : public testing::Test { video_max_dts_ = kNoDecodeTimestamp(); } - bool AppendData(const uint8* data, size_t length) { + bool AppendData(const uint8_t* data, size_t length) { return parser_->Parse(data, length); } - bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { - const uint8* start = data; - const uint8* end = data + length; + bool AppendDataInPieces(const uint8_t* data, + size_t length, + size_t piece_size) { + const uint8_t* start = data; + const uint8_t* end = data + length; while (start < end) { size_t append_size = std::min(piece_size, static_cast<size_t>(end - start)); @@ -171,7 +173,8 @@ class Mp2tStreamParserTest : public testing::Test { return true; } - void OnKeyNeeded(EmeInitDataType type, const std::vector<uint8>& init_data) { + void OnKeyNeeded(EmeInitDataType type, + const std::vector<uint8_t>& init_data) { NOTREACHED() << "OnKeyNeeded not expected in the Mpeg2 TS parser"; } diff --git a/media/formats/mp2t/timestamp_unroller.cc b/media/formats/mp2t/timestamp_unroller.cc index e901b3d..83e568a 100644 --- a/media/formats/mp2t/timestamp_unroller.cc +++ b/media/formats/mp2t/timestamp_unroller.cc @@ -17,7 +17,7 @@ TimestampUnroller::TimestampUnroller() TimestampUnroller::~TimestampUnroller() { } -int64 TimestampUnroller::GetUnrolledTimestamp(int64 timestamp) { +int64_t TimestampUnroller::GetUnrolledTimestamp(int64_t timestamp) { // Mpeg2 TS timestamps have an accuracy of 33 bits. const int nbits = 33; @@ -48,17 +48,16 @@ int64 TimestampUnroller::GetUnrolledTimestamp(int64 timestamp) { // values during that process. // - possible overflows are not considered here since 64 bits on a 90kHz // timescale is way enough to represent several years of playback. - int64 previous_unrolled_time_high = - (previous_unrolled_timestamp_ >> nbits); - int64 time0 = ((previous_unrolled_time_high - 1) << nbits) | timestamp; - int64 time1 = ((previous_unrolled_time_high + 0) << nbits) | timestamp; - int64 time2 = ((previous_unrolled_time_high + 1) << nbits) | timestamp; + int64_t previous_unrolled_time_high = (previous_unrolled_timestamp_ >> nbits); + int64_t time0 = ((previous_unrolled_time_high - 1) << nbits) | timestamp; + int64_t time1 = ((previous_unrolled_time_high + 0) << nbits) | timestamp; + int64_t time2 = ((previous_unrolled_time_high + 1) << nbits) | timestamp; // Select the min absolute difference with the current time // so as to ensure time continuity. - int64 diff0 = time0 - previous_unrolled_timestamp_; - int64 diff1 = time1 - previous_unrolled_timestamp_; - int64 diff2 = time2 - previous_unrolled_timestamp_; + int64_t diff0 = time0 - previous_unrolled_timestamp_; + int64_t diff1 = time1 - previous_unrolled_timestamp_; + int64_t diff2 = time2 - previous_unrolled_timestamp_; if (diff0 < 0) diff0 = -diff0; if (diff1 < 0) @@ -66,8 +65,8 @@ int64 TimestampUnroller::GetUnrolledTimestamp(int64 timestamp) { if (diff2 < 0) diff2 = -diff2; - int64 unrolled_time; - int64 min_diff; + int64_t unrolled_time; + int64_t min_diff; if (diff1 < diff0) { unrolled_time = time1; min_diff = diff1; diff --git a/media/formats/mp2t/timestamp_unroller.h b/media/formats/mp2t/timestamp_unroller.h index 0d05b7c..afebde5 100644 --- a/media/formats/mp2t/timestamp_unroller.h +++ b/media/formats/mp2t/timestamp_unroller.h @@ -5,7 +5,8 @@ #ifndef MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ #define MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/macros.h" #include "media/base/media_export.h" @@ -26,7 +27,7 @@ class MEDIA_EXPORT TimestampUnroller { // possible to the previous unrolled timestamp returned by this function // (if this function has not been called before, it will return the timestamp // unmodified). - int64 GetUnrolledTimestamp(int64 timestamp); + int64_t GetUnrolledTimestamp(int64_t timestamp); // Reset the TimestampUnroller to its initial state. void Reset(); @@ -36,7 +37,7 @@ class MEDIA_EXPORT TimestampUnroller { bool is_previous_timestamp_valid_; // This is the last output of GetUnrolledTimestamp. - int64 previous_unrolled_timestamp_; + int64_t previous_unrolled_timestamp_; DISALLOW_COPY_AND_ASSIGN(TimestampUnroller); }; diff --git a/media/formats/mp2t/timestamp_unroller_unittest.cc b/media/formats/mp2t/timestamp_unroller_unittest.cc index 93c214d..d99f5bd8 100644 --- a/media/formats/mp2t/timestamp_unroller_unittest.cc +++ b/media/formats/mp2t/timestamp_unroller_unittest.cc @@ -13,22 +13,22 @@ namespace media { namespace mp2t { -static std::vector<int64> TruncateTimestamps( - const std::vector<int64>& timestamps) { +static std::vector<int64_t> TruncateTimestamps( + const std::vector<int64_t>& timestamps) { const int nbits = 33; - int64 truncate_mask = (INT64_C(1) << nbits) - 1; - std::vector<int64> truncated_timestamps(timestamps.size()); + int64_t truncate_mask = (INT64_C(1) << nbits) - 1; + std::vector<int64_t> truncated_timestamps(timestamps.size()); for (size_t k = 0; k < timestamps.size(); k++) truncated_timestamps[k] = timestamps[k] & truncate_mask; return truncated_timestamps; } -static void RunUnrollTest(const std::vector<int64>& timestamps) { - std::vector<int64> truncated_timestamps = TruncateTimestamps(timestamps); +static void RunUnrollTest(const std::vector<int64_t>& timestamps) { + std::vector<int64_t> truncated_timestamps = TruncateTimestamps(timestamps); TimestampUnroller timestamp_unroller; for (size_t k = 0; k < timestamps.size(); k++) { - int64 unrolled_timestamp = + int64_t unrolled_timestamp = timestamp_unroller.GetUnrolledTimestamp(truncated_timestamps[k]); EXPECT_EQ(timestamps[k], unrolled_timestamp); } @@ -38,19 +38,19 @@ TEST(TimestampUnrollerTest, SingleStream) { // Array of 64 bit timestamps. // This is the expected result from unrolling these timestamps // truncated to 33 bits. - int64 timestamps[] = { - INT64_C(0x0000000000000000), - INT64_C(-190), // - 190 - INT64_C(0x00000000aaaaa9ed), // + 0xaaaaaaab - INT64_C(0x0000000155555498), // + 0xaaaaaaab - INT64_C(0x00000001ffffff43), // + 0xaaaaaaab - INT64_C(0x00000002aaaaa9ee), // + 0xaaaaaaab - INT64_C(0x0000000355555499), // + 0xaaaaaaab - INT64_C(0x00000003ffffff44), // + 0xaaaaaaab + int64_t timestamps[] = { + INT64_C(0x0000000000000000), + INT64_C(-190), // - 190 + INT64_C(0x00000000aaaaa9ed), // + 0xaaaaaaab + INT64_C(0x0000000155555498), // + 0xaaaaaaab + INT64_C(0x00000001ffffff43), // + 0xaaaaaaab + INT64_C(0x00000002aaaaa9ee), // + 0xaaaaaaab + INT64_C(0x0000000355555499), // + 0xaaaaaaab + INT64_C(0x00000003ffffff44), // + 0xaaaaaaab }; - std::vector<int64> timestamps_vector( - timestamps, timestamps + arraysize(timestamps)); + std::vector<int64_t> timestamps_vector(timestamps, + timestamps + arraysize(timestamps)); RunUnrollTest(timestamps_vector); } diff --git a/media/formats/mp2t/ts_packet.cc b/media/formats/mp2t/ts_packet.cc index e134aed..2c03cb6e 100644 --- a/media/formats/mp2t/ts_packet.cc +++ b/media/formats/mp2t/ts_packet.cc @@ -11,10 +11,10 @@ namespace media { namespace mp2t { -static const uint8 kTsHeaderSyncword = 0x47; +static const uint8_t kTsHeaderSyncword = 0x47; // static -int TsPacket::Sync(const uint8* buf, int size) { +int TsPacket::Sync(const uint8_t* buf, int size) { int k = 0; for (; k < size; k++) { // Verify that we have 4 syncwords in a row when possible, @@ -43,7 +43,7 @@ int TsPacket::Sync(const uint8* buf, int size) { } // static -TsPacket* TsPacket::Parse(const uint8* buf, int size) { +TsPacket* TsPacket::Parse(const uint8_t* buf, int size) { if (size < kPacketSize) { DVLOG(1) << "Buffer does not hold one full TS packet:" << " buffer_size=" << size; @@ -73,7 +73,7 @@ TsPacket::TsPacket() { TsPacket::~TsPacket() { } -bool TsPacket::ParseHeader(const uint8* buf) { +bool TsPacket::ParseHeader(const uint8_t* buf) { BitReader bit_reader(buf, kPacketSize); payload_ = buf; payload_size_ = kPacketSize; @@ -161,7 +161,7 @@ bool TsPacket::ParseAdaptationField(BitReader* bit_reader, random_access_indicator_ = (random_access_indicator != 0); if (pcr_flag) { - int64 program_clock_reference_base; + int64_t program_clock_reference_base; int reserved; int program_clock_reference_extension; RCHECK(bit_reader->ReadBits(33, &program_clock_reference_base)); @@ -170,7 +170,7 @@ bool TsPacket::ParseAdaptationField(BitReader* bit_reader, } if (opcr_flag) { - int64 original_program_clock_reference_base; + int64_t original_program_clock_reference_base; int reserved; int original_program_clock_reference_extension; RCHECK(bit_reader->ReadBits(33, &original_program_clock_reference_base)); diff --git a/media/formats/mp2t/ts_packet.h b/media/formats/mp2t/ts_packet.h index a232705..294f464 100644 --- a/media/formats/mp2t/ts_packet.h +++ b/media/formats/mp2t/ts_packet.h @@ -5,7 +5,9 @@ #ifndef MEDIA_FORMATS_MP2T_TS_PACKET_H_ #define MEDIA_FORMATS_MP2T_TS_PACKET_H_ -#include "base/basictypes.h" +#include <stdint.h> + +#include "base/macros.h" namespace media { @@ -19,12 +21,12 @@ class TsPacket { // Return the number of bytes to discard // to be synchronized on a TS syncword. - static int Sync(const uint8* buf, int size); + static int Sync(const uint8_t* buf, int size); // Parse a TS packet. // Return a TsPacket only when parsing was successful. // Return NULL otherwise. - static TsPacket* Parse(const uint8* buf, int size); + static TsPacket* Parse(const uint8_t* buf, int size); ~TsPacket(); @@ -38,7 +40,7 @@ class TsPacket { bool random_access_indicator() const { return random_access_indicator_; } // Return the offset and the size of the payload. - const uint8* payload() const { return payload_; } + const uint8_t* payload() const { return payload_; } int payload_size() const { return payload_size_; } private: @@ -46,12 +48,12 @@ class TsPacket { // Parse an Mpeg2 TS header. // The buffer size should be at least |kPacketSize| - bool ParseHeader(const uint8* buf); + bool ParseHeader(const uint8_t* buf); bool ParseAdaptationField(BitReader* bit_reader, int adaptation_field_length); // Size of the payload. - const uint8* payload_; + const uint8_t* payload_; int payload_size_; // TS header. diff --git a/media/formats/mp2t/ts_section.h b/media/formats/mp2t/ts_section.h index 9273733..7451b9e 100644 --- a/media/formats/mp2t/ts_section.h +++ b/media/formats/mp2t/ts_section.h @@ -24,7 +24,8 @@ class TsSection { // Parse the data bytes of the TS packet. // Return true if parsing is successful. virtual bool Parse(bool payload_unit_start_indicator, - const uint8* buf, int size) = 0; + const uint8_t* buf, + int size) = 0; // Process bytes that have not been processed yet (pending buffers in the // pipe). Flush might thus results in frame emission, as an example. diff --git a/media/formats/mp2t/ts_section_pes.cc b/media/formats/mp2t/ts_section_pes.cc index fe7b4dc..bbfe030 100644 --- a/media/formats/mp2t/ts_section_pes.cc +++ b/media/formats/mp2t/ts_section_pes.cc @@ -14,7 +14,7 @@ static const int kPesStartCode = 0x000001; -static bool IsTimestampSectionValid(int64 timestamp_section) { +static bool IsTimestampSectionValid(int64_t timestamp_section) { // |pts_section| has 40 bits: // - starting with either '0010' or '0011' or '0001' // - and ending with a marker bit. @@ -26,7 +26,7 @@ static bool IsTimestampSectionValid(int64 timestamp_section) { ((timestamp_section & 0x100000000) != 0); } -static int64 ConvertTimestampSectionToTimestamp(int64 timestamp_section) { +static int64_t ConvertTimestampSectionToTimestamp(int64_t timestamp_section) { return (((timestamp_section >> 33) & 0x7) << 30) | (((timestamp_section >> 17) & 0x7fff) << 15) | (((timestamp_section >> 1) & 0x7fff) << 0); @@ -48,7 +48,8 @@ TsSectionPes::~TsSectionPes() { } bool TsSectionPes::Parse(bool payload_unit_start_indicator, - const uint8* buf, int size) { + const uint8_t* buf, + int size) { // Ignore partial PES. if (wait_for_pusi_ && !payload_unit_start_indicator) return true; @@ -59,7 +60,7 @@ bool TsSectionPes::Parse(bool payload_unit_start_indicator, // with an undefined size. // In this case, a unit is emitted when the next unit is coming. int raw_pes_size; - const uint8* raw_pes; + const uint8_t* raw_pes; pes_byte_queue_.Peek(&raw_pes, &raw_pes_size); if (raw_pes_size > 0) parse_result = Emit(true); @@ -95,7 +96,7 @@ void TsSectionPes::Reset() { bool TsSectionPes::Emit(bool emit_for_unknown_size) { int raw_pes_size; - const uint8* raw_pes; + const uint8_t* raw_pes; pes_byte_queue_.Peek(&raw_pes, &raw_pes_size); // A PES should be at least 6 bytes. @@ -126,7 +127,7 @@ bool TsSectionPes::Emit(bool emit_for_unknown_size) { return parse_result; } -bool TsSectionPes::ParseInternal(const uint8* raw_pes, int raw_pes_size) { +bool TsSectionPes::ParseInternal(const uint8_t* raw_pes, int raw_pes_size) { BitReader bit_reader(raw_pes, raw_pes_size); // Read up to the pes_packet_length (6 bytes). @@ -199,8 +200,8 @@ bool TsSectionPes::ParseInternal(const uint8* raw_pes, int raw_pes_size) { // Read the timing information section. bool is_pts_valid = false; bool is_dts_valid = false; - int64 pts_section = 0; - int64 dts_section = 0; + int64_t pts_section = 0; + int64_t dts_section = 0; if (pts_dts_flags == 0x2) { RCHECK(bit_reader.ReadBits(40, &pts_section)); RCHECK((((pts_section >> 36) & 0xf) == 0x2) && @@ -222,12 +223,12 @@ bool TsSectionPes::ParseInternal(const uint8* raw_pes, int raw_pes_size) { base::TimeDelta media_pts(kNoTimestamp()); DecodeTimestamp media_dts(kNoDecodeTimestamp()); if (is_pts_valid) { - int64 pts = timestamp_unroller_->GetUnrolledTimestamp( + int64_t pts = timestamp_unroller_->GetUnrolledTimestamp( ConvertTimestampSectionToTimestamp(pts_section)); media_pts = base::TimeDelta::FromMicroseconds((1000 * pts) / 90); } if (is_dts_valid) { - int64 dts = timestamp_unroller_->GetUnrolledTimestamp( + int64_t dts = timestamp_unroller_->GetUnrolledTimestamp( ConvertTimestampSectionToTimestamp(dts_section)); media_dts = DecodeTimestamp::FromMicroseconds((1000 * dts) / 90); } diff --git a/media/formats/mp2t/ts_section_pes.h b/media/formats/mp2t/ts_section_pes.h index 3be879c..ec12c8f 100644 --- a/media/formats/mp2t/ts_section_pes.h +++ b/media/formats/mp2t/ts_section_pes.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FORMATS_MP2T_TS_SECTION_PES_H_ #define MEDIA_FORMATS_MP2T_TS_SECTION_PES_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "media/base/byte_queue.h" @@ -25,7 +24,8 @@ class TsSectionPes : public TsSection { // TsSection implementation. bool Parse(bool payload_unit_start_indicator, - const uint8* buf, int size) override; + const uint8_t* buf, + int size) override; void Flush() override; void Reset() override; @@ -37,7 +37,7 @@ class TsSectionPes : public TsSection { bool Emit(bool emit_for_unknown_size); // Parse a PES packet, return true if successful. - bool ParseInternal(const uint8* raw_pes, int raw_pes_size); + bool ParseInternal(const uint8_t* raw_pes, int raw_pes_size); void ResetPesState(); diff --git a/media/formats/mp2t/ts_section_psi.cc b/media/formats/mp2t/ts_section_psi.cc index 64fac9c..b8c9599 100644 --- a/media/formats/mp2t/ts_section_psi.cc +++ b/media/formats/mp2t/ts_section_psi.cc @@ -6,18 +6,17 @@ #include <algorithm> -#include "base/basictypes.h" #include "base/logging.h" #include "media/base/bit_reader.h" #include "media/formats/mp2t/mp2t_common.h" -static bool IsCrcValid(const uint8* buf, int size) { - uint32 crc = 0xffffffffu; - const uint32 kCrcPoly = 0x4c11db7; +static bool IsCrcValid(const uint8_t* buf, int size) { + uint32_t crc = 0xffffffffu; + const uint32_t kCrcPoly = 0x4c11db7; for (int k = 0; k < size; k++) { int nbits = 8; - uint32 data_msb_aligned = buf[k]; + uint32_t data_msb_aligned = buf[k]; data_msb_aligned <<= (32 - nbits); while (nbits > 0) { @@ -48,7 +47,8 @@ TsSectionPsi::~TsSectionPsi() { } bool TsSectionPsi::Parse(bool payload_unit_start_indicator, - const uint8* buf, int size) { + const uint8_t* buf, + int size) { // Ignore partial PSI. if (wait_for_pusi_ && !payload_unit_start_indicator) return true; @@ -79,7 +79,7 @@ bool TsSectionPsi::Parse(bool payload_unit_start_indicator, // Add the data to the parser state. psi_byte_queue_.Push(buf, size); int raw_psi_size; - const uint8* raw_psi; + const uint8_t* raw_psi; psi_byte_queue_.Peek(&raw_psi, &raw_psi_size); // Check whether we have enough data to start parsing. diff --git a/media/formats/mp2t/ts_section_psi.h b/media/formats/mp2t/ts_section_psi.h index 063310c..1495dbd 100644 --- a/media/formats/mp2t/ts_section_psi.h +++ b/media/formats/mp2t/ts_section_psi.h @@ -22,7 +22,8 @@ class TsSectionPsi : public TsSection { // TsSection implementation. bool Parse(bool payload_unit_start_indicator, - const uint8* buf, int size) override; + const uint8_t* buf, + int size) override; void Flush() override; void Reset() override; diff --git a/media/formats/mp4/aac.cc b/media/formats/mp4/aac.cc index 1e30918..ea4765b 100644 --- a/media/formats/mp4/aac.cc +++ b/media/formats/mp4/aac.cc @@ -22,7 +22,7 @@ AAC::AAC() AAC::~AAC() { } -bool AAC::Parse(const std::vector<uint8>& data, +bool AAC::Parse(const std::vector<uint8_t>& data, const scoped_refptr<MediaLog>& media_log) { #if defined(OS_ANDROID) codec_specific_data_ = data; @@ -31,9 +31,9 @@ bool AAC::Parse(const std::vector<uint8>& data, return false; BitReader reader(&data[0], data.size()); - uint8 extension_type = 0; + uint8_t extension_type = 0; bool ps_present = false; - uint8 extension_frequency_index = 0xff; + uint8_t extension_frequency_index = 0xff; frequency_ = 0; extension_frequency_ = 0; @@ -68,9 +68,9 @@ bool AAC::Parse(const std::vector<uint8>& data, // Read extension configuration again // Note: The check for 16 available bits comes from the AAC spec. if (extension_type != 5 && reader.bits_available() >= 16) { - uint16 sync_extension_type; - uint8 sbr_present_flag; - uint8 ps_present_flag; + uint16_t sync_extension_type; + uint8_t sbr_present_flag; + uint8_t ps_present_flag; if (reader.ReadBits(11, &sync_extension_type) && sync_extension_type == 0x2b7) { @@ -178,7 +178,7 @@ ChannelLayout AAC::GetChannelLayout(bool sbr_in_mimetype) const { return channel_layout_; } -bool AAC::ConvertEsdsToADTS(std::vector<uint8>* buffer) const { +bool AAC::ConvertEsdsToADTS(std::vector<uint8_t>* buffer) const { size_t size = buffer->size() + kADTSHeaderMinSize; DCHECK(profile_ >= 1 && profile_ <= 4 && frequency_index_ != 0xf && @@ -188,15 +188,15 @@ bool AAC::ConvertEsdsToADTS(std::vector<uint8>* buffer) const { if (size >= (1 << 13)) return false; - std::vector<uint8>& adts = *buffer; + std::vector<uint8_t>& adts = *buffer; adts.insert(buffer->begin(), kADTSHeaderMinSize, 0); adts[0] = 0xff; adts[1] = 0xf1; adts[2] = ((profile_ - 1) << 6) + (frequency_index_ << 2) + (channel_config_ >> 2); - adts[3] = static_cast<uint8>(((channel_config_ & 0x3) << 6) + (size >> 11)); - adts[4] = static_cast<uint8>((size & 0x7ff) >> 3); + adts[3] = static_cast<uint8_t>(((channel_config_ & 0x3) << 6) + (size >> 11)); + adts[4] = static_cast<uint8_t>((size & 0x7ff) >> 3); adts[5] = ((size & 7) << 5) + 0x1f; adts[6] = 0xfc; @@ -250,9 +250,9 @@ bool AAC::SkipErrorSpecificConfig() const { // The following code is written according to ISO 14496-3:2005 Table 4.1 - // GASpecificConfig. bool AAC::SkipGASpecificConfig(BitReader* bit_reader) const { - uint8 extension_flag = 0; - uint8 depends_on_core_coder; - uint16 dummy; + uint8_t extension_flag = 0; + uint8_t depends_on_core_coder; + uint16_t dummy; RCHECK(bit_reader->ReadBits(1, &dummy)); // frameLengthFlag RCHECK(bit_reader->ReadBits(1, &depends_on_core_coder)); diff --git a/media/formats/mp4/aac.h b/media/formats/mp4/aac.h index e76ea36..4328b56 100644 --- a/media/formats/mp4/aac.h +++ b/media/formats/mp4/aac.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "media/base/channel_layout.h" #include "media/base/media_export.h" #include "media/base/media_log.h" @@ -31,7 +30,7 @@ class MEDIA_EXPORT AAC { // The function will parse the data and get the ElementaryStreamDescriptor, // then it will parse the ElementaryStreamDescriptor to get audio stream // configurations. - bool Parse(const std::vector<uint8>& data, + bool Parse(const std::vector<uint8_t>& data, const scoped_refptr<MediaLog>& media_log); // Gets the output sample rate for the AAC stream. @@ -52,11 +51,11 @@ class MEDIA_EXPORT AAC { // header. On success, the function returns true and stores the converted data // in the buffer. The function returns false on failure and leaves the buffer // unchanged. - bool ConvertEsdsToADTS(std::vector<uint8>* buffer) const; + bool ConvertEsdsToADTS(std::vector<uint8_t>* buffer) const; #if defined(OS_ANDROID) // Returns the codec specific data needed by android MediaCodec. - std::vector<uint8> codec_specific_data() const { + std::vector<uint8_t> codec_specific_data() const { return codec_specific_data_; } #endif @@ -68,13 +67,13 @@ class MEDIA_EXPORT AAC { // The following variables store the AAC specific configuration information // that are used to generate the ADTS header. - uint8 profile_; - uint8 frequency_index_; - uint8 channel_config_; + uint8_t profile_; + uint8_t frequency_index_; + uint8_t channel_config_; #if defined(OS_ANDROID) // The codec specific data needed by the android MediaCodec. - std::vector<uint8> codec_specific_data_; + std::vector<uint8_t> codec_specific_data_; #endif // The following variables store audio configuration information that diff --git a/media/formats/mp4/aac_unittest.cc b/media/formats/mp4/aac_unittest.cc index 8a079bc..5b6e6b4 100644 --- a/media/formats/mp4/aac_unittest.cc +++ b/media/formats/mp4/aac_unittest.cc @@ -68,7 +68,7 @@ class AACTest : public testing::Test { public: AACTest() : media_log_(new StrictMock<MockMediaLog>()) {} - bool Parse(const std::vector<uint8>& data) { + bool Parse(const std::vector<uint8_t>& data) { return aac_.Parse(data, media_log_); } @@ -77,8 +77,8 @@ class AACTest : public testing::Test { }; TEST_F(AACTest, BasicProfileTest) { - uint8 buffer[] = {0x12, 0x10}; - std::vector<uint8> data; + uint8_t buffer[] = {0x12, 0x10}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -92,8 +92,8 @@ TEST_F(AACTest, BasicProfileTest) { } TEST_F(AACTest, ExtensionTest) { - uint8 buffer[] = {0x13, 0x08, 0x56, 0xe5, 0x9d, 0x48, 0x80}; - std::vector<uint8> data; + uint8_t buffer[] = {0x13, 0x08, 0x56, 0xe5, 0x9d, 0x48, 0x80}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -112,8 +112,8 @@ TEST_F(AACTest, ExtensionTest) { // specified. Otherwise stereo should be reported. // See ISO 14496-3:2005 Section 1.6.5.3 for details about this special casing. TEST_F(AACTest, ImplicitSBR_ChannelConfig0) { - uint8 buffer[] = {0x13, 0x08}; - std::vector<uint8> data; + uint8_t buffer[] = {0x13, 0x08}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -134,8 +134,8 @@ TEST_F(AACTest, ImplicitSBR_ChannelConfig0) { // Tests implicit SBR with a stereo channel config. TEST_F(AACTest, ImplicitSBR_ChannelConfig1) { - uint8 buffer[] = {0x13, 0x10}; - std::vector<uint8> data; + uint8_t buffer[] = {0x13, 0x10}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -155,8 +155,8 @@ TEST_F(AACTest, ImplicitSBR_ChannelConfig1) { } TEST_F(AACTest, SixChannelTest) { - uint8 buffer[] = {0x11, 0xb0}; - std::vector<uint8> data; + uint8_t buffer[] = {0x11, 0xb0}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -170,7 +170,7 @@ TEST_F(AACTest, SixChannelTest) { } TEST_F(AACTest, DataTooShortTest) { - std::vector<uint8> data; + std::vector<uint8_t> data; EXPECT_FALSE(Parse(data)); @@ -180,8 +180,8 @@ TEST_F(AACTest, DataTooShortTest) { TEST_F(AACTest, IncorrectProfileTest) { InSequence s; - uint8 buffer[] = {0x0, 0x08}; - std::vector<uint8> data; + uint8_t buffer[] = {0x0, 0x08}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_FALSE(Parse(data)); @@ -200,8 +200,8 @@ TEST_F(AACTest, IncorrectProfileTest) { } TEST_F(AACTest, IncorrectFrequencyTest) { - uint8 buffer[] = {0x0f, 0x88}; - std::vector<uint8> data; + uint8_t buffer[] = {0x0f, 0x88}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_FALSE(Parse(data)); @@ -216,8 +216,8 @@ TEST_F(AACTest, IncorrectFrequencyTest) { } TEST_F(AACTest, IncorrectChannelTest) { - uint8 buffer[] = {0x0e, 0x00}; - std::vector<uint8> data; + uint8_t buffer[] = {0x0e, 0x00}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_FALSE(Parse(data)); @@ -232,8 +232,8 @@ TEST_F(AACTest, IncorrectChannelTest) { TEST_F(AACTest, UnsupportedProfileTest) { InSequence s; - uint8 buffer[] = {0x3a, 0x08}; - std::vector<uint8> data; + uint8_t buffer[] = {0x3a, 0x08}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_MEDIA_LOG(UnsupportedAudioProfileLog("mp4a.40.7")); @@ -250,8 +250,8 @@ TEST_F(AACTest, UnsupportedProfileTest) { TEST_F(AACTest, UnsupportedChannelLayoutTest) { InSequence s; - uint8 buffer[] = {0x12, 0x78}; - std::vector<uint8> data; + uint8_t buffer[] = {0x12, 0x78}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_MEDIA_LOG(UnsupportedChannelConfigLog("15")); @@ -267,8 +267,8 @@ TEST_F(AACTest, UnsupportedChannelLayoutTest) { TEST_F(AACTest, UnsupportedFrequencyIndexTest) { InSequence s; - uint8 buffer[] = {0x17, 0x10}; - std::vector<uint8> data; + uint8_t buffer[] = {0x17, 0x10}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_MEDIA_LOG(UnsupportedFrequencyIndexLog("e")); @@ -284,8 +284,8 @@ TEST_F(AACTest, UnsupportedFrequencyIndexTest) { TEST_F(AACTest, UnsupportedExFrequencyIndexTest) { InSequence s; - uint8 buffer[] = {0x29, 0x17, 0x08, 0x0}; - std::vector<uint8> data; + uint8_t buffer[] = {0x29, 0x17, 0x08, 0x0}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); EXPECT_MEDIA_LOG(UnsupportedExtensionFrequencyIndexLog("e")); diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc index 7451a5f..01f7df2 100644 --- a/media/formats/mp4/avc.cc +++ b/media/formats/mp4/avc.cc @@ -15,14 +15,14 @@ namespace media { namespace mp4 { -static const uint8 kAnnexBStartCode[] = {0, 0, 0, 1}; +static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; static const int kAnnexBStartCodeSize = 4; -static bool ConvertAVCToAnnexBInPlaceForLengthSize4(std::vector<uint8>* buf) { +static bool ConvertAVCToAnnexBInPlaceForLengthSize4(std::vector<uint8_t>* buf) { const int kLengthSize = 4; size_t pos = 0; while (pos + kLengthSize < buf->size()) { - uint32 nal_length = (*buf)[pos]; + uint32_t nal_length = (*buf)[pos]; nal_length = (nal_length << 8) + (*buf)[pos+1]; nal_length = (nal_length << 8) + (*buf)[pos+2]; nal_length = (nal_length << 8) + (*buf)[pos+3]; @@ -40,15 +40,15 @@ static bool ConvertAVCToAnnexBInPlaceForLengthSize4(std::vector<uint8>* buf) { } // static -int AVC::FindSubsampleIndex(const std::vector<uint8>& buffer, +int AVC::FindSubsampleIndex(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>* subsamples, - const uint8* ptr) { + const uint8_t* ptr) { DCHECK(ptr >= &buffer[0]); DCHECK(ptr <= &buffer[buffer.size()-1]); if (!subsamples || subsamples->empty()) return 0; - const uint8* p = &buffer[0]; + const uint8_t* p = &buffer[0]; for (size_t i = 0; i < subsamples->size(); ++i) { p += (*subsamples)[i].clear_bytes + (*subsamples)[i].cypher_bytes; if (p > ptr) @@ -59,14 +59,15 @@ int AVC::FindSubsampleIndex(const std::vector<uint8>& buffer, } // static -bool AVC::ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer, +bool AVC::ConvertFrameToAnnexB(int length_size, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples) { RCHECK(length_size == 1 || length_size == 2 || length_size == 4); if (length_size == 4) return ConvertAVCToAnnexBInPlaceForLengthSize4(buffer); - std::vector<uint8> temp; + std::vector<uint8_t> temp; temp.swap(*buffer); buffer->reserve(temp.size() + 32); @@ -85,7 +86,7 @@ bool AVC::ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer, buffer->insert(buffer->end(), kAnnexBStartCode, kAnnexBStartCode + kAnnexBStartCodeSize); if (subsamples && !subsamples->empty()) { - uint8* buffer_pos = &(*(buffer->end() - kAnnexBStartCodeSize)); + uint8_t* buffer_pos = &(*(buffer->end() - kAnnexBStartCodeSize)); int subsample_index = FindSubsampleIndex(*buffer, subsamples, buffer_pos); // We've replaced NALU size value with an AnnexB start code. int size_adjustment = kAnnexBStartCodeSize - length_size; @@ -100,19 +101,19 @@ bool AVC::ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer, // static bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples) { DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples)); scoped_ptr<H264Parser> parser(new H264Parser()); - const uint8* start = &(*buffer)[0]; + const uint8_t* start = &(*buffer)[0]; parser->SetEncryptedStream(start, buffer->size(), *subsamples); H264NALU nalu; if (parser->AdvanceToNextNALU(&nalu) != H264Parser::kOk) return false; - std::vector<uint8>::iterator config_insert_point = buffer->begin(); + std::vector<uint8_t>::iterator config_insert_point = buffer->begin(); if (nalu.nal_unit_type == H264NALU::kAUD) { // Move insert point to just after the AUD. @@ -124,7 +125,7 @@ bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config, parser.reset(); start = NULL; - std::vector<uint8> param_sets; + std::vector<uint8_t> param_sets; RCHECK(AVC::ConvertConfigToAnnexB(avc_config, ¶m_sets)); if (subsamples && !subsamples->empty()) { @@ -142,9 +143,8 @@ bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config, } // static -bool AVC::ConvertConfigToAnnexB( - const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer) { +bool AVC::ConvertConfigToAnnexB(const AVCDecoderConfigurationRecord& avc_config, + std::vector<uint8_t>* buffer) { DCHECK(buffer->empty()); buffer->clear(); int total_size = 0; @@ -171,12 +171,13 @@ bool AVC::ConvertConfigToAnnexB( } // Verifies AnnexB NALU order according to ISO/IEC 14496-10 Section 7.4.1.2.3 -bool AVC::IsValidAnnexB(const std::vector<uint8>& buffer, +bool AVC::IsValidAnnexB(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>& subsamples) { return IsValidAnnexB(&buffer[0], buffer.size(), subsamples); } -bool AVC::IsValidAnnexB(const uint8* buffer, size_t size, +bool AVC::IsValidAnnexB(const uint8_t* buffer, + size_t size, const std::vector<SubsampleEntry>& subsamples) { DVLOG(1) << __FUNCTION__; DCHECK(buffer); @@ -318,7 +319,7 @@ AVCBitstreamConverter::~AVCBitstreamConverter() { } bool AVCBitstreamConverter::ConvertFrame( - std::vector<uint8>* frame_buf, + std::vector<uint8_t>* frame_buf, bool is_keyframe, std::vector<SubsampleEntry>* subsamples) const { // Convert the AVC NALU length fields to Annex B headers, as expected by diff --git a/media/formats/mp4/avc.h b/media/formats/mp4/avc.h index a774ddd..19858b9 100644 --- a/media/formats/mp4/avc.h +++ b/media/formats/mp4/avc.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" #include "media/formats/mp4/bitstream_converter.h" @@ -23,7 +22,7 @@ struct AVCDecoderConfigurationRecord; class MEDIA_EXPORT AVC { public: static bool ConvertFrameToAnnexB(int length_size, - std::vector<uint8>* buffer, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples); // Inserts the SPS & PPS data from |avc_config| into |buffer|. @@ -33,12 +32,12 @@ class MEDIA_EXPORT AVC { // Returns true if the param sets were successfully inserted. static bool InsertParamSetsAnnexB( const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples); static bool ConvertConfigToAnnexB( const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer); + std::vector<uint8_t>* buffer); // Verifies that the contents of |buffer| conform to // Section 7.4.1.2.3 of ISO/IEC 14496-10. @@ -47,16 +46,17 @@ class MEDIA_EXPORT AVC { // Returns true if |buffer| contains conformant Annex B data // TODO(acolwell): Remove the std::vector version when we can use, // C++11's std::vector<T>::data() method. - static bool IsValidAnnexB(const std::vector<uint8>& buffer, + static bool IsValidAnnexB(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>& subsamples); - static bool IsValidAnnexB(const uint8* buffer, size_t size, + static bool IsValidAnnexB(const uint8_t* buffer, + size_t size, const std::vector<SubsampleEntry>& subsamples); // Given a |buffer| and |subsamples| information and |pts| pointer into the // |buffer| finds the index of the subsample |ptr| is pointing into. - static int FindSubsampleIndex(const std::vector<uint8>& buffer, + static int FindSubsampleIndex(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>* subsamples, - const uint8* ptr); + const uint8_t* ptr); }; // AVCBitstreamConverter converts AVC/H.264 bitstream from MP4 container format @@ -69,9 +69,10 @@ class AVCBitstreamConverter : public BitstreamConverter { scoped_ptr<AVCDecoderConfigurationRecord> avc_config); // BitstreamConverter interface - bool ConvertFrame(std::vector<uint8>* frame_buf, + bool ConvertFrame(std::vector<uint8_t>* frame_buf, bool is_keyframe, std::vector<SubsampleEntry>* subsamples) const override; + private: ~AVCBitstreamConverter() override; scoped_ptr<AVCDecoderConfigurationRecord> avc_config_; diff --git a/media/formats/mp4/avc_unittest.cc b/media/formats/mp4/avc_unittest.cc index 19f10f3..2faf56e 100644 --- a/media/formats/mp4/avc_unittest.cc +++ b/media/formats/mp4/avc_unittest.cc @@ -4,7 +4,6 @@ #include <string.h> -#include "base/basictypes.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "media/base/decrypt_config.h" @@ -17,16 +16,15 @@ namespace media { namespace mp4 { -static const uint8 kNALU1[] = { 0x01, 0x02, 0x03 }; -static const uint8 kNALU2[] = { 0x04, 0x05, 0x06, 0x07 }; -static const uint8 kExpected[] = { - 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, - 0x00, 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07 }; +static const uint8_t kNALU1[] = {0x01, 0x02, 0x03}; +static const uint8_t kNALU2[] = {0x04, 0x05, 0x06, 0x07}; +static const uint8_t kExpected[] = {0x00, 0x00, 0x00, 0x01, 0x01, + 0x02, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x04, 0x05, 0x06, 0x07}; -static const uint8 kExpectedParamSets[] = { - 0x00, 0x00, 0x00, 0x01, 0x67, 0x12, - 0x00, 0x00, 0x00, 0x01, 0x67, 0x34, - 0x00, 0x00, 0x00, 0x01, 0x68, 0x56, 0x78}; +static const uint8_t kExpectedParamSets[] = { + 0x00, 0x00, 0x00, 0x01, 0x67, 0x12, 0x00, 0x00, 0x00, 0x01, + 0x67, 0x34, 0x00, 0x00, 0x00, 0x01, 0x68, 0x56, 0x78}; static H264NALU::Type StringToNALUType(const std::string& name) { if (name == "P") @@ -111,7 +109,7 @@ static std::string NALUTypeToString(int type) { return "UnsupportedType"; } -static void WriteStartCodeAndNALUType(std::vector<uint8>* buffer, +static void WriteStartCodeAndNALUType(std::vector<uint8_t>* buffer, const std::string& nal_unit_type) { buffer->push_back(0x00); buffer->push_back(0x00); @@ -131,7 +129,8 @@ static void WriteStartCodeAndNALUType(std::vector<uint8>* buffer, // The output buffer will contain a valid-looking Annex B (it's valid-looking in // the sense that it has start codes and correct NALU types, but the actual NALU // payload is junk). -void StringToAnnexB(const std::string& str, std::vector<uint8>* buffer, +void StringToAnnexB(const std::string& str, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples) { DCHECK(!str.empty()); @@ -174,7 +173,7 @@ void StringToAnnexB(const std::string& str, std::vector<uint8>* buffer, } } -std::string AnnexBToString(const std::vector<uint8>& buffer, +std::string AnnexBToString(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>& subsamples) { std::stringstream ss; @@ -202,7 +201,7 @@ std::string AnnexBToString(const std::vector<uint8>& buffer, class AVCConversionTest : public testing::TestWithParam<int> { protected: - void WriteLength(int length_size, int length, std::vector<uint8>* buf) { + void WriteLength(int length_size, int length, std::vector<uint8_t>* buf) { DCHECK_GE(length, 0); DCHECK_LE(length, 255); @@ -211,7 +210,7 @@ class AVCConversionTest : public testing::TestWithParam<int> { buf->push_back(length); } - void MakeInputForLength(int length_size, std::vector<uint8>* buf) { + void MakeInputForLength(int length_size, std::vector<uint8_t>* buf) { buf->clear(); WriteLength(length_size, sizeof(kNALU1), buf); @@ -224,7 +223,7 @@ class AVCConversionTest : public testing::TestWithParam<int> { }; TEST_P(AVCConversionTest, ParseCorrectly) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; MakeInputForLength(GetParam(), &buf); EXPECT_TRUE(AVC::ConvertFrameToAnnexB(GetParam(), &buf, &subsamples)); @@ -236,14 +235,14 @@ TEST_P(AVCConversionTest, ParseCorrectly) { // Intentionally write NALU sizes that are larger than the buffer. TEST_P(AVCConversionTest, NALUSizeTooLarge) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; WriteLength(GetParam(), 10 * sizeof(kNALU1), &buf); buf.insert(buf.end(), kNALU1, kNALU1 + sizeof(kNALU1)); EXPECT_FALSE(AVC::ConvertFrameToAnnexB(GetParam(), &buf, nullptr)); } TEST_P(AVCConversionTest, NALUSizeIsZero) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; WriteLength(GetParam(), 0, &buf); WriteLength(GetParam(), sizeof(kNALU1), &buf); @@ -258,7 +257,7 @@ TEST_P(AVCConversionTest, NALUSizeIsZero) { } TEST_P(AVCConversionTest, SubsampleSizesUpdatedAfterAnnexBConversion) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; SubsampleEntry subsample; @@ -298,7 +297,7 @@ TEST_P(AVCConversionTest, SubsampleSizesUpdatedAfterAnnexBConversion) { } TEST_P(AVCConversionTest, ParsePartial) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; MakeInputForLength(GetParam(), &buf); buf.pop_back(); EXPECT_FALSE(AVC::ConvertFrameToAnnexB(GetParam(), &buf, nullptr)); @@ -312,7 +311,7 @@ TEST_P(AVCConversionTest, ParsePartial) { } TEST_P(AVCConversionTest, ParseEmpty) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; EXPECT_TRUE(AVC::ConvertFrameToAnnexB(GetParam(), &buf, nullptr)); EXPECT_EQ(0u, buf.size()); } @@ -333,7 +332,7 @@ TEST_F(AVCConversionTest, ConvertConfigToAnnexB) { avc_config.pps_list[0].push_back(0x56); avc_config.pps_list[0].push_back(0x78); - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; EXPECT_TRUE(AVC::ConvertConfigToAnnexB(avc_config, &buf)); EXPECT_EQ(0, memcmp(kExpectedParamSets, &buf[0], @@ -345,7 +344,7 @@ TEST_F(AVCConversionTest, ConvertConfigToAnnexB) { TEST_F(AVCConversionTest, StringConversionFunctions) { std::string str = "AUD SPS SPSExt SPS PPS SEI SEI R14 I P FILL EOSeq EOStr"; - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; StringToAnnexB(str, &buf, &subsamples); EXPECT_TRUE(AVC::IsValidAnnexB(buf, subsamples)); @@ -375,7 +374,7 @@ TEST_F(AVCConversionTest, ValidAnnexBConstructs) { }; for (size_t i = 0; i < arraysize(test_cases); ++i) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; StringToAnnexB(test_cases[i], &buf, NULL); EXPECT_TRUE(AVC::IsValidAnnexB(buf, subsamples)) << "'" << test_cases[i] @@ -400,7 +399,7 @@ TEST_F(AVCConversionTest, InvalidAnnexBConstructs) { }; for (size_t i = 0; i < arraysize(test_cases); ++i) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; StringToAnnexB(test_cases[i], &buf, NULL); EXPECT_FALSE(AVC::IsValidAnnexB(buf, subsamples)) << "'" << test_cases[i] @@ -441,7 +440,7 @@ TEST_F(AVCConversionTest, InsertParamSetsAnnexB) { avc_config.pps_list[0].push_back(0x78); for (size_t i = 0; i < arraysize(test_cases); ++i) { - std::vector<uint8> buf; + std::vector<uint8_t> buf; std::vector<SubsampleEntry> subsamples; StringToAnnexB(test_cases[i].input, &buf, &subsamples); diff --git a/media/formats/mp4/bitstream_converter.h b/media/formats/mp4/bitstream_converter.h index b5dfdf1..efd6356 100644 --- a/media/formats/mp4/bitstream_converter.h +++ b/media/formats/mp4/bitstream_converter.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" namespace media { @@ -32,9 +31,10 @@ class BitstreamConverter // of input frame are encrypted and should update |subsamples| if necessary, // to make sure it correctly describes the converted output frame. See // SubsampleEntry definition in media/base/decrypt_config.h for more info. - virtual bool ConvertFrame(std::vector<uint8>* frame_buf, + virtual bool ConvertFrame(std::vector<uint8_t>* frame_buf, bool is_keyframe, std::vector<SubsampleEntry>* subsamples) const = 0; + protected: friend class base::RefCountedThreadSafe<BitstreamConverter>; virtual ~BitstreamConverter(); diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc index fc0250d..95e0b2f 100644 --- a/media/formats/mp4/box_definitions.cc +++ b/media/formats/mp4/box_definitions.cc @@ -101,12 +101,12 @@ bool SampleAuxiliaryInformationOffset::Parse(BoxReader* reader) { if (reader->flags() & 1) RCHECK(reader->SkipBytes(8)); - uint32 count; + uint32_t count; RCHECK(reader->Read4(&count) && reader->HasBytes(count * (reader->version() == 1 ? 8 : 4))); offsets.resize(count); - for (uint32 i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { if (reader->version() == 1) { RCHECK(reader->Read8(&offsets[i])); } else { @@ -160,7 +160,7 @@ TrackEncryption::~TrackEncryption() {} FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; } bool TrackEncryption::Parse(BoxReader* reader) { - uint8 flag; + uint8_t flag; RCHECK(reader->ReadFullBoxHeader() && reader->SkipBytes(2) && reader->Read1(&flag) && @@ -291,7 +291,7 @@ SampleDescription::~SampleDescription() {} FourCC SampleDescription::BoxType() const { return FOURCC_STSD; } bool SampleDescription::Parse(BoxReader* reader) { - uint32 count; + uint32_t count; RCHECK(reader->SkipBytes(4) && reader->Read4(&count)); video_entries.clear(); @@ -332,7 +332,7 @@ EditList::~EditList() {} FourCC EditList::BoxType() const { return FOURCC_ELST; } bool EditList::Parse(BoxReader* reader) { - uint32 count; + uint32_t count; RCHECK(reader->ReadFullBoxHeader() && reader->Read4(&count)); if (reader->version() == 1) { @@ -397,7 +397,7 @@ bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) { return ParseInternal(reader, reader->media_log()); } -bool AVCDecoderConfigurationRecord::Parse(const uint8* data, int data_size) { +bool AVCDecoderConfigurationRecord::Parse(const uint8_t* data, int data_size) { BufferReader reader(data, data_size); return ParseInternal(&reader, new MediaLog()); } @@ -410,19 +410,19 @@ bool AVCDecoderConfigurationRecord::ParseInternal( reader->Read1(&profile_compatibility) && reader->Read1(&avc_level)); - uint8 length_size_minus_one; + uint8_t length_size_minus_one; RCHECK(reader->Read1(&length_size_minus_one)); length_size = (length_size_minus_one & 0x3) + 1; RCHECK(length_size != 3); // Only values of 1, 2, and 4 are valid. - uint8 num_sps; + uint8_t num_sps; RCHECK(reader->Read1(&num_sps)); num_sps &= 0x1f; sps_list.resize(num_sps); for (int i = 0; i < num_sps; i++) { - uint16 sps_length; + uint16_t sps_length; RCHECK(reader->Read2(&sps_length) && reader->ReadVec(&sps_list[i], sps_length)); RCHECK(sps_list[i].size() > 4); @@ -435,12 +435,12 @@ bool AVCDecoderConfigurationRecord::ParseInternal( } } - uint8 num_pps; + uint8_t num_pps; RCHECK(reader->Read1(&num_pps)); pps_list.resize(num_pps); for (int i = 0; i < num_pps; i++) { - uint16 pps_length; + uint16_t pps_length; RCHECK(reader->Read2(&pps_length) && reader->ReadVec(&pps_list[i], pps_length)); } @@ -564,7 +564,7 @@ FourCC ElementaryStreamDescriptor::BoxType() const { } bool ElementaryStreamDescriptor::Parse(BoxReader* reader) { - std::vector<uint8> data; + std::vector<uint8_t> data; ESDescriptor es_desc; RCHECK(reader->ReadFullBoxHeader()); @@ -831,7 +831,7 @@ FourCC TrackFragmentRun::BoxType() const { return FOURCC_TRUN; } bool TrackFragmentRun::Parse(BoxReader* reader) { RCHECK(reader->ReadFullBoxHeader() && reader->Read4(&sample_count)); - const uint32 flags = reader->flags(); + const uint32_t flags = reader->flags(); bool data_offset_present = (flags & 0x1) != 0; bool first_sample_flags_present = (flags & 0x4) != 0; @@ -846,7 +846,7 @@ bool TrackFragmentRun::Parse(BoxReader* reader) { data_offset = 0; } - uint32 first_sample_flags = 0; + uint32_t first_sample_flags = 0; if (first_sample_flags_present) RCHECK(reader->Read4(&first_sample_flags)); @@ -863,7 +863,7 @@ bool TrackFragmentRun::Parse(BoxReader* reader) { if (sample_composition_time_offsets_present) sample_composition_time_offsets.resize(sample_count); - for (uint32 i = 0; i < sample_count; ++i) { + for (uint32_t i = 0; i < sample_count; ++i) { if (sample_duration_present) RCHECK(reader->Read4(&sample_durations[i])); if (sample_size_present) @@ -901,10 +901,10 @@ bool SampleToGroup::Parse(BoxReader* reader) { return true; } - uint32 count; + uint32_t count; RCHECK(reader->Read4(&count)); entries.resize(count); - for (uint32 i = 0; i < count; ++i) { + for (uint32_t i = 0; i < count; ++i) { RCHECK(reader->Read4(&entries[i].sample_count) && reader->Read4(&entries[i].group_description_index)); } @@ -929,29 +929,29 @@ bool SampleGroupDescription::Parse(BoxReader* reader) { return true; } - const uint8 version = reader->version(); + const uint8_t version = reader->version(); const size_t kKeyIdSize = 16; - const size_t kEntrySize = sizeof(uint32) + kKeyIdSize; - uint32 default_length = 0; + const size_t kEntrySize = sizeof(uint32_t) + kKeyIdSize; + uint32_t default_length = 0; if (version == 1) { RCHECK(reader->Read4(&default_length)); RCHECK(default_length == 0 || default_length >= kEntrySize); } - uint32 count; + uint32_t count; RCHECK(reader->Read4(&count)); entries.resize(count); - for (uint32 i = 0; i < count; ++i) { + for (uint32_t i = 0; i < count; ++i) { if (version == 1) { if (default_length == 0) { - uint32 description_length = 0; + uint32_t description_length = 0; RCHECK(reader->Read4(&description_length)); RCHECK(description_length >= kEntrySize); } } - uint8 flag; + uint8_t flag; RCHECK(reader->SkipBytes(2) && // reserved. reader->Read1(&flag) && reader->Read1(&entries[i].iv_size) && @@ -1024,7 +1024,7 @@ bool IndependentAndDisposableSamples::Parse(BoxReader* reader) { int sample_count = reader->size() - reader->pos(); sample_depends_on_.resize(sample_count); for (int i = 0; i < sample_count; ++i) { - uint8 sample_info; + uint8_t sample_info; RCHECK(reader->Read1(&sample_info)); sample_depends_on_[i] = diff --git a/media/formats/mp4/box_definitions.h b/media/formats/mp4/box_definitions.h index e1f1729..eed6581 100644 --- a/media/formats/mp4/box_definitions.h +++ b/media/formats/mp4/box_definitions.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "media/base/media_export.h" #include "media/base/media_log.h" @@ -42,7 +41,7 @@ struct MEDIA_EXPORT FileType : Box { DECLARE_BOX_METHODS(FileType); FourCC major_brand; - uint32 minor_version; + uint32_t minor_version; }; // If only copying the 'pssh' boxes, use ProtectionSystemSpecificHeader. @@ -51,29 +50,29 @@ struct MEDIA_EXPORT FileType : Box { struct MEDIA_EXPORT ProtectionSystemSpecificHeader : Box { DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader); - std::vector<uint8> raw_box; + std::vector<uint8_t> raw_box; }; struct MEDIA_EXPORT FullProtectionSystemSpecificHeader : Box { DECLARE_BOX_METHODS(FullProtectionSystemSpecificHeader); - std::vector<uint8> system_id; - std::vector<std::vector<uint8>> key_ids; - std::vector<uint8> data; + std::vector<uint8_t> system_id; + std::vector<std::vector<uint8_t>> key_ids; + std::vector<uint8_t> data; }; struct MEDIA_EXPORT SampleAuxiliaryInformationOffset : Box { DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset); - std::vector<uint64> offsets; + std::vector<uint64_t> offsets; }; struct MEDIA_EXPORT SampleAuxiliaryInformationSize : Box { DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize); - uint8 default_sample_info_size; - uint32 sample_count; - std::vector<uint8> sample_info_sizes; + uint8_t default_sample_info_size; + uint32_t sample_count; + std::vector<uint8_t> sample_info_sizes; }; struct MEDIA_EXPORT OriginalFormat : Box { @@ -86,7 +85,7 @@ struct MEDIA_EXPORT SchemeType : Box { DECLARE_BOX_METHODS(SchemeType); FourCC type; - uint32 version; + uint32_t version; }; struct MEDIA_EXPORT TrackEncryption : Box { @@ -94,8 +93,8 @@ struct MEDIA_EXPORT TrackEncryption : Box { // Note: this definition is specific to the CENC protection type. bool is_encrypted; - uint8 default_iv_size; - std::vector<uint8> default_kid; + uint8_t default_iv_size; + std::vector<uint8_t> default_kid; }; struct MEDIA_EXPORT SchemeInfo : Box { @@ -115,34 +114,34 @@ struct MEDIA_EXPORT ProtectionSchemeInfo : Box { struct MEDIA_EXPORT MovieHeader : Box { DECLARE_BOX_METHODS(MovieHeader); - uint64 creation_time; - uint64 modification_time; - uint32 timescale; - uint64 duration; - int32 rate; - int16 volume; - uint32 next_track_id; + uint64_t creation_time; + uint64_t modification_time; + uint32_t timescale; + uint64_t duration; + int32_t rate; + int16_t volume; + uint32_t next_track_id; }; struct MEDIA_EXPORT TrackHeader : Box { DECLARE_BOX_METHODS(TrackHeader); - uint64 creation_time; - uint64 modification_time; - uint32 track_id; - uint64 duration; - int16 layer; - int16 alternate_group; - int16 volume; - uint32 width; - uint32 height; + uint64_t creation_time; + uint64_t modification_time; + uint32_t track_id; + uint64_t duration; + int16_t layer; + int16_t alternate_group; + int16_t volume; + uint32_t width; + uint32_t height; }; struct MEDIA_EXPORT EditListEntry { - uint64 segment_duration; - int64 media_time; - int16 media_rate_integer; - int16 media_rate_fraction; + uint64_t segment_duration; + int64_t media_time; + int16_t media_rate_integer; + int16_t media_rate_fraction; }; struct MEDIA_EXPORT EditList : Box { @@ -171,16 +170,16 @@ struct MEDIA_EXPORT AVCDecoderConfigurationRecord : Box { // context and therefore the box header is not expected to be present // in |data|. // Returns true if |data| was successfully parsed. - bool Parse(const uint8* data, int data_size); + bool Parse(const uint8_t* data, int data_size); - uint8 version; - uint8 profile_indication; - uint8 profile_compatibility; - uint8 avc_level; - uint8 length_size; + uint8_t version; + uint8_t profile_indication; + uint8_t profile_compatibility; + uint8_t avc_level; + uint8_t length_size; - typedef std::vector<uint8> SPS; - typedef std::vector<uint8> PPS; + typedef std::vector<uint8_t> SPS; + typedef std::vector<uint8_t> PPS; std::vector<SPS> sps_list; std::vector<PPS> pps_list; @@ -193,17 +192,17 @@ struct MEDIA_EXPORT AVCDecoderConfigurationRecord : Box { struct MEDIA_EXPORT PixelAspectRatioBox : Box { DECLARE_BOX_METHODS(PixelAspectRatioBox); - uint32 h_spacing; - uint32 v_spacing; + uint32_t h_spacing; + uint32_t v_spacing; }; struct MEDIA_EXPORT VideoSampleEntry : Box { DECLARE_BOX_METHODS(VideoSampleEntry); FourCC format; - uint16 data_reference_index; - uint16 width; - uint16 height; + uint16_t data_reference_index; + uint16_t width; + uint16_t height; PixelAspectRatioBox pixel_aspect; ProtectionSchemeInfo sinf; @@ -219,7 +218,7 @@ struct MEDIA_EXPORT VideoSampleEntry : Box { struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { DECLARE_BOX_METHODS(ElementaryStreamDescriptor); - uint8 object_type; + uint8_t object_type; AAC aac; }; @@ -227,10 +226,10 @@ struct MEDIA_EXPORT AudioSampleEntry : Box { DECLARE_BOX_METHODS(AudioSampleEntry); FourCC format; - uint16 data_reference_index; - uint16 channelcount; - uint16 samplesize; - uint32 samplerate; + uint16_t data_reference_index; + uint16_t channelcount; + uint16_t samplesize; + uint32_t samplerate; ProtectionSchemeInfo sinf; ElementaryStreamDescriptor esds; @@ -249,14 +248,14 @@ struct MEDIA_EXPORT CencSampleEncryptionInfoEntry { ~CencSampleEncryptionInfoEntry(); bool is_encrypted; - uint8 iv_size; - std::vector<uint8> key_id; + uint8_t iv_size; + std::vector<uint8_t> key_id; }; struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'. DECLARE_BOX_METHODS(SampleGroupDescription); - uint32 grouping_type; + uint32_t grouping_type; std::vector<CencSampleEncryptionInfoEntry> entries; }; @@ -274,10 +273,10 @@ struct MEDIA_EXPORT SampleTable : Box { struct MEDIA_EXPORT MediaHeader : Box { DECLARE_BOX_METHODS(MediaHeader); - uint64 creation_time; - uint64 modification_time; - uint32 timescale; - uint64 duration; + uint64_t creation_time; + uint64_t modification_time; + uint32_t timescale; + uint64_t duration; }; struct MEDIA_EXPORT MediaInformation : Box { @@ -305,17 +304,17 @@ struct MEDIA_EXPORT Track : Box { struct MEDIA_EXPORT MovieExtendsHeader : Box { DECLARE_BOX_METHODS(MovieExtendsHeader); - uint64 fragment_duration; + uint64_t fragment_duration; }; struct MEDIA_EXPORT TrackExtends : Box { DECLARE_BOX_METHODS(TrackExtends); - uint32 track_id; - uint32 default_sample_description_index; - uint32 default_sample_duration; - uint32 default_sample_size; - uint32 default_sample_flags; + uint32_t track_id; + uint32_t default_sample_description_index; + uint32_t default_sample_duration; + uint32_t default_sample_size; + uint32_t default_sample_flags; }; struct MEDIA_EXPORT MovieExtends : Box { @@ -338,24 +337,24 @@ struct MEDIA_EXPORT Movie : Box { struct MEDIA_EXPORT TrackFragmentDecodeTime : Box { DECLARE_BOX_METHODS(TrackFragmentDecodeTime); - uint64 decode_time; + uint64_t decode_time; }; struct MEDIA_EXPORT MovieFragmentHeader : Box { DECLARE_BOX_METHODS(MovieFragmentHeader); - uint32 sequence_number; + uint32_t sequence_number; }; struct MEDIA_EXPORT TrackFragmentHeader : Box { DECLARE_BOX_METHODS(TrackFragmentHeader); - uint32 track_id; + uint32_t track_id; - uint32 sample_description_index; - uint32 default_sample_duration; - uint32 default_sample_size; - uint32 default_sample_flags; + uint32_t sample_description_index; + uint32_t default_sample_duration; + uint32_t default_sample_size; + uint32_t default_sample_flags; // As 'flags' might be all zero, we cannot use zeroness alone to identify // when default_sample_flags wasn't specified, unlike the other values. @@ -365,12 +364,12 @@ struct MEDIA_EXPORT TrackFragmentHeader : Box { struct MEDIA_EXPORT TrackFragmentRun : Box { DECLARE_BOX_METHODS(TrackFragmentRun); - uint32 sample_count; - uint32 data_offset; - std::vector<uint32> sample_flags; - std::vector<uint32> sample_sizes; - std::vector<uint32> sample_durations; - std::vector<int32> sample_composition_time_offsets; + uint32_t sample_count; + uint32_t data_offset; + std::vector<uint32_t> sample_flags; + std::vector<uint32_t> sample_sizes; + std::vector<uint32_t> sample_durations; + std::vector<int32_t> sample_composition_time_offsets; }; // sample_depends_on values in ISO/IEC 14496-12 Section 8.40.2.3. @@ -400,15 +399,15 @@ struct MEDIA_EXPORT SampleToGroupEntry { kFragmentGroupDescriptionIndexBase = 0x10000, }; - uint32 sample_count; - uint32 group_description_index; + uint32_t sample_count; + uint32_t group_description_index; }; struct MEDIA_EXPORT SampleToGroup : Box { // 'sbgp'. DECLARE_BOX_METHODS(SampleToGroup); - uint32 grouping_type; - uint32 grouping_type_parameter; // Version 1 only. + uint32_t grouping_type; + uint32_t grouping_type_parameter; // Version 1 only. std::vector<SampleToGroupEntry> entries; }; diff --git a/media/formats/mp4/box_reader_unittest.cc b/media/formats/mp4/box_reader_unittest.cc index 6f08763..fdcec61 100644 --- a/media/formats/mp4/box_reader_unittest.cc +++ b/media/formats/mp4/box_reader_unittest.cc @@ -4,7 +4,6 @@ #include <string.h> -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "media/base/mock_media_log.h" @@ -20,21 +19,19 @@ using ::testing::StrictMock; namespace media { namespace mp4 { -static const uint8 kSkipBox[] = { - // Top-level test box containing three children - 0x00, 0x00, 0x00, 0x40, 's', 'k', 'i', 'p', - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0xf9, 0x0a, 0x0b, 0x0c, 0xfd, 0x0e, 0x0f, 0x10, - // Ordinary (8-byte header) child box - 0x00, 0x00, 0x00, 0x0c, 'p', 's', 's', 'h', 0xde, 0xad, 0xbe, 0xef, - // Extended-size header child box - 0x00, 0x00, 0x00, 0x01, 'p', 's', 's', 'h', - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, - 0xfa, 0xce, 0xca, 0xfe, - // Empty free box - 0x00, 0x00, 0x00, 0x08, 'f', 'r', 'e', 'e', - // Trailing garbage - 0x00 }; +static const uint8_t kSkipBox[] = { + // Top-level test box containing three children + 0x00, 0x00, 0x00, 0x40, 's', 'k', 'i', 'p', 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0xf9, 0x0a, 0x0b, 0x0c, 0xfd, 0x0e, 0x0f, 0x10, + // Ordinary (8-byte header) child box + 0x00, 0x00, 0x00, 0x0c, 'p', 's', 's', 'h', 0xde, 0xad, 0xbe, 0xef, + // Extended-size header child box + 0x00, 0x00, 0x00, 0x01, 'p', 's', 's', 'h', 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x14, 0xfa, 0xce, 0xca, 0xfe, + // Empty free box + 0x00, 0x00, 0x00, 0x08, 'f', 'r', 'e', 'e', + // Trailing garbage + 0x00}; struct FreeBox : Box { bool Parse(BoxReader* reader) override { @@ -44,7 +41,7 @@ struct FreeBox : Box { }; struct PsshBox : Box { - uint32 val; + uint32_t val; bool Parse(BoxReader* reader) override { return reader->Read4(&val); @@ -53,10 +50,10 @@ struct PsshBox : Box { }; struct SkipBox : Box { - uint8 a, b; - uint16 c; - int32 d; - int64 e; + uint8_t a, b; + uint16_t c; + int32_t d; + int64_t e; std::vector<PsshBox> kids; FreeBox mpty; @@ -86,12 +83,12 @@ class BoxReaderTest : public testing::Test { BoxReaderTest() : media_log_(new StrictMock<MockMediaLog>()) {} protected: - std::vector<uint8> GetBuf() { - return std::vector<uint8>(kSkipBox, kSkipBox + sizeof(kSkipBox)); + std::vector<uint8_t> GetBuf() { + return std::vector<uint8_t>(kSkipBox, kSkipBox + sizeof(kSkipBox)); } - void TestTopLevelBox(const uint8* data, int size, uint32 fourCC) { - std::vector<uint8> buf(data, data + size); + void TestTopLevelBox(const uint8_t* data, int size, uint32_t fourCC) { + std::vector<uint8_t> buf(data, data + size); bool err; scoped_ptr<BoxReader> reader( @@ -100,14 +97,14 @@ class BoxReaderTest : public testing::Test { EXPECT_FALSE(err); EXPECT_TRUE(reader); EXPECT_EQ(fourCC, reader->type()); - EXPECT_EQ(reader->size(), static_cast<uint64>(size)); + EXPECT_EQ(reader->size(), static_cast<uint64_t>(size)); } scoped_refptr<StrictMock<MockMediaLog>> media_log_; }; TEST_F(BoxReaderTest, ExpectedOperationTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); bool err; scoped_ptr<BoxReader> reader( BoxReader::ReadTopLevelBox(&buf[0], buf.size(), media_log_, &err)); @@ -121,19 +118,19 @@ TEST_F(BoxReaderTest, ExpectedOperationTest) { EXPECT_EQ(0x05, box.a); EXPECT_EQ(0x06, box.b); EXPECT_EQ(0x0708, box.c); - EXPECT_EQ(static_cast<int32>(0xf90a0b0c), box.d); - EXPECT_EQ(static_cast<int32>(0xfd0e0f10), box.e); + EXPECT_EQ(static_cast<int32_t>(0xf90a0b0c), box.d); + EXPECT_EQ(static_cast<int32_t>(0xfd0e0f10), box.e); EXPECT_EQ(2u, box.kids.size()); EXPECT_EQ(0xdeadbeef, box.kids[0].val); EXPECT_EQ(0xfacecafe, box.kids[1].val); // Accounting for the extra byte outside of the box above - EXPECT_EQ(buf.size(), static_cast<uint64>(reader->size() + 1)); + EXPECT_EQ(buf.size(), static_cast<uint64_t>(reader->size() + 1)); } TEST_F(BoxReaderTest, OuterTooShortTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); bool err; // Create a soft failure by truncating the outer box. @@ -145,7 +142,7 @@ TEST_F(BoxReaderTest, OuterTooShortTest) { } TEST_F(BoxReaderTest, InnerTooLongTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); bool err; // Make an inner box too big for its outer box. @@ -158,7 +155,7 @@ TEST_F(BoxReaderTest, InnerTooLongTest) { } TEST_F(BoxReaderTest, WrongFourCCTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); bool err; // Set an unrecognized top-level FourCC. @@ -173,7 +170,7 @@ TEST_F(BoxReaderTest, WrongFourCCTest) { } TEST_F(BoxReaderTest, ScanChildrenTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); bool err; scoped_ptr<BoxReader> reader( BoxReader::ReadTopLevelBox(&buf[0], buf.size(), media_log_, &err)); @@ -195,7 +192,7 @@ TEST_F(BoxReaderTest, ScanChildrenTest) { } TEST_F(BoxReaderTest, ReadAllChildrenTest) { - std::vector<uint8> buf = GetBuf(); + std::vector<uint8_t> buf = GetBuf(); // Modify buffer to exclude its last 'free' box buf[3] = 0x38; bool err; @@ -209,36 +206,35 @@ TEST_F(BoxReaderTest, ReadAllChildrenTest) { } TEST_F(BoxReaderTest, SkippingBloc) { - static const uint8 kData[] = { - 0x00, 0x00, 0x00, 0x09, 'b', 'l', 'o', 'c', 0x00 - }; + static const uint8_t kData[] = {0x00, 0x00, 0x00, 0x09, 'b', + 'l', 'o', 'c', 0x00}; TestTopLevelBox(kData, sizeof(kData), FOURCC_BLOC); } TEST_F(BoxReaderTest, SkippingEmsg) { - static const uint8 kData[] = { - 0x00, 0x00, 0x00, 0x24, 'e', 'm', 's', 'g', - 0x00, // version = 0 - 0x00, 0x00, 0x00, // flags = 0 - 0x61, 0x00, // scheme_id_uri = "a" - 0x61, 0x00, // value = "a" - 0x00, 0x00, 0x00, 0x01, // timescale = 1 - 0x00, 0x00, 0x00, 0x02, // presentation_time_delta = 2 - 0x00, 0x00, 0x00, 0x03, // event_duration = 3 - 0x00, 0x00, 0x00, 0x04, // id = 4 - 0x05, 0x06, 0x07, 0x08, // message_data[4] = 0x05060708 + static const uint8_t kData[] = { + 0x00, 0x00, 0x00, 0x24, 'e', 'm', 's', 'g', + 0x00, // version = 0 + 0x00, 0x00, 0x00, // flags = 0 + 0x61, 0x00, // scheme_id_uri = "a" + 0x61, 0x00, // value = "a" + 0x00, 0x00, 0x00, 0x01, // timescale = 1 + 0x00, 0x00, 0x00, 0x02, // presentation_time_delta = 2 + 0x00, 0x00, 0x00, 0x03, // event_duration = 3 + 0x00, 0x00, 0x00, 0x04, // id = 4 + 0x05, 0x06, 0x07, 0x08, // message_data[4] = 0x05060708 }; TestTopLevelBox(kData, sizeof(kData), FOURCC_EMSG); } TEST_F(BoxReaderTest, SkippingUuid) { - static const uint8 kData[] = { - 0x00, 0x00, 0x00, 0x19, 'u', 'u', 'i', 'd', - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, // usertype - 0x00, + static const uint8_t kData[] = { + 0x00, 0x00, 0x00, 0x19, 'u', 'u', 'i', 'd', + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, // usertype + 0x00, }; TestTopLevelBox(kData, sizeof(kData), FOURCC_UUID); @@ -251,7 +247,7 @@ TEST_F(BoxReaderTest, NestedBoxWithHugeSize) { // The nested box ('junk') has a large size that was chosen to catch // integer overflows. The nested box should not specify more than the // number of remaining bytes in the enclosing box. - static const uint8 kData[] = { + static const uint8_t kData[] = { 0x00, 0x00, 0x00, 0x24, 'e', 'm', 's', 'g', // outer box 0x7f, 0xff, 0xff, 0xff, 'j', 'u', 'n', 'k', // nested box 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x3b, 0x03, // random data for rest @@ -274,9 +270,9 @@ TEST_F(BoxReaderTest, ScanChildrenWithInvalidChild) { // The sample specifies a large number of EditListEntry's, but only 1 is // actually included in the box. This test verifies that the code checks // properly that the buffer contains the specified number of EditListEntry's - // (does not cause an int32 overflow when checking that the bytes are + // (does not cause an int32_t overflow when checking that the bytes are // available, and does not read past the end of the buffer). - static const uint8 kData[] = { + static const uint8_t kData[] = { 0x00, 0x00, 0x00, 0x2c, 'e', 'm', 's', 'g', // outer box 0x00, 0x00, 0x00, 0x24, 'e', 'l', 's', 't', // nested box 0x01, 0x00, 0x00, 0x00, // version = 1, flags = 0 @@ -305,9 +301,9 @@ TEST_F(BoxReaderTest, ReadAllChildrenWithInvalidChild) { // The nested 'trun' box is used as it includes a count of the number // of samples. The data specifies a large number of samples, but only 1 // is actually included in the box. Verifying that the large count does not - // cause an int32 overflow which would allow parsing of TrackFragmentRun + // cause an int32_t overflow which would allow parsing of TrackFragmentRun // to read past the end of the buffer. - static const uint8 kData[] = { + static const uint8_t kData[] = { 0x00, 0x00, 0x00, 0x28, 'e', 'm', 's', 'g', // outer box 0x00, 0x00, 0x00, 0x20, 't', 'r', 'u', 'n', // nested box 0x00, 0x00, 0x0f, 0x00, // version = 0, flags = samples present diff --git a/media/formats/mp4/cenc.cc b/media/formats/mp4/cenc.cc index 001b6d8..3a7b592 100644 --- a/media/formats/mp4/cenc.cc +++ b/media/formats/mp4/cenc.cc @@ -26,14 +26,14 @@ bool FrameCENCInfo::Parse(int iv_size, BufferReader* reader) { if (!reader->HasBytes(1)) return true; - uint16 subsample_count; + uint16_t subsample_count; RCHECK(reader->Read2(&subsample_count) && reader->HasBytes(subsample_count * kEntrySize)); subsamples.resize(subsample_count); for (int i = 0; i < subsample_count; i++) { - uint16 clear_bytes; - uint32 cypher_bytes; + uint16_t clear_bytes; + uint32_t cypher_bytes; RCHECK(reader->Read2(&clear_bytes) && reader->Read4(&cypher_bytes)); subsamples[i].clear_bytes = clear_bytes; diff --git a/media/formats/mp4/cenc.h b/media/formats/mp4/cenc.h index 9eb3358..44670f3 100644 --- a/media/formats/mp4/cenc.h +++ b/media/formats/mp4/cenc.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "media/base/decrypt_config.h" namespace media { @@ -16,7 +15,7 @@ namespace mp4 { class BufferReader; struct FrameCENCInfo { - uint8 iv[16]; + uint8_t iv[16]; std::vector<SubsampleEntry> subsamples; FrameCENCInfo(); diff --git a/media/formats/mp4/es_descriptor.cc b/media/formats/mp4/es_descriptor.cc index e1da28a..3377c8c 100644 --- a/media/formats/mp4/es_descriptor.cc +++ b/media/formats/mp4/es_descriptor.cc @@ -9,9 +9,9 @@ // The elementary stream size is specific by up to 4 bytes. // The MSB of a byte indicates if there are more bytes for the size. -static bool ReadESSize(media::BitReader* reader, uint32* size) { - uint8 msb; - uint8 byte; +static bool ReadESSize(media::BitReader* reader, uint32_t* size) { + uint8_t msb; + uint8_t byte; *size = 0; @@ -32,7 +32,7 @@ namespace media { namespace mp4 { // static -bool ESDescriptor::IsAAC(uint8 object_type) { +bool ESDescriptor::IsAAC(uint8_t object_type) { return object_type == kISO_14496_3 || object_type == kISO_13818_7_AAC_LC; } @@ -42,14 +42,14 @@ ESDescriptor::ESDescriptor() ESDescriptor::~ESDescriptor() {} -bool ESDescriptor::Parse(const std::vector<uint8>& data) { +bool ESDescriptor::Parse(const std::vector<uint8_t>& data) { BitReader reader(&data[0], data.size()); - uint8 tag; - uint32 size; - uint8 stream_dependency_flag; - uint8 url_flag; - uint8 ocr_stream_flag; - uint16 dummy; + uint8_t tag; + uint32_t size; + uint8_t stream_dependency_flag; + uint8_t url_flag; + uint8_t ocr_stream_flag; + uint16_t dummy; RCHECK(reader.ReadBits(8, &tag)); RCHECK(tag == kESDescrTag); @@ -72,18 +72,18 @@ bool ESDescriptor::Parse(const std::vector<uint8>& data) { return true; } -uint8 ESDescriptor::object_type() const { +uint8_t ESDescriptor::object_type() const { return object_type_; } -const std::vector<uint8>& ESDescriptor::decoder_specific_info() const { +const std::vector<uint8_t>& ESDescriptor::decoder_specific_info() const { return decoder_specific_info_; } bool ESDescriptor::ParseDecoderConfigDescriptor(BitReader* reader) { - uint8 tag; - uint32 size; - uint64 dummy; + uint8_t tag; + uint32_t size; + uint64_t dummy; RCHECK(reader->ReadBits(8, &tag)); RCHECK(tag == kDecoderConfigDescrTag); @@ -98,15 +98,15 @@ bool ESDescriptor::ParseDecoderConfigDescriptor(BitReader* reader) { } bool ESDescriptor::ParseDecoderSpecificInfo(BitReader* reader) { - uint8 tag; - uint32 size; + uint8_t tag; + uint32_t size; RCHECK(reader->ReadBits(8, &tag)); RCHECK(tag == kDecoderSpecificInfoTag); RCHECK(ReadESSize(reader, &size)); decoder_specific_info_.resize(size); - for (uint32 i = 0; i < size; ++i) + for (uint32_t i = 0; i < size; ++i) RCHECK(reader->ReadBits(8, &decoder_specific_info_[i])); return true; diff --git a/media/formats/mp4/es_descriptor.h b/media/formats/mp4/es_descriptor.h index 1df4526..26ca86d 100644 --- a/media/formats/mp4/es_descriptor.h +++ b/media/formats/mp4/es_descriptor.h @@ -5,9 +5,10 @@ #ifndef MEDIA_FORMATS_MP4_ES_DESCRIPTOR_H_ #define MEDIA_FORMATS_MP4_ES_DESCRIPTOR_H_ +#include <stdint.h> + #include <vector> -#include "base/basictypes.h" #include "media/base/media_export.h" namespace media { @@ -30,15 +31,15 @@ enum ObjectType { class MEDIA_EXPORT ESDescriptor { public: // Utility function to check if the given object type is AAC. - static bool IsAAC(uint8 object_type); + static bool IsAAC(uint8_t object_type); ESDescriptor(); ~ESDescriptor(); - bool Parse(const std::vector<uint8>& data); + bool Parse(const std::vector<uint8_t>& data); - uint8 object_type() const; - const std::vector<uint8>& decoder_specific_info() const; + uint8_t object_type() const; + const std::vector<uint8_t>& decoder_specific_info() const; private: enum Tag { @@ -50,8 +51,8 @@ class MEDIA_EXPORT ESDescriptor { bool ParseDecoderConfigDescriptor(BitReader* reader); bool ParseDecoderSpecificInfo(BitReader* reader); - uint8 object_type_; - std::vector<uint8> decoder_specific_info_; + uint8_t object_type_; + std::vector<uint8_t> decoder_specific_info_; }; } // namespace mp4 diff --git a/media/formats/mp4/es_descriptor_unittest.cc b/media/formats/mp4/es_descriptor_unittest.cc index 6334f5b..4a0262b 100644 --- a/media/formats/mp4/es_descriptor_unittest.cc +++ b/media/formats/mp4/es_descriptor_unittest.cc @@ -12,13 +12,10 @@ namespace mp4 { TEST(ESDescriptorTest, SingleByteLengthTest) { ESDescriptor es_desc; - uint8 buffer[] = { - 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, - 0x06, 0x01, 0x02 - }; - std::vector<uint8> data; + uint8_t buffer[] = {0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40, 0x15, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -32,13 +29,10 @@ TEST(ESDescriptorTest, SingleByteLengthTest) { TEST(ESDescriptorTest, NonAACTest) { ESDescriptor es_desc; - uint8 buffer[] = { - 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66, - 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, - 0x06, 0x01, 0x02 - }; - std::vector<uint8> data; + uint8_t buffer[] = {0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66, 0x15, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -51,14 +45,11 @@ TEST(ESDescriptorTest, NonAACTest) { TEST(ESDescriptorTest, MultiByteLengthTest) { ESDescriptor es_desc; - uint8 buffer[] = { - 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, - 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, 0x01, - 0x02 - }; - std::vector<uint8> data; + uint8_t buffer[] = {0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 0x80, + 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x80, 0x80, + 0x02, 0x12, 0x10, 0x06, 0x01, 0x02}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); @@ -71,14 +62,11 @@ TEST(ESDescriptorTest, MultiByteLengthTest) { TEST(ESDescriptorTest, FiveByteLengthTest) { ESDescriptor es_desc; - uint8 buffer[] = { - 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, - 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x80, 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, - 0x01, 0x02 - }; - std::vector<uint8> data; + uint8_t buffer[] = {0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 0x80, + 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x80, 0x80, + 0x80, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02}; + std::vector<uint8_t> data; data.assign(buffer, buffer + sizeof(buffer)); diff --git a/media/formats/mp4/hevc.cc b/media/formats/mp4/hevc.cc index 4d6b53e..ff964b0 100644 --- a/media/formats/mp4/hevc.cc +++ b/media/formats/mp4/hevc.cc @@ -44,7 +44,7 @@ bool HEVCDecoderConfigurationRecord::Parse(BoxReader* reader) { return ParseInternal(reader, reader->media_log()); } -bool HEVCDecoderConfigurationRecord::Parse(const uint8* data, int data_size) { +bool HEVCDecoderConfigurationRecord::Parse(const uint8_t* data, int data_size) { BufferReader reader(data, data_size); return ParseInternal(&reader, new MediaLog()); } @@ -57,10 +57,10 @@ HEVCDecoderConfigurationRecord::HVCCNALArray::~HVCCNALArray() {} bool HEVCDecoderConfigurationRecord::ParseInternal( BufferReader* reader, const scoped_refptr<MediaLog>& media_log) { - uint8 profile_indication = 0; - uint32 general_constraint_indicator_flags_hi = 0; - uint16 general_constraint_indicator_flags_lo = 0; - uint8 misc = 0; + uint8_t profile_indication = 0; + uint32_t general_constraint_indicator_flags_hi = 0; + uint16_t general_constraint_indicator_flags_lo = 0; + uint8_t misc = 0; RCHECK(reader->Read1(&configurationVersion) && configurationVersion == 1 && reader->Read1(&profile_indication) && reader->Read4(&general_profile_compatibility_flags) && @@ -97,13 +97,13 @@ bool HEVCDecoderConfigurationRecord::ParseInternal( DVLOG(2) << __FUNCTION__ << " numOfArrays=" << (int)numOfArrays; arrays.resize(numOfArrays); - for (uint32 j = 0; j < numOfArrays; j++) { + for (uint32_t j = 0; j < numOfArrays; j++) { RCHECK(reader->Read1(&arrays[j].first_byte)); - uint16 numNalus = 0; + uint16_t numNalus = 0; RCHECK(reader->Read2(&numNalus)); arrays[j].units.resize(numNalus); - for (uint32 i = 0; i < numNalus; ++i) { - uint16 naluLength = 0; + for (uint32_t i = 0; i < numNalus; ++i) { + uint16_t naluLength = 0; RCHECK(reader->Read2(&naluLength) && reader->ReadVec(&arrays[j].units[i], naluLength)); DVLOG(4) << __FUNCTION__ << " naluType=" @@ -119,24 +119,24 @@ bool HEVCDecoderConfigurationRecord::ParseInternal( return true; } -static const uint8 kAnnexBStartCode[] = {0, 0, 0, 1}; +static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; static const int kAnnexBStartCodeSize = 4; bool HEVC::InsertParamSetsAnnexB( const HEVCDecoderConfigurationRecord& hevc_config, - std::vector<uint8>* buffer, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples) { DCHECK(HEVC::IsValidAnnexB(*buffer, *subsamples)); scoped_ptr<H265Parser> parser(new H265Parser()); - const uint8* start = &(*buffer)[0]; + const uint8_t* start = &(*buffer)[0]; parser->SetEncryptedStream(start, buffer->size(), *subsamples); H265NALU nalu; if (parser->AdvanceToNextNALU(&nalu) != H265Parser::kOk) return false; - std::vector<uint8>::iterator config_insert_point = buffer->begin(); + std::vector<uint8_t>::iterator config_insert_point = buffer->begin(); if (nalu.nal_unit_type == H265NALU::AUD_NUT) { // Move insert point to just after the AUD. @@ -148,7 +148,7 @@ bool HEVC::InsertParamSetsAnnexB( parser.reset(); start = NULL; - std::vector<uint8> param_sets; + std::vector<uint8_t> param_sets; RCHECK(HEVC::ConvertConfigToAnnexB(hevc_config, ¶m_sets)); DVLOG(4) << __FUNCTION__ << " converted hvcC to AnnexB " << " size=" << param_sets.size() << " inserted at " @@ -170,12 +170,12 @@ bool HEVC::InsertParamSetsAnnexB( bool HEVC::ConvertConfigToAnnexB( const HEVCDecoderConfigurationRecord& hevc_config, - std::vector<uint8>* buffer) { + std::vector<uint8_t>* buffer) { DCHECK(buffer->empty()); buffer->clear(); for (size_t j = 0; j < hevc_config.arrays.size(); j++) { - uint8 naluType = hevc_config.arrays[j].first_byte & 0x3f; + uint8_t naluType = hevc_config.arrays[j].first_byte & 0x3f; for (size_t i = 0; i < hevc_config.arrays[j].units.size(); ++i) { DVLOG(3) << __FUNCTION__ << " naluType=" << (int)naluType << " size=" << hevc_config.arrays[j].units[i].size(); @@ -190,12 +190,13 @@ bool HEVC::ConvertConfigToAnnexB( } // Verifies AnnexB NALU order according to section 7.4.2.4.4 of ISO/IEC 23008-2. -bool HEVC::IsValidAnnexB(const std::vector<uint8>& buffer, +bool HEVC::IsValidAnnexB(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>& subsamples) { return IsValidAnnexB(&buffer[0], buffer.size(), subsamples); } -bool HEVC::IsValidAnnexB(const uint8* buffer, size_t size, +bool HEVC::IsValidAnnexB(const uint8_t* buffer, + size_t size, const std::vector<SubsampleEntry>& subsamples) { DCHECK(buffer); @@ -216,7 +217,7 @@ HEVCBitstreamConverter::~HEVCBitstreamConverter() { } bool HEVCBitstreamConverter::ConvertFrame( - std::vector<uint8>* frame_buf, + std::vector<uint8_t>* frame_buf, bool is_keyframe, std::vector<SubsampleEntry>* subsamples) const { RCHECK(AVC::ConvertFrameToAnnexB(hevc_config_->lengthSizeMinusOne + 1, diff --git a/media/formats/mp4/hevc.h b/media/formats/mp4/hevc.h index 06974c0d..bb53e01 100644 --- a/media/formats/mp4/hevc.h +++ b/media/formats/mp4/hevc.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" #include "media/formats/mp4/bitstream_converter.h" @@ -27,32 +26,32 @@ struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box { // context and therefore the box header is not expected to be present // in |data|. // Returns true if |data| was successfully parsed. - bool Parse(const uint8* data, int data_size); - - uint8 configurationVersion; - uint8 general_profile_space; - uint8 general_tier_flag; - uint8 general_profile_idc; - uint32 general_profile_compatibility_flags; - uint64 general_constraint_indicator_flags; - uint8 general_level_idc; - uint16 min_spatial_segmentation_idc; - uint8 parallelismType; - uint8 chromaFormat; - uint8 bitDepthLumaMinus8; - uint8 bitDepthChromaMinus8; - uint16 avgFrameRate; - uint8 constantFrameRate; - uint8 numTemporalLayers; - uint8 temporalIdNested; - uint8 lengthSizeMinusOne; - uint8 numOfArrays; - - typedef std::vector<uint8> HVCCNALUnit; + bool Parse(const uint8_t* data, int data_size); + + uint8_t configurationVersion; + uint8_t general_profile_space; + uint8_t general_tier_flag; + uint8_t general_profile_idc; + uint32_t general_profile_compatibility_flags; + uint64_t general_constraint_indicator_flags; + uint8_t general_level_idc; + uint16_t min_spatial_segmentation_idc; + uint8_t parallelismType; + uint8_t chromaFormat; + uint8_t bitDepthLumaMinus8; + uint8_t bitDepthChromaMinus8; + uint16_t avgFrameRate; + uint8_t constantFrameRate; + uint8_t numTemporalLayers; + uint8_t temporalIdNested; + uint8_t lengthSizeMinusOne; + uint8_t numOfArrays; + + typedef std::vector<uint8_t> HVCCNALUnit; struct HVCCNALArray { HVCCNALArray(); ~HVCCNALArray(); - uint8 first_byte; + uint8_t first_byte; std::vector<HVCCNALUnit> units; }; std::vector<HVCCNALArray> arrays; @@ -66,11 +65,11 @@ class MEDIA_EXPORT HEVC { public: static bool ConvertConfigToAnnexB( const HEVCDecoderConfigurationRecord& hevc_config, - std::vector<uint8>* buffer); + std::vector<uint8_t>* buffer); static bool InsertParamSetsAnnexB( const HEVCDecoderConfigurationRecord& hevc_config, - std::vector<uint8>* buffer, + std::vector<uint8_t>* buffer, std::vector<SubsampleEntry>* subsamples); // Verifies that the contents of |buffer| conform to @@ -80,9 +79,10 @@ class MEDIA_EXPORT HEVC { // Returns true if |buffer| contains conformant Annex B data // TODO(servolk): Remove the std::vector version when we can use, // C++11's std::vector<T>::data() method. - static bool IsValidAnnexB(const std::vector<uint8>& buffer, + static bool IsValidAnnexB(const std::vector<uint8_t>& buffer, const std::vector<SubsampleEntry>& subsamples); - static bool IsValidAnnexB(const uint8* buffer, size_t size, + static bool IsValidAnnexB(const uint8_t* buffer, + size_t size, const std::vector<SubsampleEntry>& subsamples); }; @@ -92,9 +92,10 @@ class HEVCBitstreamConverter : public BitstreamConverter { scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config); // BitstreamConverter interface - bool ConvertFrame(std::vector<uint8>* frame_buf, + bool ConvertFrame(std::vector<uint8_t>* frame_buf, bool is_keyframe, std::vector<SubsampleEntry>* subsamples) const override; + private: ~HEVCBitstreamConverter() override; scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config_; diff --git a/media/formats/mp4/mp4_stream_parser_unittest.cc b/media/formats/mp4/mp4_stream_parser_unittest.cc index 60e4165..9d3d169 100644 --- a/media/formats/mp4/mp4_stream_parser_unittest.cc +++ b/media/formats/mp4/mp4_stream_parser_unittest.cc @@ -62,13 +62,15 @@ class MP4StreamParserTest : public testing::Test { VideoDecoderConfig video_decoder_config_; DecodeTimestamp lower_bound_; - bool AppendData(const uint8* data, size_t length) { + bool AppendData(const uint8_t* data, size_t length) { return parser_->Parse(data, length); } - bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { - const uint8* start = data; - const uint8* end = data + length; + bool AppendDataInPieces(const uint8_t* data, + size_t length, + size_t piece_size) { + const uint8_t* start = data; + const uint8_t* end = data + length; while (start < end) { size_t append_size = std::min(piece_size, static_cast<size_t>(end - start)); @@ -140,7 +142,7 @@ class MP4StreamParserTest : public testing::Test { return true; } - void KeyNeededF(EmeInitDataType type, const std::vector<uint8>& init_data) { + void KeyNeededF(EmeInitDataType type, const std::vector<uint8_t>& init_data) { DVLOG(1) << "KeyNeededF: " << init_data.size(); EXPECT_EQ(EmeInitDataType::CENC, type); EXPECT_FALSE(init_data.empty()); diff --git a/media/formats/mp4/sample_to_group_iterator.h b/media/formats/mp4/sample_to_group_iterator.h index c2ea60f..9ed6945 100644 --- a/media/formats/mp4/sample_to_group_iterator.h +++ b/media/formats/mp4/sample_to_group_iterator.h @@ -30,13 +30,13 @@ class MEDIA_EXPORT SampleToGroupIterator { bool IsValid() const; // Returns group description index for current sample. - uint32 group_description_index() const { + uint32_t group_description_index() const { return iterator_->group_description_index; } private: // Track how many samples remaining for current table entry. - uint32 remaining_samples_; + uint32_t remaining_samples_; const std::vector<SampleToGroupEntry>& sample_to_group_table_; std::vector<SampleToGroupEntry>::const_iterator iterator_; diff --git a/media/formats/mp4/sample_to_group_iterator_unittest.cc b/media/formats/mp4/sample_to_group_iterator_unittest.cc index 3e8148c..d4486f7 100644 --- a/media/formats/mp4/sample_to_group_iterator_unittest.cc +++ b/media/formats/mp4/sample_to_group_iterator_unittest.cc @@ -20,7 +20,8 @@ class SampleToGroupIteratorTest : public testing::Test { SampleToGroupIteratorTest() { // Build sample group description index table from kSampleToGroupTable. for (size_t i = 0; i < arraysize(kCompactSampleToGroupTable); ++i) { - for (uint32 j = 0; j < kCompactSampleToGroupTable[i].sample_count; ++j) { + for (uint32_t j = 0; j < kCompactSampleToGroupTable[i].sample_count; + ++j) { sample_to_group_table_.push_back( kCompactSampleToGroupTable[i].group_description_index); } @@ -34,7 +35,7 @@ class SampleToGroupIteratorTest : public testing::Test { } protected: - std::vector<uint32> sample_to_group_table_; + std::vector<uint32_t> sample_to_group_table_; SampleToGroup sample_to_group_; scoped_ptr<SampleToGroupIterator> sample_to_group_iterator_; @@ -51,7 +52,7 @@ TEST_F(SampleToGroupIteratorTest, EmptyTable) { TEST_F(SampleToGroupIteratorTest, Advance) { ASSERT_EQ(sample_to_group_table_[0], sample_to_group_iterator_->group_description_index()); - for (uint32 sample = 1; sample < sample_to_group_table_.size(); ++sample) { + for (uint32_t sample = 1; sample < sample_to_group_table_.size(); ++sample) { ASSERT_TRUE(sample_to_group_iterator_->Advance()); ASSERT_EQ(sample_to_group_table_[sample], sample_to_group_iterator_->group_description_index()); diff --git a/media/formats/mp4/track_run_iterator_unittest.cc b/media/formats/mp4/track_run_iterator_unittest.cc index e220f91..9221cc4 100644 --- a/media/formats/mp4/track_run_iterator_unittest.cc +++ b/media/formats/mp4/track_run_iterator_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_split.h" @@ -22,33 +21,27 @@ static const int kSumAscending1 = 45; static const int kAudioScale = 48000; static const int kVideoScale = 25; -static const uint8 kAuxInfo[] = { - 0x41, 0x54, 0x65, 0x73, 0x74, 0x49, 0x76, 0x31, - 0x41, 0x54, 0x65, 0x73, 0x74, 0x49, 0x76, 0x32, - 0x00, 0x02, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x03, 0x00, 0x00, 0x00, 0x04 -}; +static const uint8_t kAuxInfo[] = { + 0x41, 0x54, 0x65, 0x73, 0x74, 0x49, 0x76, 0x31, 0x41, 0x54, + 0x65, 0x73, 0x74, 0x49, 0x76, 0x32, 0x00, 0x02, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04}; static const char kIv1[] = { 0x41, 0x54, 0x65, 0x73, 0x74, 0x49, 0x76, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uint8 kKeyId[] = { - 0x41, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x54, - 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x49, 0x44 -}; +static const uint8_t kKeyId[] = {0x41, 0x47, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x54, 0x65, 0x73, 0x74, 0x4b, + 0x65, 0x79, 0x49, 0x44}; -static const uint8 kTrackCencSampleGroupKeyId[] = { - 0x46, 0x72, 0x61, 0x67, 0x53, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b -}; +static const uint8_t kTrackCencSampleGroupKeyId[] = { + 0x46, 0x72, 0x61, 0x67, 0x53, 0x61, 0x6d, 0x70, + 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b}; -static const uint8 kFragmentCencSampleGroupKeyId[] = { - 0x6b, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x43, 0x65, 0x6e, 0x63, 0x53, 0x61, 0x6d -}; +static const uint8_t kFragmentCencSampleGroupKeyId[] = { + 0x6b, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x43, 0x65, 0x6e, 0x63, 0x53, 0x61, 0x6d}; namespace media { namespace mp4 { @@ -99,7 +92,7 @@ class TrackRunIteratorTest : public testing::Test { moov_.tracks[2].media.information.sample_table.description.type = kHint; } - uint32 ToSampleFlags(const std::string& str) { + uint32_t ToSampleFlags(const std::string& str) { CHECK_EQ(str.length(), 2u); SampleDependsOn sample_depends_on = kSampleDependsOnReserved; @@ -135,7 +128,7 @@ class TrackRunIteratorTest : public testing::Test { << str[1] << "'"; break; } - uint32 flags = static_cast<uint32>(sample_depends_on) << 24; + uint32_t flags = static_cast<uint32_t>(sample_depends_on) << 24; if (is_non_sync_sample) flags |= kSampleIsNonSyncSample; return flags; @@ -272,19 +265,19 @@ class TrackRunIteratorTest : public testing::Test { bool InitMoofWithArbitraryAuxInfo(MovieFragment* moof) { // Add aux info header (equal sized aux info for every sample). - for (uint32 i = 0; i < moof->tracks.size(); ++i) { + for (uint32_t i = 0; i < moof->tracks.size(); ++i) { moof->tracks[i].auxiliary_offset.offsets.push_back(50); moof->tracks[i].auxiliary_size.sample_count = 10; moof->tracks[i].auxiliary_size.default_sample_info_size = 8; } // We don't care about the actual data in aux. - std::vector<uint8> aux_info(1000); + std::vector<uint8_t> aux_info(1000); return iter_->Init(*moof) && iter_->CacheAuxInfo(&aux_info[0], aux_info.size()); } - void SetAscending(std::vector<uint32>* vec) { + void SetAscending(std::vector<uint32_t>* vec) { vec->resize(10); for (size_t i = 0; i < vec->size(); i++) (*vec)[i] = i+1; @@ -335,7 +328,7 @@ TEST_F(TrackRunIteratorTest, BasicOperationTest) { EXPECT_EQ(iter_->track_id(), 2u); EXPECT_EQ(iter_->sample_offset(), 200 + kSumAscending1); EXPECT_EQ(iter_->sample_size(), 10); - int64 base_dts = kSumAscending1 + moof.tracks[1].decode_time.decode_time; + int64_t base_dts = kSumAscending1 + moof.tracks[1].decode_time.decode_time; EXPECT_EQ(iter_->dts(), DecodeTimestampFromRational(base_dts, kVideoScale)); EXPECT_EQ(iter_->duration(), TimeDeltaFromRational(10, kVideoScale)); EXPECT_FALSE(iter_->is_keyframe()); @@ -438,8 +431,8 @@ TEST_F(TrackRunIteratorTest, ReorderingTest) { // maximum compatibility, these values are biased up to [2, 5, 0], and the // extra 80ms is removed via the edit list. MovieFragment moof = CreateFragment(); - std::vector<int32>& cts_offsets = - moof.tracks[1].runs[0].sample_composition_time_offsets; + std::vector<int32_t>& cts_offsets = + moof.tracks[1].runs[0].sample_composition_time_offsets; cts_offsets.resize(10); cts_offsets[0] = 2; cts_offsets[1] = 5; @@ -487,7 +480,7 @@ TEST_F(TrackRunIteratorTest, DecryptConfigTest) { EXPECT_EQ(iter_->track_id(), 2u); EXPECT_TRUE(iter_->is_encrypted()); EXPECT_TRUE(iter_->AuxInfoNeedsToBeCached()); - EXPECT_EQ(static_cast<uint32>(iter_->aux_info_size()), arraysize(kAuxInfo)); + EXPECT_EQ(static_cast<uint32_t>(iter_->aux_info_size()), arraysize(kAuxInfo)); EXPECT_EQ(iter_->aux_info_offset(), 50); EXPECT_EQ(iter_->GetMaxClearOffset(), 50); EXPECT_FALSE(iter_->CacheAuxInfo(NULL, 0)); diff --git a/media/formats/mpeg/adts_stream_parser.cc b/media/formats/mpeg/adts_stream_parser.cc index a59d9ba..90b3689c 100644 --- a/media/formats/mpeg/adts_stream_parser.cc +++ b/media/formats/mpeg/adts_stream_parser.cc @@ -8,14 +8,14 @@ namespace media { -static const uint32 kADTSStartCodeMask = 0xfff00000; +static const uint32_t kADTSStartCodeMask = 0xfff00000; ADTSStreamParser::ADTSStreamParser() : MPEGAudioStreamParserBase(kADTSStartCodeMask, kCodecAAC, 0) {} ADTSStreamParser::~ADTSStreamParser() {} -int ADTSStreamParser::ParseFrameHeader(const uint8* data, +int ADTSStreamParser::ParseFrameHeader(const uint8_t* data, int size, int* frame_size, int* sample_rate, diff --git a/media/formats/mpeg/adts_stream_parser.h b/media/formats/mpeg/adts_stream_parser.h index d08351b..a8ecdbb 100644 --- a/media/formats/mpeg/adts_stream_parser.h +++ b/media/formats/mpeg/adts_stream_parser.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FORMATS_MPEG_ADTS_STREAM_PARSER_H_ #define MEDIA_FORMATS_MPEG_ADTS_STREAM_PARSER_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" @@ -18,7 +17,7 @@ class MEDIA_EXPORT ADTSStreamParser : public MPEGAudioStreamParserBase { private: // MPEGAudioStreamParserBase overrides. - int ParseFrameHeader(const uint8* data, + int ParseFrameHeader(const uint8_t* data, int size, int* frame_size, int* sample_rate, diff --git a/media/formats/mpeg/mpeg1_audio_stream_parser.cc b/media/formats/mpeg/mpeg1_audio_stream_parser.cc index 67b3705..410c70d 100644 --- a/media/formats/mpeg/mpeg1_audio_stream_parser.cc +++ b/media/formats/mpeg/mpeg1_audio_stream_parser.cc @@ -6,7 +6,7 @@ namespace media { -static const uint32 kMPEG1StartCodeMask = 0xffe00000; +static const uint32_t kMPEG1StartCodeMask = 0xffe00000; // Map that determines which bitrate_index & channel_mode combinations // are allowed. @@ -88,7 +88,7 @@ static const int kCodecDelay = 529; // static bool MPEG1AudioStreamParser::ParseHeader( const scoped_refptr<MediaLog>& media_log, - const uint8* data, + const uint8_t* data, Header* header) { BitReader reader(data, kHeaderSize); int sync; @@ -221,7 +221,7 @@ MPEG1AudioStreamParser::MPEG1AudioStreamParser() MPEG1AudioStreamParser::~MPEG1AudioStreamParser() {} -int MPEG1AudioStreamParser::ParseFrameHeader(const uint8* data, +int MPEG1AudioStreamParser::ParseFrameHeader(const uint8_t* data, int size, int* frame_size, int* sample_rate, diff --git a/media/formats/mpeg/mpeg1_audio_stream_parser.h b/media/formats/mpeg/mpeg1_audio_stream_parser.h index 3b299a1..de9b138 100644 --- a/media/formats/mpeg/mpeg1_audio_stream_parser.h +++ b/media/formats/mpeg/mpeg1_audio_stream_parser.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_ #define MEDIA_FORMATS_MPEG_MPEG1_AUDIO_STREAM_PARSER_H_ -#include "base/basictypes.h" #include "media/base/media_export.h" #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h" @@ -63,7 +62,7 @@ class MEDIA_EXPORT MPEG1AudioStreamParser : public MPEGAudioStreamParserBase { // Assumption: size of array |data| should be at least |kHeaderSize|. // Returns false if the header is not valid. static bool ParseHeader(const scoped_refptr<MediaLog>& media_log, - const uint8* data, + const uint8_t* data, Header* header); MPEG1AudioStreamParser(); @@ -71,7 +70,7 @@ class MEDIA_EXPORT MPEG1AudioStreamParser : public MPEGAudioStreamParserBase { private: // MPEGAudioStreamParserBase overrides. - int ParseFrameHeader(const uint8* data, + int ParseFrameHeader(const uint8_t* data, int size, int* frame_size, int* sample_rate, diff --git a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc index 23032fa..4dc9df7 100644 --- a/media/formats/mpeg/mpeg_audio_stream_parser_base.cc +++ b/media/formats/mpeg/mpeg_audio_stream_parser_base.cc @@ -14,17 +14,17 @@ namespace media { -static const uint32 kICYStartCode = 0x49435920; // 'ICY ' +static const uint32_t kICYStartCode = 0x49435920; // 'ICY ' // Arbitrary upper bound on the size of an IceCast header before it // triggers an error. static const int kMaxIcecastHeaderSize = 4096; -static const uint32 kID3StartCodeMask = 0xffffff00; -static const uint32 kID3v1StartCode = 0x54414700; // 'TAG\0' +static const uint32_t kID3StartCodeMask = 0xffffff00; +static const uint32_t kID3v1StartCode = 0x54414700; // 'TAG\0' static const int kID3v1Size = 128; static const int kID3v1ExtendedSize = 227; -static const uint32 kID3v2StartCode = 0x49443300; // 'ID3\0' +static const uint32_t kID3v2StartCode = 0x49443300; // 'ID3\0' static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { bool was_lf = false; @@ -43,7 +43,7 @@ static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) { return -1; } -MPEGAudioStreamParserBase::MPEGAudioStreamParserBase(uint32 start_code_mask, +MPEGAudioStreamParserBase::MPEGAudioStreamParserBase(uint32_t start_code_mask, AudioCodec audio_codec, int codec_delay) : state_(UNINITIALIZED), @@ -84,7 +84,7 @@ void MPEGAudioStreamParserBase::Flush() { in_media_segment_ = false; } -bool MPEGAudioStreamParserBase::Parse(const uint8* buf, int size) { +bool MPEGAudioStreamParserBase::Parse(const uint8_t* buf, int size) { DVLOG(1) << __FUNCTION__ << "(" << size << ")"; DCHECK(buf); DCHECK_GT(size, 0); @@ -100,14 +100,15 @@ bool MPEGAudioStreamParserBase::Parse(const uint8* buf, int size) { bool end_of_segment = true; BufferQueue buffers; for (;;) { - const uint8* data; + const uint8_t* data; int data_size; queue_.Peek(&data, &data_size); if (data_size < 4) break; - uint32 start_code = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; + uint32_t start_code = + data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; int bytes_read = 0; bool parsed_metadata = true; if ((start_code & start_code_mask_) == start_code_mask_) { @@ -161,7 +162,7 @@ void MPEGAudioStreamParserBase::ChangeState(State state) { state_ = state; } -int MPEGAudioStreamParserBase::ParseFrame(const uint8* data, +int MPEGAudioStreamParserBase::ParseFrame(const uint8_t* data, int size, BufferQueue* buffers) { DVLOG(2) << __FUNCTION__ << "(" << size << ")"; @@ -248,7 +249,8 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8* data, return frame_size; } -int MPEGAudioStreamParserBase::ParseIcecastHeader(const uint8* data, int size) { +int MPEGAudioStreamParserBase::ParseIcecastHeader(const uint8_t* data, + int size) { DVLOG(1) << __FUNCTION__ << "(" << size << ")"; if (size < 4) @@ -271,7 +273,7 @@ int MPEGAudioStreamParserBase::ParseIcecastHeader(const uint8* data, int size) { return offset; } -int MPEGAudioStreamParserBase::ParseID3v1(const uint8* data, int size) { +int MPEGAudioStreamParserBase::ParseID3v1(const uint8_t* data, int size) { DVLOG(1) << __FUNCTION__ << "(" << size << ")"; if (size < kID3v1Size) @@ -282,17 +284,17 @@ int MPEGAudioStreamParserBase::ParseID3v1(const uint8* data, int size) { return !memcmp(data, "TAG+", 4) ? kID3v1ExtendedSize : kID3v1Size; } -int MPEGAudioStreamParserBase::ParseID3v2(const uint8* data, int size) { +int MPEGAudioStreamParserBase::ParseID3v2(const uint8_t* data, int size) { DVLOG(1) << __FUNCTION__ << "(" << size << ")"; if (size < 10) return 0; BitReader reader(data, size); - int32 id; + int32_t id; int version; - uint8 flags; - int32 id3_size; + uint8_t flags; + int32_t id3_size; if (!reader.ReadBits(24, &id) || !reader.ReadBits(16, &version) || @@ -301,7 +303,7 @@ int MPEGAudioStreamParserBase::ParseID3v2(const uint8* data, int size) { return -1; } - int32 actual_tag_size = 10 + id3_size; + int32_t actual_tag_size = 10 + id3_size; // Increment size if 'Footer present' flag is set. if (flags & 0x10) @@ -317,10 +319,10 @@ int MPEGAudioStreamParserBase::ParseID3v2(const uint8* data, int size) { } bool MPEGAudioStreamParserBase::ParseSyncSafeInt(BitReader* reader, - int32* value) { + int32_t* value) { *value = 0; for (int i = 0; i < 4; ++i) { - uint8 tmp; + uint8_t tmp; if (!reader->ReadBits(1, &tmp) || tmp != 0) { MEDIA_LOG(ERROR, media_log_) << "ID3 syncsafe integer byte MSb is not 0!"; return false; @@ -336,21 +338,21 @@ bool MPEGAudioStreamParserBase::ParseSyncSafeInt(BitReader* reader, return true; } -int MPEGAudioStreamParserBase::FindNextValidStartCode(const uint8* data, +int MPEGAudioStreamParserBase::FindNextValidStartCode(const uint8_t* data, int size) const { - const uint8* start = data; - const uint8* end = data + size; + const uint8_t* start = data; + const uint8_t* end = data + size; while (start < end) { int bytes_left = end - start; - const uint8* candidate_start_code = - static_cast<const uint8*>(memchr(start, 0xff, bytes_left)); + const uint8_t* candidate_start_code = + static_cast<const uint8_t*>(memchr(start, 0xff, bytes_left)); if (!candidate_start_code) return 0; bool parse_header_failed = false; - const uint8* sync = candidate_start_code; + const uint8_t* sync = candidate_start_code; // Try to find 3 valid frames in a row. 3 was selected to decrease // the probability of false positives. for (int i = 0; i < 3; ++i) { diff --git a/media/formats/mpeg/mpeg_audio_stream_parser_base.h b/media/formats/mpeg/mpeg_audio_stream_parser_base.h index 8321993..4c81c8f 100644 --- a/media/formats/mpeg/mpeg_audio_stream_parser_base.h +++ b/media/formats/mpeg/mpeg_audio_stream_parser_base.h @@ -8,7 +8,6 @@ #include <set> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "media/base/audio_decoder_config.h" #include "media/base/audio_timestamp_helper.h" @@ -25,7 +24,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { // referred to as the sync code in the MP3 and ADTS header specifications. // |codec_delay| is the number of samples the decoder will output before the // first real frame. - MPEGAudioStreamParserBase(uint32 start_code_mask, + MPEGAudioStreamParserBase(uint32_t start_code_mask, AudioCodec audio_codec, int codec_delay); ~MPEGAudioStreamParserBase() override; @@ -40,7 +39,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { const base::Closure& end_of_segment_cb, const scoped_refptr<MediaLog>& media_log) override; void Flush() override; - bool Parse(const uint8* buf, int size) override; + bool Parse(const uint8_t* buf, int size) override; protected: // Subclasses implement this method to parse format specific frame headers. @@ -73,7 +72,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { // > 0 : The number of bytes parsed. // 0 : If more data is needed to parse the entire frame header. // < 0 : An error was encountered during parsing. - virtual int ParseFrameHeader(const uint8* data, + virtual int ParseFrameHeader(const uint8_t* data, int size, int* frame_size, int* sample_rate, @@ -99,10 +98,10 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { // > 0 : The number of bytes parsed. // 0 : If more data is needed to parse the entire element. // < 0 : An error was encountered during parsing. - int ParseFrame(const uint8* data, int size, BufferQueue* buffers); - int ParseIcecastHeader(const uint8* data, int size); - int ParseID3v1(const uint8* data, int size); - int ParseID3v2(const uint8* data, int size); + int ParseFrame(const uint8_t* data, int size, BufferQueue* buffers); + int ParseIcecastHeader(const uint8_t* data, int size); + int ParseID3v1(const uint8_t* data, int size); + int ParseID3v2(const uint8_t* data, int size); // Parses an ID3v2 "sync safe" integer. // |reader| - A BitReader to read from. @@ -112,7 +111,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { // was set. // Returns false if an error was encountered. The state of |value| is // undefined when false is returned. - bool ParseSyncSafeInt(BitReader* reader, int32* value); + bool ParseSyncSafeInt(BitReader* reader, int32_t* value); // Scans |data| for the next valid start code. // Returns: @@ -120,7 +119,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { // next start code.. // 0 : If a valid start code was not found and more data is needed. // < 0 : An error was encountered during parsing. - int FindNextValidStartCode(const uint8* data, int size) const; + int FindNextValidStartCode(const uint8_t* data, int size) const; // Sends the buffers in |buffers| to |new_buffers_cb_| and then clears // |buffers|. @@ -144,7 +143,7 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { AudioDecoderConfig config_; scoped_ptr<AudioTimestampHelper> timestamp_helper_; bool in_media_segment_; - const uint32 start_code_mask_; + const uint32_t start_code_mask_; const AudioCodec audio_codec_; const int codec_delay_; diff --git a/media/formats/webm/cluster_builder.cc b/media/formats/webm/cluster_builder.cc index 1a3b358..b28b03b 100644 --- a/media/formats/webm/cluster_builder.cc +++ b/media/formats/webm/cluster_builder.cc @@ -10,34 +10,34 @@ namespace media { -static const uint8 kClusterHeader[] = { - 0x1F, 0x43, 0xB6, 0x75, // CLUSTER ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cluster(size = 0) - 0xE7, // Timecode ID - 0x88, // timecode(size=8) - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // timecode value +static const uint8_t kClusterHeader[] = { + 0x1F, 0x43, 0xB6, 0x75, // CLUSTER ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cluster(size = 0) + 0xE7, // Timecode ID + 0x88, // timecode(size=8) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // timecode value }; -static const uint8 kSimpleBlockHeader[] = { - 0xA3, // SimpleBlock ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SimpleBlock(size = 0) +static const uint8_t kSimpleBlockHeader[] = { + 0xA3, // SimpleBlock ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SimpleBlock(size = 0) }; -static const uint8 kBlockGroupHeader[] = { - 0xA0, // BlockGroup ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // BlockGroup(size = 0) - 0x9B, // BlockDuration ID - 0x88, // BlockDuration(size = 8) - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // duration - 0xA1, // Block ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block(size = 0) +static const uint8_t kBlockGroupHeader[] = { + 0xA0, // BlockGroup ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // BlockGroup(size = 0) + 0x9B, // BlockDuration ID + 0x88, // BlockDuration(size = 8) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // duration + 0xA1, // Block ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block(size = 0) }; -static const uint8 kBlockGroupHeaderWithoutBlockDuration[] = { - 0xA0, // BlockGroup ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // BlockGroup(size = 0) - 0xA1, // Block ID - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block(size = 0) +static const uint8_t kBlockGroupHeaderWithoutBlockDuration[] = { + 0xA0, // BlockGroup ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // BlockGroup(size = 0) + 0xA1, // Block ID + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block(size = 0) }; enum { @@ -54,34 +54,37 @@ enum { kInitialBufferSize = 32768, }; -Cluster::Cluster(scoped_ptr<uint8[]> data, int size) +Cluster::Cluster(scoped_ptr<uint8_t[]> data, int size) : data_(data.Pass()), size_(size) {} Cluster::~Cluster() {} ClusterBuilder::ClusterBuilder() { Reset(); } ClusterBuilder::~ClusterBuilder() {} -void ClusterBuilder::SetClusterTimecode(int64 cluster_timecode) { +void ClusterBuilder::SetClusterTimecode(int64_t cluster_timecode) { DCHECK_EQ(cluster_timecode_, -1); cluster_timecode_ = cluster_timecode; // Write the timecode into the header. - uint8* buf = buffer_.get() + kClusterTimecodeOffset; + uint8_t* buf = buffer_.get() + kClusterTimecodeOffset; for (int i = 7; i >= 0; --i) { buf[i] = cluster_timecode & 0xff; cluster_timecode >>= 8; } } -void ClusterBuilder::AddSimpleBlock(int track_num, int64 timecode, int flags, - const uint8* data, int size) { +void ClusterBuilder::AddSimpleBlock(int track_num, + int64_t timecode, + int flags, + const uint8_t* data, + int size) { int block_size = size + 4; int bytes_needed = sizeof(kSimpleBlockHeader) + block_size; if (bytes_needed > (buffer_size_ - bytes_used_)) ExtendBuffer(bytes_needed); - uint8* buf = buffer_.get() + bytes_used_; + uint8_t* buf = buffer_.get() + bytes_used_; int block_offset = bytes_used_; memcpy(buf, kSimpleBlockHeader, sizeof(kSimpleBlockHeader)); UpdateUInt64(block_offset + kSimpleBlockSizeOffset, block_size); @@ -92,24 +95,30 @@ void ClusterBuilder::AddSimpleBlock(int track_num, int64 timecode, int flags, bytes_used_ += bytes_needed; } -void ClusterBuilder::AddBlockGroup(int track_num, int64 timecode, int duration, - int flags, const uint8* data, int size) { +void ClusterBuilder::AddBlockGroup(int track_num, + int64_t timecode, + int duration, + int flags, + const uint8_t* data, + int size) { AddBlockGroupInternal(track_num, timecode, true, duration, flags, data, size); } void ClusterBuilder::AddBlockGroupWithoutBlockDuration(int track_num, - int64 timecode, + int64_t timecode, int flags, - const uint8* data, + const uint8_t* data, int size) { AddBlockGroupInternal(track_num, timecode, false, 0, flags, data, size); } - -void ClusterBuilder::AddBlockGroupInternal(int track_num, int64 timecode, +void ClusterBuilder::AddBlockGroupInternal(int track_num, + int64_t timecode, bool include_block_duration, - int duration, int flags, - const uint8* data, int size) { + int duration, + int flags, + const uint8_t* data, + int size) { int block_size = size + 4; int bytes_needed = block_size; if (include_block_duration) { @@ -123,7 +132,7 @@ void ClusterBuilder::AddBlockGroupInternal(int track_num, int64 timecode, if (bytes_needed > (buffer_size_ - bytes_used_)) ExtendBuffer(bytes_needed); - uint8* buf = buffer_.get() + bytes_used_; + uint8_t* buf = buffer_.get() + bytes_used_; int block_group_offset = bytes_used_; if (include_block_duration) { memcpy(buf, kBlockGroupHeader, sizeof(kBlockGroupHeader)); @@ -150,8 +159,12 @@ void ClusterBuilder::AddBlockGroupInternal(int track_num, int64 timecode, bytes_used_ += bytes_needed; } -void ClusterBuilder::WriteBlock(uint8* buf, int track_num, int64 timecode, - int flags, const uint8* data, int size) { +void ClusterBuilder::WriteBlock(uint8_t* buf, + int track_num, + int64_t timecode, + int flags, + const uint8_t* data, + int size) { DCHECK_GE(track_num, 0); DCHECK_LE(track_num, 126); DCHECK_GE(flags, 0); @@ -160,7 +173,7 @@ void ClusterBuilder::WriteBlock(uint8* buf, int track_num, int64 timecode, DCHECK_GT(size, 0); DCHECK_NE(cluster_timecode_, -1); - int64 timecode_delta = timecode - cluster_timecode_; + int64_t timecode_delta = timecode - cluster_timecode_; DCHECK_GE(timecode_delta, -32768); DCHECK_LE(timecode_delta, 32767); @@ -193,7 +206,7 @@ scoped_ptr<Cluster> ClusterBuilder::FinishWithUnknownSize() { void ClusterBuilder::Reset() { buffer_size_ = kInitialBufferSize; - buffer_.reset(new uint8[buffer_size_]); + buffer_.reset(new uint8_t[buffer_size_]); memcpy(buffer_.get(), kClusterHeader, sizeof(kClusterHeader)); bytes_used_ = sizeof(kClusterHeader); cluster_timecode_ = -1; @@ -205,16 +218,16 @@ void ClusterBuilder::ExtendBuffer(int bytes_needed) { while ((new_buffer_size - bytes_used_) < bytes_needed) new_buffer_size *= 2; - scoped_ptr<uint8[]> new_buffer(new uint8[new_buffer_size]); + scoped_ptr<uint8_t[]> new_buffer(new uint8_t[new_buffer_size]); memcpy(new_buffer.get(), buffer_.get(), bytes_used_); buffer_.reset(new_buffer.release()); buffer_size_ = new_buffer_size; } -void ClusterBuilder::UpdateUInt64(int offset, int64 value) { +void ClusterBuilder::UpdateUInt64(int offset, int64_t value) { DCHECK_LE(offset + 7, buffer_size_); - uint8* buf = buffer_.get() + offset; + uint8_t* buf = buffer_.get() + offset; // Fill the last 7 bytes of size field in big-endian order. for (int i = 7; i > 0; i--) { diff --git a/media/formats/webm/cluster_builder.h b/media/formats/webm/cluster_builder.h index f6f6001..6e32ccc 100644 --- a/media/formats/webm/cluster_builder.h +++ b/media/formats/webm/cluster_builder.h @@ -5,21 +5,20 @@ #ifndef MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ #define MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" namespace media { class Cluster { public: - Cluster(scoped_ptr<uint8[]> data, int size); + Cluster(scoped_ptr<uint8_t[]> data, int size); ~Cluster(); - const uint8* data() const { return data_.get(); } + const uint8_t* data() const { return data_.get(); } int size() const { return size_; } private: - scoped_ptr<uint8[]> data_; + scoped_ptr<uint8_t[]> data_; int size_; DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster); @@ -30,31 +29,49 @@ class ClusterBuilder { ClusterBuilder(); ~ClusterBuilder(); - void SetClusterTimecode(int64 cluster_timecode); - void AddSimpleBlock(int track_num, int64 timecode, int flags, - const uint8* data, int size); - void AddBlockGroup(int track_num, int64 timecode, int duration, int flags, - const uint8* data, int size); - void AddBlockGroupWithoutBlockDuration(int track_num, int64 timecode, - int flags, const uint8* data, int size); + void SetClusterTimecode(int64_t cluster_timecode); + void AddSimpleBlock(int track_num, + int64_t timecode, + int flags, + const uint8_t* data, + int size); + void AddBlockGroup(int track_num, + int64_t timecode, + int duration, + int flags, + const uint8_t* data, + int size); + void AddBlockGroupWithoutBlockDuration(int track_num, + int64_t timecode, + int flags, + const uint8_t* data, + int size); scoped_ptr<Cluster> Finish(); scoped_ptr<Cluster> FinishWithUnknownSize(); private: - void AddBlockGroupInternal(int track_num, int64 timecode, - bool include_block_duration, int duration, - int flags, const uint8* data, int size); + void AddBlockGroupInternal(int track_num, + int64_t timecode, + bool include_block_duration, + int duration, + int flags, + const uint8_t* data, + int size); void Reset(); void ExtendBuffer(int bytes_needed); - void UpdateUInt64(int offset, int64 value); - void WriteBlock(uint8* buf, int track_num, int64 timecode, int flags, - const uint8* data, int size); + void UpdateUInt64(int offset, int64_t value); + void WriteBlock(uint8_t* buf, + int track_num, + int64_t timecode, + int flags, + const uint8_t* data, + int size); - scoped_ptr<uint8[]> buffer_; + scoped_ptr<uint8_t[]> buffer_; int buffer_size_; int bytes_used_; - int64 cluster_timecode_; + int64_t cluster_timecode_; DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); }; diff --git a/media/formats/webm/tracks_builder.cc b/media/formats/webm/tracks_builder.cc index 927c2a4..6b2aaea 100644 --- a/media/formats/webm/tracks_builder.cc +++ b/media/formats/webm/tracks_builder.cc @@ -10,7 +10,7 @@ namespace media { // Returns size of an integer, formatted using Matroska serialization. -static int GetUIntMkvSize(uint64 value) { +static int GetUIntMkvSize(uint64_t value) { if (value < 0x07FULL) return 1; if (value < 0x03FFFULL) @@ -29,7 +29,7 @@ static int GetUIntMkvSize(uint64 value) { } // Returns the minimium size required to serialize an integer value. -static int GetUIntSize(uint64 value) { +static int GetUIntSize(uint64_t value) { if (value < 0x0100ULL) return 1; if (value < 0x010000ULL) @@ -51,7 +51,7 @@ static int MasterElementSize(int element_id, int payload_size) { return GetUIntSize(element_id) + GetUIntMkvSize(payload_size) + payload_size; } -static int UIntElementSize(int element_id, uint64 value) { +static int UIntElementSize(int element_id, uint64_t value) { return GetUIntSize(element_id) + 1 + GetUIntSize(value); } @@ -65,23 +65,26 @@ static int StringElementSize(int element_id, const std::string& value) { value.length(); } -static void SerializeInt(uint8** buf_ptr, int* buf_size_ptr, - int64 value, int size) { - uint8*& buf = *buf_ptr; +static void SerializeInt(uint8_t** buf_ptr, + int* buf_size_ptr, + int64_t value, + int size) { + uint8_t*& buf = *buf_ptr; int& buf_size = *buf_size_ptr; for (int idx = 1; idx <= size; ++idx) { - *buf++ = static_cast<uint8>(value >> ((size - idx) * 8)); + *buf++ = static_cast<uint8_t>(value >> ((size - idx) * 8)); --buf_size; } } -static void SerializeDouble(uint8** buf_ptr, int* buf_size_ptr, +static void SerializeDouble(uint8_t** buf_ptr, + int* buf_size_ptr, double value) { // Use a union to convert |value| to native endian integer bit pattern. union { double src; - int64 dst; + int64_t dst; } tmp; tmp.src = value; @@ -89,26 +92,28 @@ static void SerializeDouble(uint8** buf_ptr, int* buf_size_ptr, SerializeInt(buf_ptr, buf_size_ptr, tmp.dst, 8); } -static void WriteElementId(uint8** buf, int* buf_size, int element_id) { +static void WriteElementId(uint8_t** buf, int* buf_size, int element_id) { SerializeInt(buf, buf_size, element_id, GetUIntSize(element_id)); } -static void WriteUInt(uint8** buf, int* buf_size, uint64 value) { +static void WriteUInt(uint8_t** buf, int* buf_size, uint64_t value) { const int size = GetUIntMkvSize(value); value |= (1ULL << (size * 7)); // Matroska formatting SerializeInt(buf, buf_size, value, size); } -static void WriteMasterElement(uint8** buf, int* buf_size, - int element_id, int payload_size) { +static void WriteMasterElement(uint8_t** buf, + int* buf_size, + int element_id, + int payload_size) { WriteElementId(buf, buf_size, element_id); WriteUInt(buf, buf_size, payload_size); } -static void WriteUIntElement(uint8** buf, +static void WriteUIntElement(uint8_t** buf, int* buf_size, int element_id, - uint64 value) { + uint64_t value) { WriteElementId(buf, buf_size, element_id); const int size = GetUIntSize(value); @@ -117,21 +122,25 @@ static void WriteUIntElement(uint8** buf, SerializeInt(buf, buf_size, value, size); } -static void WriteDoubleElement(uint8** buf, int* buf_size, - int element_id, double value) { +static void WriteDoubleElement(uint8_t** buf, + int* buf_size, + int element_id, + double value) { WriteElementId(buf, buf_size, element_id); WriteUInt(buf, buf_size, 8); SerializeDouble(buf, buf_size, value); } -static void WriteStringElement(uint8** buf_ptr, int* buf_size_ptr, - int element_id, const std::string& value) { - uint8*& buf = *buf_ptr; +static void WriteStringElement(uint8_t** buf_ptr, + int* buf_size_ptr, + int element_id, + const std::string& value) { + uint8_t*& buf = *buf_ptr; int& buf_size = *buf_size_ptr; WriteElementId(&buf, &buf_size, element_id); - const uint64 size = value.length(); + const uint64_t size = value.length(); WriteUInt(&buf, &buf_size, size); memcpy(buf, value.data(), size); @@ -146,7 +155,7 @@ TracksBuilder::TracksBuilder() TracksBuilder::~TracksBuilder() {} void TracksBuilder::AddVideoTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -159,7 +168,7 @@ void TracksBuilder::AddVideoTrack(int track_num, } void TracksBuilder::AddAudioTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -172,7 +181,7 @@ void TracksBuilder::AddAudioTrack(int track_num, } void TracksBuilder::AddTextTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language) { @@ -180,9 +189,9 @@ void TracksBuilder::AddTextTrack(int track_num, codec_id, name, language, -1, -1, -1, -1, -1); } -std::vector<uint8> TracksBuilder::Finish() { +std::vector<uint8_t> TracksBuilder::Finish() { // Allocate the storage - std::vector<uint8> buffer; + std::vector<uint8_t> buffer; buffer.resize(GetTracksSize()); // Populate the storage with a tracks header @@ -193,7 +202,7 @@ std::vector<uint8> TracksBuilder::Finish() { void TracksBuilder::AddTrackInternal(int track_num, int track_type, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -223,7 +232,7 @@ int TracksBuilder::GetTracksPayloadSize() const { return payload_size; } -void TracksBuilder::WriteTracks(uint8* buf, int buf_size) const { +void TracksBuilder::WriteTracks(uint8_t* buf, int buf_size) const { WriteMasterElement(&buf, &buf_size, kWebMIdTracks, GetTracksPayloadSize()); for (TrackList::const_iterator itr = tracks_.begin(); @@ -234,7 +243,7 @@ void TracksBuilder::WriteTracks(uint8* buf, int buf_size) const { TracksBuilder::Track::Track(int track_num, int track_type, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -341,7 +350,7 @@ int TracksBuilder::Track::GetPayloadSize() const { return size; } -void TracksBuilder::Track::Write(uint8** buf, int* buf_size) const { +void TracksBuilder::Track::Write(uint8_t** buf, int* buf_size) const { WriteMasterElement(buf, buf_size, kWebMIdTrackEntry, GetPayloadSize()); WriteUIntElement(buf, buf_size, kWebMIdTrackNumber, track_num_); diff --git a/media/formats/webm/tracks_builder.h b/media/formats/webm/tracks_builder.h index f7786fd..dc0283e 100644 --- a/media/formats/webm/tracks_builder.h +++ b/media/formats/webm/tracks_builder.h @@ -5,11 +5,13 @@ #ifndef MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ #define MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ +#include <stdint.h> + #include <list> #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" namespace media { @@ -28,7 +30,7 @@ class TracksBuilder { // DefaultDuration. Similar applies to |audio_channels|, // |audio_sampling_frequency|, |video_pixel_width| and |video_pixel_height|. void AddVideoTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -36,7 +38,7 @@ class TracksBuilder { int video_pixel_width, int video_pixel_height); void AddAudioTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -44,17 +46,17 @@ class TracksBuilder { int audio_channels, double audio_sampling_frequency); void AddTextTrack(int track_num, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language); - std::vector<uint8> Finish(); + std::vector<uint8_t> Finish(); private: void AddTrackInternal(int track_num, int track_type, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -65,13 +67,13 @@ class TracksBuilder { double audio_sampling_frequency); int GetTracksSize() const; int GetTracksPayloadSize() const; - void WriteTracks(uint8* buffer, int buffer_size) const; + void WriteTracks(uint8_t* buffer, int buffer_size) const; class Track { public: Track(int track_num, int track_type, - uint64 track_uid, + uint64_t track_uid, const std::string& codec_id, const std::string& name, const std::string& language, @@ -83,7 +85,8 @@ class TracksBuilder { bool allow_invalid_values); int GetSize() const; - void Write(uint8** buf, int* buf_size) const; + void Write(uint8_t** buf, int* buf_size) const; + private: int GetPayloadSize() const; int GetVideoPayloadSize() const; diff --git a/media/formats/webm/webm_audio_client.cc b/media/formats/webm/webm_audio_client.cc index 995746a4..fb6a723a 100644 --- a/media/formats/webm/webm_audio_client.cc +++ b/media/formats/webm/webm_audio_client.cc @@ -25,8 +25,11 @@ void WebMAudioClient::Reset() { } bool WebMAudioClient::InitializeConfig( - const std::string& codec_id, const std::vector<uint8>& codec_private, - int64 seek_preroll, int64 codec_delay, bool is_encrypted, + const std::string& codec_id, + const std::vector<uint8_t>& codec_private, + int64_t seek_preroll, + int64_t codec_delay, + bool is_encrypted, AudioDecoderConfig* config) { DCHECK(config); SampleFormat sample_format = kSampleFormatPlanarF32; @@ -88,7 +91,7 @@ bool WebMAudioClient::InitializeConfig( return config->IsValidConfig(); } -bool WebMAudioClient::OnUInt(int id, int64 val) { +bool WebMAudioClient::OnUInt(int id, int64_t val) { if (id == kWebMIdChannels) { if (channels_ != -1) { MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex diff --git a/media/formats/webm/webm_audio_client.h b/media/formats/webm/webm_audio_client.h index 67f5f01..98f0eee 100644 --- a/media/formats/webm/webm_audio_client.h +++ b/media/formats/webm/webm_audio_client.h @@ -30,15 +30,15 @@ class WebMAudioClient : public WebMParserClient { // Returns false if there was unexpected values in the provided parameters or // audio track element fields. bool InitializeConfig(const std::string& codec_id, - const std::vector<uint8>& codec_private, - const int64 seek_preroll, - const int64 codec_delay, + const std::vector<uint8_t>& codec_private, + const int64_t seek_preroll, + const int64_t codec_delay, bool is_encrypted, AudioDecoderConfig* config); private: // WebMParserClient implementation. - bool OnUInt(int id, int64 val) override; + bool OnUInt(int id, int64_t val) override; bool OnFloat(int id, double val) override; scoped_refptr<MediaLog> media_log_; diff --git a/media/formats/webm/webm_cluster_parser.cc b/media/formats/webm/webm_cluster_parser.cc index ee49137..21420b74 100644 --- a/media/formats/webm/webm_cluster_parser.cc +++ b/media/formats/webm/webm_cluster_parser.cc @@ -32,13 +32,13 @@ enum { }; WebMClusterParser::WebMClusterParser( - int64 timecode_scale, + int64_t timecode_scale, int audio_track_num, base::TimeDelta audio_default_duration, int video_track_num, base::TimeDelta video_default_duration, const WebMTracksParser::TextTracks& text_tracks, - const std::set<int64>& ignored_tracks, + const std::set<int64_t>& ignored_tracks, const std::string& audio_encryption_key_id, const std::string& video_encryption_key_id, const AudioCodec audio_codec, @@ -293,8 +293,8 @@ bool WebMClusterParser::OnListEnd(int id) { return result; } -bool WebMClusterParser::OnUInt(int id, int64 val) { - int64* dst; +bool WebMClusterParser::OnUInt(int id, int64_t val) { + int64_t* dst; switch (id) { case kWebMIdTimecode: dst = &cluster_timecode_; @@ -320,7 +320,7 @@ bool WebMClusterParser::ParseBlock(bool is_simple_block, const uint8_t* additional, int additional_size, int duration, - int64 discard_padding) { + int64_t discard_padding) { if (size < 4) return false; @@ -371,7 +371,7 @@ bool WebMClusterParser::OnBinary(int id, const uint8_t* data, int size) { return true; case kWebMIdBlockAdditional: { - uint64 block_add_id = base::HostToNet64(block_add_id_); + uint64_t block_add_id = base::HostToNet64(block_add_id_); if (block_additional_data_) { // TODO(vigneshv): Technically, more than 1 BlockAdditional is allowed // as per matroska spec. But for now we don't have a use case to @@ -397,7 +397,7 @@ bool WebMClusterParser::OnBinary(int id, const uint8_t* data, int size) { discard_padding_set_ = true; // Read in the big-endian integer. - discard_padding_ = static_cast<int8>(data[0]); + discard_padding_ = static_cast<int8_t>(data[0]); for (int i = 1; i < size; ++i) discard_padding_ = (discard_padding_ << 8) | data[i]; @@ -417,7 +417,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, int size, const uint8_t* additional, int additional_size, - int64 discard_padding) { + int64_t discard_padding) { DCHECK_GE(size, 0); if (cluster_timecode_ == -1) { MEDIA_LOG(ERROR, media_log_) << "Got a block before cluster timecode."; diff --git a/media/formats/webm/webm_cluster_parser.h b/media/formats/webm/webm_cluster_parser.h index e2d5b98..bd02810 100644 --- a/media/formats/webm/webm_cluster_parser.h +++ b/media/formats/webm/webm_cluster_parser.h @@ -149,13 +149,13 @@ class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { typedef std::map<int, Track> TextTrackMap; public: - WebMClusterParser(int64 timecode_scale, + WebMClusterParser(int64_t timecode_scale, int audio_track_num, base::TimeDelta audio_default_duration, int video_track_num, base::TimeDelta video_default_duration, const WebMTracksParser::TextTracks& text_tracks, - const std::set<int64>& ignored_tracks, + const std::set<int64_t>& ignored_tracks, const std::string& audio_encryption_key_id, const std::string& video_encryption_key_id, const AudioCodec audio_codec, @@ -209,7 +209,7 @@ class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { // WebMParserClient methods. WebMParserClient* OnListStart(int id) override; bool OnListEnd(int id) override; - bool OnUInt(int id, int64 val) override; + bool OnUInt(int id, int64_t val) override; bool OnBinary(int id, const uint8_t* data, int size) override; bool ParseBlock(bool is_simple_block, @@ -218,7 +218,7 @@ class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { const uint8_t* additional, int additional_size, int duration, - int64 discard_padding); + int64_t discard_padding); bool OnBlock(bool is_simple_block, int track_num, int timecode, @@ -228,7 +228,7 @@ class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { int size, const uint8_t* additional, int additional_size, - int64 discard_padding); + int64_t discard_padding); // Resets the Track objects associated with each text track. void ResetTextTracks(); @@ -273,28 +273,28 @@ class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { double timecode_multiplier_; // Multiplier used to convert timecodes into // microseconds. - std::set<int64> ignored_tracks_; + std::set<int64_t> ignored_tracks_; std::string audio_encryption_key_id_; std::string video_encryption_key_id_; const AudioCodec audio_codec_; WebMListParser parser_; - int64 last_block_timecode_ = -1; + int64_t last_block_timecode_ = -1; scoped_ptr<uint8_t[]> block_data_; int block_data_size_ = -1; - int64 block_duration_ = -1; - int64 block_add_id_ = -1; + int64_t block_duration_ = -1; + int64_t block_add_id_ = -1; scoped_ptr<uint8_t[]> block_additional_data_; // Must be 0 if |block_additional_data_| is null. Must be > 0 if // |block_additional_data_| is NOT null. int block_additional_data_size_ = 0; - int64 discard_padding_ = -1; + int64_t discard_padding_ = -1; bool discard_padding_set_ = false; - int64 cluster_timecode_ = -1; + int64_t cluster_timecode_ = -1; base::TimeDelta cluster_start_time_; bool cluster_ended_ = false; diff --git a/media/formats/webm/webm_cluster_parser_unittest.cc b/media/formats/webm/webm_cluster_parser_unittest.cc index 7581bbf..1605dfe 100644 --- a/media/formats/webm/webm_cluster_parser_unittest.cc +++ b/media/formats/webm/webm_cluster_parser_unittest.cc @@ -319,7 +319,7 @@ class WebMClusterParserTest : public testing::Test { base::TimeDelta audio_default_duration, base::TimeDelta video_default_duration, const WebMTracksParser::TextTracks& text_tracks, - const std::set<int64>& ignored_tracks, + const std::set<int64_t>& ignored_tracks, const std::string& audio_encryption_key_id, const std::string& video_encryption_key_id, const AudioCodec audio_codec) { @@ -333,7 +333,7 @@ class WebMClusterParserTest : public testing::Test { // Create a default version of the parser for test. WebMClusterParser* CreateDefaultParser() { return CreateParserHelper(kNoTimestamp(), kNoTimestamp(), TextTracks(), - std::set<int64>(), std::string(), std::string(), + std::set<int64_t>(), std::string(), std::string(), kUnknownAudioCodec); } @@ -344,13 +344,13 @@ class WebMClusterParserTest : public testing::Test { base::TimeDelta video_default_duration, const WebMTracksParser::TextTracks& text_tracks = TextTracks()) { return CreateParserHelper(audio_default_duration, video_default_duration, - text_tracks, std::set<int64>(), std::string(), + text_tracks, std::set<int64_t>(), std::string(), std::string(), kUnknownAudioCodec); } // Create a parser for test with custom ignored tracks. WebMClusterParser* CreateParserWithIgnoredTracks( - std::set<int64>& ignored_tracks) { + std::set<int64_t>& ignored_tracks) { return CreateParserHelper(kNoTimestamp(), kNoTimestamp(), TextTracks(), ignored_tracks, std::string(), std::string(), kUnknownAudioCodec); @@ -362,7 +362,7 @@ class WebMClusterParserTest : public testing::Test { const std::string& video_encryption_key_id, const AudioCodec audio_codec) { return CreateParserHelper(kNoTimestamp(), kNoTimestamp(), TextTracks(), - std::set<int64>(), audio_encryption_key_id, + std::set<int64_t>(), audio_encryption_key_id, video_encryption_key_id, audio_codec); } @@ -579,7 +579,7 @@ TEST_F(WebMClusterParserTest, ParseSimpleBlockAndBlockGroupMixture) { } TEST_F(WebMClusterParserTest, IgnoredTracks) { - std::set<int64> ignored_tracks; + std::set<int64_t> ignored_tracks; ignored_tracks.insert(kTextTrackNum); parser_.reset(CreateParserWithIgnoredTracks(ignored_tracks)); diff --git a/media/formats/webm/webm_constants.h b/media/formats/webm/webm_constants.h index 8a0b8a7..711b40f 100644 --- a/media/formats/webm/webm_constants.h +++ b/media/formats/webm/webm_constants.h @@ -5,7 +5,8 @@ #ifndef MEDIA_FORMATS_WEBM_WEBM_CONSTANTS_H_ #define MEDIA_FORMATS_WEBM_WEBM_CONSTANTS_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/base/media_export.h" namespace media { @@ -200,14 +201,14 @@ const int kWebMIdVideo = 0xE0; const int kWebMIdVoid = 0xEC; const int kWebMIdWritingApp = 0x5741; -const int64 kWebMReservedId = 0x1FFFFFFF; -const int64 kWebMUnknownSize = 0x00FFFFFFFFFFFFFFLL; +const int64_t kWebMReservedId = 0x1FFFFFFF; +const int64_t kWebMUnknownSize = 0x00FFFFFFFFFFFFFFLL; -const uint8 kWebMFlagKeyframe = 0x80; +const uint8_t kWebMFlagKeyframe = 0x80; // Current encrypted WebM request for comments specification is here // http://wiki.webmproject.org/encryption/webm-encryption-rfc -const uint8 kWebMFlagEncryptedFrame = 0x1; +const uint8_t kWebMFlagEncryptedFrame = 0x1; const int kWebMIvSize = 8; const int kWebMSignalByteSize = 1; diff --git a/media/formats/webm/webm_content_encodings.cc b/media/formats/webm/webm_content_encodings.cc index 157c6ac..440dcce 100644 --- a/media/formats/webm/webm_content_encodings.cc +++ b/media/formats/webm/webm_content_encodings.cc @@ -17,7 +17,7 @@ ContentEncoding::ContentEncoding() ContentEncoding::~ContentEncoding() {} -void ContentEncoding::SetEncryptionKeyId(const uint8* encryption_key_id, +void ContentEncoding::SetEncryptionKeyId(const uint8_t* encryption_key_id, int size) { DCHECK(encryption_key_id); DCHECK_GT(size, 0); diff --git a/media/formats/webm/webm_content_encodings.h b/media/formats/webm/webm_content_encodings.h index 5890ecf..1cc68a4 100644 --- a/media/formats/webm/webm_content_encodings.h +++ b/media/formats/webm/webm_content_encodings.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" @@ -52,8 +51,8 @@ class MEDIA_EXPORT ContentEncoding { ContentEncoding(); ~ContentEncoding(); - int64 order() const { return order_; } - void set_order(int64 order) { order_ = order; } + int64_t order() const { return order_; } + void set_order(int64_t order) { order_ = order; } Scope scope() const { return scope_; } void set_scope(Scope scope) { scope_ = scope; } @@ -67,13 +66,13 @@ class MEDIA_EXPORT ContentEncoding { } const std::string& encryption_key_id() const { return encryption_key_id_; } - void SetEncryptionKeyId(const uint8* encryption_key_id, int size); + void SetEncryptionKeyId(const uint8_t* encryption_key_id, int size); CipherMode cipher_mode() const { return cipher_mode_; } void set_cipher_mode(CipherMode mode) { cipher_mode_ = mode; } private: - int64 order_; + int64_t order_; Scope scope_; Type type_; EncryptionAlgo encryption_algo_; diff --git a/media/formats/webm/webm_content_encodings_client.cc b/media/formats/webm/webm_content_encodings_client.cc index a9783dd..eb1b590 100644 --- a/media/formats/webm/webm_content_encodings_client.cc +++ b/media/formats/webm/webm_content_encodings_client.cc @@ -142,7 +142,7 @@ bool WebMContentEncodingsClient::OnListEnd(int id) { // Multiple occurrence restriction and range are checked in this function. // Mandatory occurrence restriction is checked in OnListEnd. -bool WebMContentEncodingsClient::OnUInt(int id, int64 val) { +bool WebMContentEncodingsClient::OnUInt(int id, int64_t val) { DCHECK(cur_content_encoding_.get()); if (id == kWebMIdContentEncodingOrder) { @@ -152,7 +152,7 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) { return false; } - if (val != static_cast<int64>(content_encodings_.size())) { + if (val != static_cast<int64_t>(content_encodings_.size())) { // According to the spec, encoding order starts with 0 and counts upwards. MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingOrder."; return false; @@ -252,7 +252,9 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) { // Multiple occurrence restriction is checked in this function. Mandatory // restriction is checked in OnListEnd. -bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) { +bool WebMContentEncodingsClient::OnBinary(int id, + const uint8_t* data, + int size) { DCHECK(cur_content_encoding_.get()); DCHECK(data); DCHECK_GT(size, 0); diff --git a/media/formats/webm/webm_content_encodings_client.h b/media/formats/webm/webm_content_encodings_client.h index 85f7bf3..1144567 100644 --- a/media/formats/webm/webm_content_encodings_client.h +++ b/media/formats/webm/webm_content_encodings_client.h @@ -30,8 +30,8 @@ class MEDIA_EXPORT WebMContentEncodingsClient : public WebMParserClient { // WebMParserClient methods WebMParserClient* OnListStart(int id) override; bool OnListEnd(int id) override; - bool OnUInt(int id, int64 val) override; - bool OnBinary(int id, const uint8* data, int size) override; + bool OnUInt(int id, int64_t val) override; + bool OnBinary(int id, const uint8_t* data, int size) override; private: scoped_refptr<MediaLog> media_log_; diff --git a/media/formats/webm/webm_content_encodings_client_unittest.cc b/media/formats/webm/webm_content_encodings_client_unittest.cc index d31ad27..657e2c4 100644 --- a/media/formats/webm/webm_content_encodings_client_unittest.cc +++ b/media/formats/webm/webm_content_encodings_client_unittest.cc @@ -53,7 +53,7 @@ class WebMContentEncodingsClientTest : public testing::Test { client_(media_log_), parser_(kWebMIdContentEncodings, &client_) {} - void ParseAndExpectToFail(const uint8* buf, int size) { + void ParseAndExpectToFail(const uint8_t* buf, int size) { int result = parser_.Parse(buf, size); EXPECT_EQ(-1, result); } @@ -65,8 +65,8 @@ class WebMContentEncodingsClientTest : public testing::Test { }; TEST_F(WebMContentEncodingsClientTest, EmptyContentEncodings) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x80, // ContentEncodings (size = 0) + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x80, // ContentEncodings (size = 0) }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(MissingContentEncoding()); @@ -74,25 +74,25 @@ TEST_F(WebMContentEncodingsClientTest, EmptyContentEncodings) { } TEST_F(WebMContentEncodingsClientTest, EmptyContentEncoding) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x83, // ContentEncodings (size = 3) - 0x63, 0x40, 0x80, // ContentEncoding (size = 0) + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x83, // ContentEncodings (size = 3) + 0x63, 0x40, 0x80, // ContentEncoding (size = 0) }; int size = sizeof(kContentEncodings); ParseAndExpectToFail(kContentEncodings, size); } TEST_F(WebMContentEncodingsClientTest, SingleContentEncoding) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0xA1, // ContentEncodings (size = 33) - 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) - 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) - 0x50, 0x32, 0x81, 0x01, // ContentEncodingScope (size = 1) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) - 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) - 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) - 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0xA1, // ContentEncodings (size = 33) + 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) + 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) + 0x50, 0x32, 0x81, 0x01, // ContentEncodingScope (size = 1) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) + 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) + 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, }; int size = sizeof(kContentEncodings); @@ -112,24 +112,24 @@ TEST_F(WebMContentEncodingsClientTest, SingleContentEncoding) { } TEST_F(WebMContentEncodingsClientTest, MultipleContentEncoding) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0xC2, // ContentEncodings (size = 66) - 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) - 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) - 0x50, 0x32, 0x81, 0x03, // ContentEncodingScope (size = 1) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) - 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) - 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) - 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, - 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) - 0x50, 0x31, 0x81, 0x01, // ContentEncodingOrder (size = 1) - 0x50, 0x32, 0x81, 0x03, // ContentEncodingScope (size = 1) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) - 0x47, 0xE1, 0x81, 0x01, // ContentEncAlgo (size = 1) - 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) - 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0xC2, // ContentEncodings (size = 66) + 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) + 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) + 0x50, 0x32, 0x81, 0x03, // ContentEncodingScope (size = 1) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) + 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) + 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) + 0x50, 0x31, 0x81, 0x01, // ContentEncodingOrder (size = 1) + 0x50, 0x32, 0x81, 0x03, // ContentEncodingScope (size = 1) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) + 0x47, 0xE1, 0x81, 0x01, // ContentEncAlgo (size = 1) + 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) + 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, }; int size = sizeof(kContentEncodings); @@ -152,14 +152,14 @@ TEST_F(WebMContentEncodingsClientTest, MultipleContentEncoding) { } TEST_F(WebMContentEncodingsClientTest, DefaultValues) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x8A, // ContentEncodings (size = 10) - 0x62, 0x40, 0x87, // ContentEncoding (size = 7) - // ContentEncodingOrder missing - // ContentEncodingScope missing - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x80, // ContentEncryption (size = 0) - // ContentEncAlgo missing + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x8A, // ContentEncodings (size = 10) + 0x62, 0x40, 0x87, // ContentEncoding (size = 7) + // ContentEncodingOrder missing + // ContentEncodingScope missing + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x80, // ContentEncryption (size = 0) + // ContentEncAlgo missing }; int size = sizeof(kContentEncodings); @@ -179,16 +179,16 @@ TEST_F(WebMContentEncodingsClientTest, DefaultValues) { } TEST_F(WebMContentEncodingsClientTest, ContentEncodingsClientReuse) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0xA1, // ContentEncodings (size = 33) - 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) - 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) - 0x50, 0x32, 0x81, 0x01, // ContentEncodingScope (size = 1) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) - 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) - 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) - 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0xA1, // ContentEncodings (size = 33) + 0x62, 0x40, 0x9e, // ContentEncoding (size = 30) + 0x50, 0x31, 0x81, 0x00, // ContentEncodingOrder (size = 1) + 0x50, 0x32, 0x81, 0x01, // ContentEncodingScope (size = 1) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) + 0x47, 0xE1, 0x81, 0x05, // ContentEncAlgo (size = 1) + 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, }; int size = sizeof(kContentEncodings); @@ -214,12 +214,12 @@ TEST_F(WebMContentEncodingsClientTest, ContentEncodingsClientReuse) { } TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingOrder) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) - 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) - 0x50, 0x31, 0x81, 0xEE, // ContentEncodingOrder (size = 1), invalid - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x80, // ContentEncryption (size = 0) + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) + 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) + 0x50, 0x31, 0x81, 0xEE, // ContentEncodingOrder (size = 1), invalid + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x80, // ContentEncryption (size = 0) }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(UnexpectedContentEncodingOrder()); @@ -227,12 +227,12 @@ TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingOrder) { } TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingScope) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) - 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) - 0x50, 0x32, 0x81, 0xEE, // ContentEncodingScope (size = 1), invalid - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x80, // ContentEncryption (size = 0) + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) + 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) + 0x50, 0x32, 0x81, 0xEE, // ContentEncodingScope (size = 1), invalid + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x80, // ContentEncryption (size = 0) }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(UnexpectedContentEncodingScope()); @@ -240,11 +240,11 @@ TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingScope) { } TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingType) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) - 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) - 0x50, 0x33, 0x81, 0x00, // ContentEncodingType (size = 1), invalid - 0x50, 0x35, 0x80, // ContentEncryption (size = 0) + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x8E, // ContentEncodings (size = 14) + 0x62, 0x40, 0x8B, // ContentEncoding (size = 11) + 0x50, 0x33, 0x81, 0x00, // ContentEncodingType (size = 1), invalid + 0x50, 0x35, 0x80, // ContentEncryption (size = 0) }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(ContentCompressionNotSupported()); @@ -253,11 +253,11 @@ TEST_F(WebMContentEncodingsClientTest, InvalidContentEncodingType) { // ContentEncodingType is encryption but no ContentEncryption present. TEST_F(WebMContentEncodingsClientTest, MissingContentEncryption) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x87, // ContentEncodings (size = 7) - 0x62, 0x40, 0x84, // ContentEncoding (size = 4) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - // ContentEncryption missing + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x87, // ContentEncodings (size = 7) + 0x62, 0x40, 0x84, // ContentEncoding (size = 4) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + // ContentEncryption missing }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(MissingContentEncryption()); @@ -265,14 +265,14 @@ TEST_F(WebMContentEncodingsClientTest, MissingContentEncryption) { } TEST_F(WebMContentEncodingsClientTest, InvalidContentEncAlgo) { - const uint8 kContentEncodings[] = { - 0x6D, 0x80, 0x99, // ContentEncodings (size = 25) - 0x62, 0x40, 0x96, // ContentEncoding (size = 22) - 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) - 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) - 0x47, 0xE1, 0x81, 0xEE, // ContentEncAlgo (size = 1), invalid - 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) - 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + const uint8_t kContentEncodings[] = { + 0x6D, 0x80, 0x99, // ContentEncodings (size = 25) + 0x62, 0x40, 0x96, // ContentEncoding (size = 22) + 0x50, 0x33, 0x81, 0x01, // ContentEncodingType (size = 1) + 0x50, 0x35, 0x8F, // ContentEncryption (size = 15) + 0x47, 0xE1, 0x81, 0xEE, // ContentEncAlgo (size = 1), invalid + 0x47, 0xE2, 0x88, // ContentEncKeyID (size = 8) + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, }; int size = sizeof(kContentEncodings); EXPECT_MEDIA_LOG(UnexpectedContentEncAlgo(0xEE)); diff --git a/media/formats/webm/webm_crypto_helpers.cc b/media/formats/webm/webm_crypto_helpers.cc index bd473bc..11e71b1 100644 --- a/media/formats/webm/webm_crypto_helpers.cc +++ b/media/formats/webm/webm_crypto_helpers.cc @@ -16,7 +16,7 @@ namespace { // CTR IV appended with a CTR block counter. |iv| is an 8 byte CTR IV. // |iv_size| is the size of |iv| in btyes. Returns a string of // kDecryptionKeySize bytes. -std::string GenerateWebMCounterBlock(const uint8* iv, int iv_size) { +std::string GenerateWebMCounterBlock(const uint8_t* iv, int iv_size) { std::string counter_block(reinterpret_cast<const char*>(iv), iv_size); counter_block.append(DecryptConfig::kDecryptionKeySize - iv_size, 0); return counter_block; @@ -24,8 +24,10 @@ std::string GenerateWebMCounterBlock(const uint8* iv, int iv_size) { } // namespace anonymous -bool WebMCreateDecryptConfig(const uint8* data, int data_size, - const uint8* key_id, int key_id_size, +bool WebMCreateDecryptConfig(const uint8_t* data, + int data_size, + const uint8_t* key_id, + int key_id_size, scoped_ptr<DecryptConfig>* decrypt_config, int* data_offset) { if (data_size < kWebMSignalByteSize) { @@ -33,7 +35,7 @@ bool WebMCreateDecryptConfig(const uint8* data, int data_size, return false; } - uint8 signal_byte = data[0]; + uint8_t signal_byte = data[0]; int frame_offset = sizeof(signal_byte); // Setting the DecryptConfig object of the buffer while leaving the diff --git a/media/formats/webm/webm_crypto_helpers.h b/media/formats/webm/webm_crypto_helpers.h index 41ad5b1..d386302 100644 --- a/media/formats/webm/webm_crypto_helpers.h +++ b/media/formats/webm/webm_crypto_helpers.h @@ -5,7 +5,6 @@ #ifndef MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ #define MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/decoder_buffer.h" @@ -18,8 +17,10 @@ namespace media { // false otherwise, in which case |decrypt_config| and |data_offset| will not be // changed. Current encrypted WebM request for comments specification is here // http://wiki.webmproject.org/encryption/webm-encryption-rfc -bool WebMCreateDecryptConfig(const uint8* data, int data_size, - const uint8* key_id, int key_id_size, +bool WebMCreateDecryptConfig(const uint8_t* data, + int data_size, + const uint8_t* key_id, + int key_id_size, scoped_ptr<DecryptConfig>* decrypt_config, int* data_offset); diff --git a/media/formats/webm/webm_info_parser.cc b/media/formats/webm/webm_info_parser.cc index 6309c21..be6d708 100644 --- a/media/formats/webm/webm_info_parser.cc +++ b/media/formats/webm/webm_info_parser.cc @@ -20,7 +20,7 @@ WebMInfoParser::WebMInfoParser() WebMInfoParser::~WebMInfoParser() {} -int WebMInfoParser::Parse(const uint8* buf, int size) { +int WebMInfoParser::Parse(const uint8_t* buf, int size) { timecode_scale_ = -1; duration_ = -1; @@ -45,7 +45,7 @@ bool WebMInfoParser::OnListEnd(int id) { return true; } -bool WebMInfoParser::OnUInt(int id, int64 val) { +bool WebMInfoParser::OnUInt(int id, int64_t val) { if (id != kWebMIdTimecodeScale) return true; @@ -73,12 +73,12 @@ bool WebMInfoParser::OnFloat(int id, double val) { return true; } -bool WebMInfoParser::OnBinary(int id, const uint8* data, int size) { +bool WebMInfoParser::OnBinary(int id, const uint8_t* data, int size) { if (id == kWebMIdDateUTC) { if (size != 8) return false; - int64 date_in_nanoseconds = 0; + int64_t date_in_nanoseconds = 0; for (int i = 0; i < size; ++i) date_in_nanoseconds = (date_in_nanoseconds << 8) | data[i]; diff --git a/media/formats/webm/webm_info_parser.h b/media/formats/webm/webm_info_parser.h index 44ef6b2..bec5cd2 100644 --- a/media/formats/webm/webm_info_parser.h +++ b/media/formats/webm/webm_info_parser.h @@ -23,9 +23,9 @@ class MEDIA_EXPORT WebMInfoParser : public WebMParserClient { // Returns -1 if the parse fails. // Returns 0 if more data is needed. // Returns the number of bytes parsed on success. - int Parse(const uint8* buf, int size); + int Parse(const uint8_t* buf, int size); - int64 timecode_scale() const { return timecode_scale_; } + int64_t timecode_scale() const { return timecode_scale_; } double duration() const { return duration_; } base::Time date_utc() const { return date_utc_; } @@ -33,12 +33,12 @@ class MEDIA_EXPORT WebMInfoParser : public WebMParserClient { // WebMParserClient methods WebMParserClient* OnListStart(int id) override; bool OnListEnd(int id) override; - bool OnUInt(int id, int64 val) override; + bool OnUInt(int id, int64_t val) override; bool OnFloat(int id, double val) override; - bool OnBinary(int id, const uint8* data, int size) override; + bool OnBinary(int id, const uint8_t* data, int size) override; bool OnString(int id, const std::string& str) override; - int64 timecode_scale_; + int64_t timecode_scale_; double duration_; base::Time date_utc_; diff --git a/media/formats/webm/webm_stream_parser.cc b/media/formats/webm/webm_stream_parser.cc index b978b96..6695e2e 100644 --- a/media/formats/webm/webm_stream_parser.cc +++ b/media/formats/webm/webm_stream_parser.cc @@ -67,7 +67,7 @@ void WebMStreamParser::Flush() { } } -bool WebMStreamParser::Parse(const uint8* buf, int size) { +bool WebMStreamParser::Parse(const uint8_t* buf, int size) { DCHECK_NE(state_, kWaitingForInit); if (state_ == kError) @@ -77,7 +77,7 @@ bool WebMStreamParser::Parse(const uint8* buf, int size) { int result = 0; int bytes_parsed = 0; - const uint8* cur = NULL; + const uint8_t* cur = NULL; int cur_size = 0; byte_queue_.Peek(&cur, &cur_size); @@ -120,17 +120,17 @@ void WebMStreamParser::ChangeState(State new_state) { state_ = new_state; } -int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { +int WebMStreamParser::ParseInfoAndTracks(const uint8_t* data, int size) { DVLOG(2) << "ParseInfoAndTracks()"; DCHECK(data); DCHECK_GT(size, 0); - const uint8* cur = data; + const uint8_t* cur = data; int cur_size = size; int bytes_parsed = 0; int id; - int64 element_size; + int64_t element_size; int result = WebMParseElementHeader(cur, cur_size, &id, &element_size); if (result <= 0) @@ -201,7 +201,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { InitParameters params(kInfiniteDuration()); if (info_parser.duration() > 0) { - int64 duration_in_us = info_parser.duration() * timecode_scale_in_us; + int64_t duration_in_us = info_parser.duration() * timecode_scale_in_us; params.duration = base::TimeDelta::FromMicroseconds(duration_in_us); } @@ -247,7 +247,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) { return bytes_parsed; } -int WebMStreamParser::ParseCluster(const uint8* data, int size) { +int WebMStreamParser::ParseCluster(const uint8_t* data, int size) { if (!cluster_parser_) return -1; @@ -276,7 +276,7 @@ int WebMStreamParser::ParseCluster(const uint8* data, int size) { } void WebMStreamParser::OnEncryptedMediaInitData(const std::string& key_id) { - std::vector<uint8> key_id_vector(key_id.begin(), key_id.end()); + std::vector<uint8_t> key_id_vector(key_id.begin(), key_id.end()); encrypted_media_init_data_cb_.Run(EmeInitDataType::WEBM, key_id_vector); } diff --git a/media/formats/webm/webm_stream_parser.h b/media/formats/webm/webm_stream_parser.h index bb53c94..7bcf0d9 100644 --- a/media/formats/webm/webm_stream_parser.h +++ b/media/formats/webm/webm_stream_parser.h @@ -31,7 +31,7 @@ class WebMStreamParser : public StreamParser { const base::Closure& end_of_segment_cb, const scoped_refptr<MediaLog>& media_log) override; void Flush() override; - bool Parse(const uint8* buf, int size) override; + bool Parse(const uint8_t* buf, int size) override; private: enum State { @@ -51,7 +51,7 @@ class WebMStreamParser : public StreamParser { // Returns < 0 if the parse fails. // Returns 0 if more data is needed. // Returning > 0 indicates success & the number of bytes parsed. - int ParseInfoAndTracks(const uint8* data, int size); + int ParseInfoAndTracks(const uint8_t* data, int size); // Incrementally parses WebM cluster elements. This method also skips // CUES elements if they are encountered since we currently don't use the @@ -60,7 +60,7 @@ class WebMStreamParser : public StreamParser { // Returns < 0 if the parse fails. // Returns 0 if more data is needed. // Returning > 0 indicates success & the number of bytes parsed. - int ParseCluster(const uint8* data, int size); + int ParseCluster(const uint8_t* data, int size); // Fire needkey event through the |encrypted_media_init_data_cb_|. void OnEncryptedMediaInitData(const std::string& key_id); diff --git a/media/formats/webm/webm_tracks_parser.cc b/media/formats/webm/webm_tracks_parser.cc index 1f2ca69..464a77ff 100644 --- a/media/formats/webm/webm_tracks_parser.cc +++ b/media/formats/webm/webm_tracks_parser.cc @@ -30,11 +30,12 @@ static TextKind CodecIdToTextKind(const std::string& codec_id) { } static base::TimeDelta PrecisionCappedDefaultDuration( - const double timecode_scale_in_us, const int64 duration_in_ns) { + const double timecode_scale_in_us, + const int64_t duration_in_ns) { if (duration_in_ns <= 0) return kNoTimestamp(); - int64 mult = duration_in_ns / 1000; + int64_t mult = duration_in_ns / 1000; mult /= timecode_scale_in_us; if (mult == 0) return kNoTimestamp(); @@ -62,7 +63,7 @@ WebMTracksParser::WebMTracksParser(const scoped_refptr<MediaLog>& media_log, WebMTracksParser::~WebMTracksParser() {} -int WebMTracksParser::Parse(const uint8* buf, int size) { +int WebMTracksParser::Parse(const uint8_t* buf, int size) { track_type_ =-1; track_num_ = -1; default_duration_ = -1; @@ -267,8 +268,8 @@ bool WebMTracksParser::OnListEnd(int id) { return true; } -bool WebMTracksParser::OnUInt(int id, int64 val) { - int64* dst = NULL; +bool WebMTracksParser::OnUInt(int id, int64_t val) { + int64_t* dst = NULL; switch (id) { case kWebMIdTrackNumber: @@ -304,7 +305,7 @@ bool WebMTracksParser::OnFloat(int id, double val) { return true; } -bool WebMTracksParser::OnBinary(int id, const uint8* data, int size) { +bool WebMTracksParser::OnBinary(int id, const uint8_t* data, int size) { if (id == kWebMIdCodecPrivate) { if (!codec_private_.empty()) { MEDIA_LOG(ERROR, media_log_) diff --git a/media/formats/webm/webm_tracks_parser.h b/media/formats/webm/webm_tracks_parser.h index d5513b5..2f94cfb 100644 --- a/media/formats/webm/webm_tracks_parser.h +++ b/media/formats/webm/webm_tracks_parser.h @@ -36,10 +36,10 @@ class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { // Returns -1 if the parse fails. // Returns 0 if more data is needed. // Returns the number of bytes parsed on success. - int Parse(const uint8* buf, int size); + int Parse(const uint8_t* buf, int size); - int64 audio_track_num() const { return audio_track_num_; } - int64 video_track_num() const { return video_track_num_; } + int64_t audio_track_num() const { return audio_track_num_; } + int64_t video_track_num() const { return video_track_num_; } // If TrackEntry DefaultDuration field existed for the associated audio or // video track, returns that value converted from ns to base::TimeDelta with @@ -50,7 +50,7 @@ class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { base::TimeDelta GetVideoDefaultDuration( const double timecode_scale_in_us) const; - const std::set<int64>& ignored_tracks() const { return ignored_tracks_; } + const std::set<int64_t>& ignored_tracks() const { return ignored_tracks_; } const std::string& audio_encryption_key_id() const { return audio_encryption_key_id_; @@ -78,29 +78,29 @@ class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { // WebMParserClient implementation. WebMParserClient* OnListStart(int id) override; bool OnListEnd(int id) override; - bool OnUInt(int id, int64 val) override; + bool OnUInt(int id, int64_t val) override; bool OnFloat(int id, double val) override; - bool OnBinary(int id, const uint8* data, int size) override; + bool OnBinary(int id, const uint8_t* data, int size) override; bool OnString(int id, const std::string& str) override; - int64 track_type_; - int64 track_num_; + int64_t track_type_; + int64_t track_num_; std::string track_name_; std::string track_language_; std::string codec_id_; - std::vector<uint8> codec_private_; - int64 seek_preroll_; - int64 codec_delay_; - int64 default_duration_; + std::vector<uint8_t> codec_private_; + int64_t seek_preroll_; + int64_t codec_delay_; + int64_t default_duration_; scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; - int64 audio_track_num_; - int64 audio_default_duration_; - int64 video_track_num_; - int64 video_default_duration_; + int64_t audio_track_num_; + int64_t audio_default_duration_; + int64_t video_track_num_; + int64_t video_default_duration_; bool ignore_text_tracks_; TextTracks text_tracks_; - std::set<int64> ignored_tracks_; + std::set<int64_t> ignored_tracks_; std::string audio_encryption_key_id_; std::string video_encryption_key_id_; scoped_refptr<MediaLog> media_log_; diff --git a/media/formats/webm/webm_tracks_parser_unittest.cc b/media/formats/webm/webm_tracks_parser_unittest.cc index 9c424ec..7e5a067 100644 --- a/media/formats/webm/webm_tracks_parser_unittest.cc +++ b/media/formats/webm/webm_tracks_parser_unittest.cc @@ -27,7 +27,7 @@ class WebMTracksParserTest : public testing::Test { WebMTracksParserTest() : media_log_(new StrictMock<MockMediaLog>()) {} protected: - void VerifyTextTrackInfo(const uint8* buffer, + void VerifyTextTrackInfo(const uint8_t* buffer, int buffer_size, TextKind text_kind, const std::string& name, @@ -61,7 +61,7 @@ TEST_F(WebMTracksParserTest, SubtitleNoNameNoLang) { TracksBuilder tb; tb.AddTextTrack(1, 1, kWebMCodecSubtitles, "", ""); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); VerifyTextTrackInfo(&buf[0], buf.size(), kTextSubtitles, "", ""); } @@ -71,7 +71,7 @@ TEST_F(WebMTracksParserTest, SubtitleYesNameNoLang) { TracksBuilder tb; tb.AddTextTrack(1, 1, kWebMCodecSubtitles, "Spock", ""); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); VerifyTextTrackInfo(&buf[0], buf.size(), kTextSubtitles, "Spock", ""); } @@ -81,7 +81,7 @@ TEST_F(WebMTracksParserTest, SubtitleNoNameYesLang) { TracksBuilder tb; tb.AddTextTrack(1, 1, kWebMCodecSubtitles, "", "eng"); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); VerifyTextTrackInfo(&buf[0], buf.size(), kTextSubtitles, "", "eng"); } @@ -91,7 +91,7 @@ TEST_F(WebMTracksParserTest, SubtitleYesNameYesLang) { TracksBuilder tb; tb.AddTextTrack(1, 1, kWebMCodecSubtitles, "Picard", "fre"); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); VerifyTextTrackInfo(&buf[0], buf.size(), kTextSubtitles, "Picard", "fre"); } @@ -102,7 +102,7 @@ TEST_F(WebMTracksParserTest, IgnoringTextTracks) { tb.AddTextTrack(1, 1, kWebMCodecSubtitles, "Subtitles", "fre"); tb.AddTextTrack(2, 2, kWebMCodecSubtitles, "Commentary", "fre"); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); scoped_ptr<WebMTracksParser> parser(new WebMTracksParser(media_log_, true)); EXPECT_MEDIA_LOG(HasSubstr("Ignoring text track 1")); @@ -114,7 +114,7 @@ TEST_F(WebMTracksParserTest, IgnoringTextTracks) { EXPECT_EQ(parser->text_tracks().size(), 0u); - const std::set<int64>& ignored_tracks = parser->ignored_tracks(); + const std::set<int64_t>& ignored_tracks = parser->ignored_tracks(); EXPECT_TRUE(ignored_tracks.find(1) != ignored_tracks.end()); EXPECT_TRUE(ignored_tracks.find(2) != ignored_tracks.end()); @@ -137,7 +137,7 @@ TEST_F(WebMTracksParserTest, AudioVideoDefaultDurationUnset) { TracksBuilder tb; tb.AddAudioTrack(1, 1, "A_VORBIS", "audio", "", -1, 2, 8000); tb.AddVideoTrack(2, 2, "V_VP8", "video", "", -1, 320, 240); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); scoped_ptr<WebMTracksParser> parser(new WebMTracksParser(media_log_, true)); int result = parser->Parse(&buf[0], buf.size()); @@ -166,7 +166,7 @@ TEST_F(WebMTracksParserTest, AudioVideoDefaultDurationSet) { TracksBuilder tb; tb.AddAudioTrack(1, 1, "A_VORBIS", "audio", "", 12345678, 2, 8000); tb.AddVideoTrack(2, 2, "V_VP8", "video", "", 987654321, 320, 240); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); scoped_ptr<WebMTracksParser> parser(new WebMTracksParser(media_log_, true)); int result = parser->Parse(&buf[0], buf.size()); @@ -188,7 +188,7 @@ TEST_F(WebMTracksParserTest, InvalidZeroDefaultDurationSet) { // Confirm parse error if TrackEntry DefaultDuration is present, but is 0ns. TracksBuilder tb(true); tb.AddAudioTrack(1, 1, "A_VORBIS", "audio", "", 0, 2, 8000); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); scoped_ptr<WebMTracksParser> parser(new WebMTracksParser(media_log_, true)); @@ -202,7 +202,7 @@ TEST_F(WebMTracksParserTest, HighTrackUID) { // (http://crbug.com/397067). TracksBuilder tb(true); tb.AddAudioTrack(1, 1ULL << 31, "A_VORBIS", "audio", "", 40, 2, 8000); - const std::vector<uint8> buf = tb.Finish(); + const std::vector<uint8_t> buf = tb.Finish(); scoped_ptr<WebMTracksParser> parser(new WebMTracksParser(media_log_, true)); EXPECT_GT(parser->Parse(&buf[0], buf.size()),0); diff --git a/media/formats/webm/webm_video_client.cc b/media/formats/webm/webm_video_client.cc index 29b7dca..6e57dfb 100644 --- a/media/formats/webm/webm_video_client.cc +++ b/media/formats/webm/webm_video_client.cc @@ -31,8 +31,10 @@ void WebMVideoClient::Reset() { } bool WebMVideoClient::InitializeConfig( - const std::string& codec_id, const std::vector<uint8>& codec_private, - bool is_encrypted, VideoDecoderConfig* config) { + const std::string& codec_id, + const std::vector<uint8_t>& codec_private, + bool is_encrypted, + VideoDecoderConfig* config) { DCHECK(config); VideoCodec video_codec = kUnknownVideoCodec; @@ -95,8 +97,8 @@ bool WebMVideoClient::InitializeConfig( return config->IsValidConfig(); } -bool WebMVideoClient::OnUInt(int id, int64 val) { - int64* dst = NULL; +bool WebMVideoClient::OnUInt(int id, int64_t val) { + int64_t* dst = NULL; switch (id) { case kWebMIdPixelWidth: @@ -144,7 +146,7 @@ bool WebMVideoClient::OnUInt(int id, int64 val) { return true; } -bool WebMVideoClient::OnBinary(int id, const uint8* data, int size) { +bool WebMVideoClient::OnBinary(int id, const uint8_t* data, int size) { // Accept binary fields we don't care about for now. return true; } diff --git a/media/formats/webm/webm_video_client.h b/media/formats/webm/webm_video_client.h index f2f1df4..12a6cbb 100644 --- a/media/formats/webm/webm_video_client.h +++ b/media/formats/webm/webm_video_client.h @@ -31,27 +31,27 @@ class WebMVideoClient : public WebMParserClient { // video track element fields. The contents of |config| are undefined in this // case and should not be relied upon. bool InitializeConfig(const std::string& codec_id, - const std::vector<uint8>& codec_private, + const std::vector<uint8_t>& codec_private, bool is_encrypted, VideoDecoderConfig* config); private: // WebMParserClient implementation. - bool OnUInt(int id, int64 val) override; - bool OnBinary(int id, const uint8* data, int size) override; + bool OnUInt(int id, int64_t val) override; + bool OnBinary(int id, const uint8_t* data, int size) override; bool OnFloat(int id, double val) override; scoped_refptr<MediaLog> media_log_; - int64 pixel_width_; - int64 pixel_height_; - int64 crop_bottom_; - int64 crop_top_; - int64 crop_left_; - int64 crop_right_; - int64 display_width_; - int64 display_height_; - int64 display_unit_; - int64 alpha_mode_; + int64_t pixel_width_; + int64_t pixel_height_; + int64_t crop_bottom_; + int64_t crop_top_; + int64_t crop_left_; + int64_t crop_right_; + int64_t display_width_; + int64_t display_height_; + int64_t display_unit_; + int64_t alpha_mode_; DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); }; diff --git a/media/formats/webm/webm_webvtt_parser.cc b/media/formats/webm/webm_webvtt_parser.cc index 64de1ef..d84009c 100644 --- a/media/formats/webm/webm_webvtt_parser.cc +++ b/media/formats/webm/webm_webvtt_parser.cc @@ -6,7 +6,8 @@ namespace media { -void WebMWebVTTParser::Parse(const uint8* payload, int payload_size, +void WebMWebVTTParser::Parse(const uint8_t* payload, + int payload_size, std::string* id, std::string* settings, std::string* content) { @@ -14,10 +15,8 @@ void WebMWebVTTParser::Parse(const uint8* payload, int payload_size, parser.Parse(id, settings, content); } -WebMWebVTTParser::WebMWebVTTParser(const uint8* payload, int payload_size) - : ptr_(payload), - ptr_end_(payload + payload_size) { -} +WebMWebVTTParser::WebMWebVTTParser(const uint8_t* payload, int payload_size) + : ptr_(payload), ptr_end_(payload + payload_size) {} void WebMWebVTTParser::Parse(std::string* id, std::string* settings, @@ -27,7 +26,7 @@ void WebMWebVTTParser::Parse(std::string* id, content->assign(ptr_, ptr_end_); } -bool WebMWebVTTParser::GetByte(uint8* byte) { +bool WebMWebVTTParser::GetByte(uint8_t* byte) { if (ptr_ >= ptr_end_) return false; // indicates end-of-stream @@ -59,7 +58,7 @@ void WebMWebVTTParser::ParseLine(std::string* line) { }; for (;;) { - uint8 byte; + uint8_t byte; if (!GetByte(&byte) || byte == kLF) return; diff --git a/media/formats/webm/webm_webvtt_parser.h b/media/formats/webm/webm_webvtt_parser.h index 12bbbd4..75c3864 100644 --- a/media/formats/webm/webm_webvtt_parser.h +++ b/media/formats/webm/webm_webvtt_parser.h @@ -5,9 +5,11 @@ #ifndef MEDIA_FORMATS_WEBM_WEBM_WEBVTT_PARSER_H_ #define MEDIA_FORMATS_WEBM_WEBM_WEBVTT_PARSER_H_ +#include <stdint.h> + #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/base/media_export.h" namespace media { @@ -15,7 +17,8 @@ namespace media { class MEDIA_EXPORT WebMWebVTTParser { public: // Utility function to parse the WebVTT cue from a byte stream. - static void Parse(const uint8* payload, int payload_size, + static void Parse(const uint8_t* payload, + int payload_size, std::string* id, std::string* settings, std::string* content); @@ -23,13 +26,13 @@ class MEDIA_EXPORT WebMWebVTTParser { private: // The payload is the embedded WebVTT cue, stored in a WebM block. // The parser treats this as a UTF-8 byte stream. - WebMWebVTTParser(const uint8* payload, int payload_size); + WebMWebVTTParser(const uint8_t* payload, int payload_size); // Parse the cue identifier, settings, and content from the stream. void Parse(std::string* id, std::string* settings, std::string* content); // Remove a byte from the stream, advancing the stream pointer. // Returns true if a character was returned; false means "end of stream". - bool GetByte(uint8* byte); + bool GetByte(uint8_t* byte); // Backup the stream pointer. void UngetByte(); @@ -38,8 +41,8 @@ class MEDIA_EXPORT WebMWebVTTParser { void ParseLine(std::string* line); // Represents the portion of the stream that has not been consumed yet. - const uint8* ptr_; - const uint8* const ptr_end_; + const uint8_t* ptr_; + const uint8_t* const ptr_end_; DISALLOW_COPY_AND_ASSIGN(WebMWebVTTParser); }; diff --git a/media/formats/webm/webm_webvtt_parser_unittest.cc b/media/formats/webm/webm_webvtt_parser_unittest.cc index ecdabd4..c40d1a1 100644 --- a/media/formats/webm/webm_webvtt_parser_unittest.cc +++ b/media/formats/webm/webm_webvtt_parser_unittest.cc @@ -10,13 +10,13 @@ using ::testing::InSequence; namespace media { -typedef std::vector<uint8> Cue; +typedef std::vector<uint8_t> Cue; static Cue EncodeCue(const std::string& id, const std::string& settings, const std::string& content) { const std::string result = id + '\n' + settings + '\n' + content; - const uint8* const buf = reinterpret_cast<const uint8*>(result.data()); + const uint8_t* const buf = reinterpret_cast<const uint8_t*>(result.data()); return Cue(buf, buf + result.length()); } diff --git a/media/midi/midi_input_port_android.cc b/media/midi/midi_input_port_android.cc index 0db07f3..82adffe 100644 --- a/media/midi/midi_input_port_android.cc +++ b/media/midi/midi_input_port_android.cc @@ -37,7 +37,7 @@ void MidiInputPortAndroid::OnData(JNIEnv* env, jint offset, jint size, jlong timestamp) { - std::vector<uint8> bytes; + std::vector<uint8_t> bytes; base::android::JavaByteArrayToByteVector(env, data, &bytes); if (size == 0) { diff --git a/media/midi/midi_input_port_android.h b/media/midi/midi_input_port_android.h index ed715bd..1e1a800 100644 --- a/media/midi/midi_input_port_android.h +++ b/media/midi/midi_input_port_android.h @@ -19,7 +19,7 @@ class MidiInputPortAndroid final { public: virtual ~Delegate() {} virtual void OnReceivedData(MidiInputPortAndroid* port, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) = 0; }; diff --git a/media/midi/midi_jni_registrar.cc b/media/midi/midi_jni_registrar.cc index 713e73c..9a89b7b 100644 --- a/media/midi/midi_jni_registrar.cc +++ b/media/midi/midi_jni_registrar.cc @@ -6,7 +6,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" -#include "base/basictypes.h" #include "media/midi/midi_device_android.h" #include "media/midi/midi_input_port_android.h" diff --git a/media/midi/midi_manager.cc b/media/midi/midi_manager.cc index c5ec655..3c97a0f 100644 --- a/media/midi/midi_manager.cc +++ b/media/midi/midi_manager.cc @@ -162,8 +162,8 @@ void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { } void MidiManager::DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { NOTREACHED(); } @@ -197,7 +197,7 @@ void MidiManager::AddOutputPort(const MidiPortInfo& info) { client->AddOutputPort(info); } -void MidiManager::SetInputPortState(uint32 port_index, MidiPortState state) { +void MidiManager::SetInputPortState(uint32_t port_index, MidiPortState state) { base::AutoLock auto_lock(lock_); DCHECK_LT(port_index, input_ports_.size()); input_ports_[port_index].state = state; @@ -205,7 +205,7 @@ void MidiManager::SetInputPortState(uint32 port_index, MidiPortState state) { client->SetInputPortState(port_index, state); } -void MidiManager::SetOutputPortState(uint32 port_index, MidiPortState state) { +void MidiManager::SetOutputPortState(uint32_t port_index, MidiPortState state) { base::AutoLock auto_lock(lock_); DCHECK_LT(port_index, output_ports_.size()); output_ports_[port_index].state = state; @@ -213,11 +213,10 @@ void MidiManager::SetOutputPortState(uint32 port_index, MidiPortState state) { client->SetOutputPortState(port_index, state); } -void MidiManager::ReceiveMidiData( - uint32 port_index, - const uint8* data, - size_t length, - double timestamp) { +void MidiManager::ReceiveMidiData(uint32_t port_index, + const uint8_t* data, + size_t length, + double timestamp) { base::AutoLock auto_lock(lock_); for (auto client : clients_) diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h index d5e55c6..e5d17be 100644 --- a/media/midi/midi_manager.h +++ b/media/midi/midi_manager.h @@ -8,7 +8,6 @@ #include <set> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/time/time.h" @@ -38,8 +37,8 @@ class MIDI_EXPORT MidiManagerClient { // SetInputPortState() and SetOutputPortState() are called to notify a known // device gets disconnected, or connected again. - virtual void SetInputPortState(uint32 port_index, MidiPortState state) = 0; - virtual void SetOutputPortState(uint32 port_index, MidiPortState state) = 0; + virtual void SetInputPortState(uint32_t port_index, MidiPortState state) = 0; + virtual void SetOutputPortState(uint32_t port_index, MidiPortState state) = 0; // CompleteStartSession() is called when platform dependent preparation is // finished. @@ -51,8 +50,8 @@ class MIDI_EXPORT MidiManagerClient { // |data| represents a series of bytes encoding one or more MIDI messages. // |length| is the number of bytes in |data|. // |timestamp| is the time the data was received, in seconds. - virtual void ReceiveMidiData(uint32 port_index, - const uint8* data, + virtual void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, size_t length, double timestamp) = 0; @@ -109,8 +108,8 @@ class MIDI_EXPORT MidiManager { // means send "now" or as soon as possible. // The default implementation is for unsupported platforms. virtual void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp); protected: @@ -141,19 +140,19 @@ class MIDI_EXPORT MidiManager { void AddInputPort(const MidiPortInfo& info); void AddOutputPort(const MidiPortInfo& info); - void SetInputPortState(uint32 port_index, MidiPortState state); - void SetOutputPortState(uint32 port_index, MidiPortState state); + void SetInputPortState(uint32_t port_index, MidiPortState state); + void SetOutputPortState(uint32_t port_index, MidiPortState state); // Dispatches to all clients. // TODO(toyoshim): Fix the mac implementation to use // |ReceiveMidiData(..., base::TimeTicks)|. - void ReceiveMidiData(uint32 port_index, - const uint8* data, + void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, size_t length, double timestamp); - void ReceiveMidiData(uint32 port_index, - const uint8* data, + void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, size_t length, base::TimeTicks time) { ReceiveMidiData(port_index, data, length, diff --git a/media/midi/midi_manager_alsa.cc b/media/midi/midi_manager_alsa.cc index ad802c5..f4b87ba 100644 --- a/media/midi/midi_manager_alsa.cc +++ b/media/midi/midi_manager_alsa.cc @@ -278,8 +278,8 @@ void MidiManagerAlsa::Finalize() { } void MidiManagerAlsa::DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { if (!send_thread_.IsRunning()) send_thread_.Start(); @@ -399,7 +399,7 @@ std::string MidiManagerAlsa::MidiPort::JSONValue() const { // mapping and just use a UUID or other random string. // http://crbug.com/465320 std::string MidiManagerAlsa::MidiPort::OpaqueKey() const { - uint8 hash[crypto::kSHA256Length]; + uint8_t hash[crypto::kSHA256Length]; crypto::SHA256HashString(JSONValue(), &hash, sizeof(hash)); return base::HexEncode(&hash, sizeof(hash)); } @@ -564,9 +564,9 @@ MidiManagerAlsa::MidiPortStateBase::MidiPortStateBase() = default; MidiManagerAlsa::MidiPortState::MidiPortState() = default; -uint32 MidiManagerAlsa::MidiPortState::push_back(scoped_ptr<MidiPort> port) { +uint32_t MidiManagerAlsa::MidiPortState::push_back(scoped_ptr<MidiPort> port) { // Add the web midi index. - uint32 web_port_index = 0; + uint32_t web_port_index = 0; switch (port->type()) { case MidiPort::Type::kInput: web_port_index = num_input_ports_++; @@ -810,8 +810,8 @@ std::string MidiManagerAlsa::AlsaCard::ExtractManufacturerString( return ""; } -void MidiManagerAlsa::SendMidiData(uint32 port_index, - const std::vector<uint8>& data) { +void MidiManagerAlsa::SendMidiData(uint32_t port_index, + const std::vector<uint8_t>& data) { DCHECK(send_thread_.task_runner()->BelongsToCurrentThread()); snd_midi_event_t* encoder; @@ -928,10 +928,10 @@ void MidiManagerAlsa::ProcessSingleEvent(snd_seq_event_t* event, auto source_it = source_map_.find(AddrToInt(event->source.client, event->source.port)); if (source_it != source_map_.end()) { - uint32 source = source_it->second; + uint32_t source = source_it->second; if (event->type == SND_SEQ_EVENT_SYSEX) { // Special! Variable-length sysex. - ReceiveMidiData(source, static_cast<const uint8*>(event->data.ext.ptr), + ReceiveMidiData(source, static_cast<const uint8_t*>(event->data.ext.ptr), event->data.ext.len, timestamp); } else { // Otherwise, decode this and send that on. @@ -1144,7 +1144,7 @@ void MidiManagerAlsa::UpdatePortStateAndGenerateEvents() { if (old_port->connected() && (new_port_state->FindConnected(*old_port) == new_port_state->end())) { old_port->set_connected(false); - uint32 web_port_index = old_port->web_port_index(); + uint32_t web_port_index = old_port->web_port_index(); switch (old_port->type()) { case MidiPort::Type::kInput: source_map_.erase( @@ -1174,7 +1174,7 @@ void MidiManagerAlsa::UpdatePortStateAndGenerateEvents() { const auto& client_id = new_port->client_id(); const auto& port_id = new_port->port_id(); - uint32 web_port_index = port_state_.push_back(new_port.Pass()); + uint32_t web_port_index = port_state_.push_back(new_port.Pass()); it = new_port_state->erase(it); MidiPortInfo info(opaque_key, manufacturer, port_name, version, @@ -1191,7 +1191,7 @@ void MidiManagerAlsa::UpdatePortStateAndGenerateEvents() { } } else if (!(*old_port)->connected()) { // Reconnect. - uint32 web_port_index = (*old_port)->web_port_index(); + uint32_t web_port_index = (*old_port)->web_port_index(); (*old_port)->Update(new_port->path(), new_port->client_id(), new_port->port_id(), new_port->client_name(), new_port->port_name(), new_port->manufacturer(), @@ -1277,7 +1277,7 @@ bool MidiManagerAlsa::EnumerateUdevCards() { return true; } -bool MidiManagerAlsa::CreateAlsaOutputPort(uint32 port_index, +bool MidiManagerAlsa::CreateAlsaOutputPort(uint32_t port_index, int client_id, int port_id) { // Create the port. @@ -1311,7 +1311,7 @@ bool MidiManagerAlsa::CreateAlsaOutputPort(uint32 port_index, return true; } -void MidiManagerAlsa::DeleteAlsaOutputPort(uint32 port_index) { +void MidiManagerAlsa::DeleteAlsaOutputPort(uint32_t port_index) { base::AutoLock lock(out_ports_lock_); auto it = out_ports_.find(port_index); if (it == out_ports_.end()) @@ -1322,7 +1322,9 @@ void MidiManagerAlsa::DeleteAlsaOutputPort(uint32 port_index) { out_ports_.erase(it); } -bool MidiManagerAlsa::Subscribe(uint32 port_index, int client_id, int port_id) { +bool MidiManagerAlsa::Subscribe(uint32_t port_index, + int client_id, + int port_id) { // Activate port subscription. snd_seq_port_subscribe_t* subs; snd_seq_port_subscribe_alloca(&subs); diff --git a/media/midi/midi_manager_alsa.h b/media/midi/midi_manager_alsa.h index d269f25..a3ab5e9 100644 --- a/media/midi/midi_manager_alsa.h +++ b/media/midi/midi_manager_alsa.h @@ -9,7 +9,6 @@ #include <map> #include <vector> -#include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" @@ -31,8 +30,8 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { void StartInitialization() override; void Finalize() override; void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) override; private: @@ -124,11 +123,11 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { int port_id() const { return port_id_; } int midi_device() const { return midi_device_; } Type type() const { return type_; } - uint32 web_port_index() const { return web_port_index_; } + uint32_t web_port_index() const { return web_port_index_; } bool connected() const { return connected_; } // mutators - void set_web_port_index(uint32 web_port_index) { + void set_web_port_index(uint32_t web_port_index) { web_port_index_ = web_port_index; } void set_connected(bool connected) { connected_ = connected; } @@ -166,7 +165,7 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { std::string version_; // Index for MidiManager. - uint32 web_port_index_ = 0; + uint32_t web_port_index_ = 0; // Port is present in the ALSA system. bool connected_ = true; @@ -218,11 +217,11 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { MidiPortState(); // Inserts a port at the end. Returns web_port_index. - uint32 push_back(scoped_ptr<MidiPort> port); + uint32_t push_back(scoped_ptr<MidiPort> port); private: - uint32 num_input_ports_ = 0; - uint32 num_output_ports_ = 0; + uint32_t num_input_ports_ = 0; + uint32_t num_output_ports_ = 0; }; class AlsaSeqState { @@ -357,11 +356,11 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { }; }; - typedef base::hash_map<int, uint32> SourceMap; - typedef base::hash_map<uint32, int> OutPortMap; + typedef base::hash_map<int, uint32_t> SourceMap; + typedef base::hash_map<uint32_t, int> OutPortMap; // An internal callback that runs on MidiSendThread. - void SendMidiData(uint32 port_index, const std::vector<uint8>& data); + void SendMidiData(uint32_t port_index, const std::vector<uint8_t>& data); void ScheduleEventLoop(); void EventLoop(); @@ -382,10 +381,10 @@ class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { // Enumerates udev cards. Call once after initializing the udev monitor. bool EnumerateUdevCards(); // Returns true if successful. - bool CreateAlsaOutputPort(uint32 port_index, int client_id, int port_id); - void DeleteAlsaOutputPort(uint32 port_index); + bool CreateAlsaOutputPort(uint32_t port_index, int client_id, int port_id); + void DeleteAlsaOutputPort(uint32_t port_index); // Returns true if successful. - bool Subscribe(uint32 port_index, int client_id, int port_id); + bool Subscribe(uint32_t port_index, int client_id, int port_id); AlsaSeqState alsa_seq_state_; MidiPortState port_state_; diff --git a/media/midi/midi_manager_android.cc b/media/midi/midi_manager_android.cc index 8ce5127..426493b 100644 --- a/media/midi/midi_manager_android.cc +++ b/media/midi/midi_manager_android.cc @@ -46,8 +46,8 @@ void MidiManagerAndroid::StartInitialization() { } void MidiManagerAndroid::DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { if (port_index >= all_output_ports_.size()) { // |port_index| is provided by a renderer so we can't believe that it is @@ -76,7 +76,7 @@ void MidiManagerAndroid::DispatchSendMidiData(MidiManagerClient* client, } void MidiManagerAndroid::OnReceivedData(MidiInputPortAndroid* port, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks timestamp) { const auto i = input_port_to_index_.find(port); diff --git a/media/midi/midi_manager_android.h b/media/midi/midi_manager_android.h index e4c8112..eb1daf8 100644 --- a/media/midi/midi_manager_android.h +++ b/media/midi/midi_manager_android.h @@ -9,7 +9,6 @@ #include <vector> #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" @@ -35,13 +34,13 @@ class MidiManagerAndroid final : public MidiManager, // MidiManager implementation. void StartInitialization() override; void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) override; // MidiInputPortAndroid::Delegate implementation. void OnReceivedData(MidiInputPortAndroid*, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks timestamp) override; diff --git a/media/midi/midi_manager_mac.cc b/media/midi/midi_manager_mac.cc index 7ba145b..721851b 100644 --- a/media/midi/midi_manager_mac.cc +++ b/media/midi/midi_manager_mac.cc @@ -135,10 +135,9 @@ void MidiManagerMac::Finalize() { MIDIClientDispose(midi_client_); } - void MidiManagerMac::DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { RunOnClientThread( base::Bind(&MidiManagerMac::SendMidiData, @@ -187,9 +186,9 @@ void MidiManagerMac::InitializeCoreMIDI() { // Following loop may miss some newly attached devices, but such device will // be captured by ReceiveMidiNotifyDispatch callback. - uint32 destination_count = MIDIGetNumberOfDestinations(); + uint32_t destination_count = MIDIGetNumberOfDestinations(); destinations_.resize(destination_count); - for (uint32 i = 0; i < destination_count ; i++) { + for (uint32_t i = 0; i < destination_count; i++) { MIDIEndpointRef destination = MIDIGetDestination(i); if (destination == 0) { // One ore more devices may be detached. @@ -206,8 +205,8 @@ void MidiManagerMac::InitializeCoreMIDI() { } // Open connections from all sources. This loop also may miss new devices. - uint32 source_count = MIDIGetNumberOfSources(); - for (uint32 i = 0; i < source_count; ++i) { + uint32_t source_count = MIDIGetNumberOfSources(); + for (uint32_t i = 0; i < source_count; ++i) { // Receive from all sources. MIDIEndpointRef source = MIDIGetSource(i); if (source == 0) @@ -257,7 +256,7 @@ void MidiManagerMac::ReceiveMidiNotify(const MIDINotification* message) { // On kMIDIMsgObjectRemoved, the entry will be ignored because it // will not be found in the pool. if (!info.id.empty()) { - uint32 index = source_map_.size(); + uint32_t index = source_map_.size(); source_map_[endpoint] = index; AddInputPort(info); MIDIPortConnectSource( @@ -328,7 +327,7 @@ void MidiManagerMac::ReadMidi(MIDIEndpointRef source, return; // This is safe since MidiManagerMac does not remove any existing // MIDIEndpointRef, and the order is saved. - uint32 port_index = it->second; + uint32_t port_index = it->second; // Go through each packet and process separately. const MIDIPacket* packet = &packet_list->packet[0]; @@ -347,8 +346,8 @@ void MidiManagerMac::ReadMidi(MIDIEndpointRef source, } void MidiManagerMac::SendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { DCHECK(client_thread_.task_runner()->BelongsToCurrentThread()); diff --git a/media/midi/midi_manager_mac.h b/media/midi/midi_manager_mac.h index a2bf25e..a3440c0 100644 --- a/media/midi/midi_manager_mac.h +++ b/media/midi/midi_manager_mac.h @@ -10,7 +10,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/threading/thread.h" @@ -30,8 +29,8 @@ class MIDI_EXPORT MidiManagerMac final : public MidiManager { void StartInitialization() override; void Finalize() override; void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) override; private: @@ -61,18 +60,18 @@ class MIDI_EXPORT MidiManagerMac final : public MidiManager { // An internal callback that runs on MidiSendThread. void SendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp); // CoreMIDI MIDIClientRef midi_client_; MIDIPortRef coremidi_input_; MIDIPortRef coremidi_output_; - std::vector<uint8> midi_buffer_; + std::vector<uint8_t> midi_buffer_; // Keeps track of the index (0-based) for each of our sources. - typedef std::map<MIDIEndpointRef, uint32> SourceMap; + typedef std::map<MIDIEndpointRef, uint32_t> SourceMap; SourceMap source_map_; // Keeps track of all destinations. diff --git a/media/midi/midi_manager_mac_unittest.cc b/media/midi/midi_manager_mac_unittest.cc index 244576e..9bd01c3 100644 --- a/media/midi/midi_manager_mac_unittest.cc +++ b/media/midi/midi_manager_mac_unittest.cc @@ -46,8 +46,8 @@ class FakeMidiManagerClient : public MidiManagerClient { info_ = info; wait_for_port_ = false; } - void SetInputPortState(uint32 port_index, MidiPortState state) override {} - void SetOutputPortState(uint32 port_index, MidiPortState state) override {} + void SetInputPortState(uint32_t port_index, MidiPortState state) override {} + void SetOutputPortState(uint32_t port_index, MidiPortState state) override {} void CompleteStartSession(Result result) override { base::AutoLock lock(lock_); @@ -58,7 +58,9 @@ class FakeMidiManagerClient : public MidiManagerClient { wait_for_result_ = false; } - void ReceiveMidiData(uint32 port_index, const uint8* data, size_t size, + void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, + size_t size, double timestamp) override {} void AccumulateMidiBytesSent(size_t size) override {} void Detach() override {} diff --git a/media/midi/midi_manager_unittest.cc b/media/midi/midi_manager_unittest.cc index bf2b573..0c77dda 100644 --- a/media/midi/midi_manager_unittest.cc +++ b/media/midi/midi_manager_unittest.cc @@ -34,8 +34,8 @@ class FakeMidiManager : public MidiManager { void Finalize() override { finalize_is_called_ = true; } void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) override {} // Utility functions for testing. @@ -67,8 +67,8 @@ class FakeMidiManagerClient : public MidiManagerClient { // MidiManagerClient implementation. void AddInputPort(const MidiPortInfo& info) override {} void AddOutputPort(const MidiPortInfo& info) override {} - void SetInputPortState(uint32 port_index, MidiPortState state) override {} - void SetOutputPortState(uint32 port_index, MidiPortState state) override {} + void SetInputPortState(uint32_t port_index, MidiPortState state) override {} + void SetOutputPortState(uint32_t port_index, MidiPortState state) override {} void CompleteStartSession(Result result) override { EXPECT_TRUE(wait_for_result_); @@ -76,8 +76,8 @@ class FakeMidiManagerClient : public MidiManagerClient { wait_for_result_ = false; } - void ReceiveMidiData(uint32 port_index, - const uint8* data, + void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, size_t size, double timestamp) override {} void AccumulateMidiBytesSent(size_t size) override {} diff --git a/media/midi/midi_manager_usb.cc b/media/midi/midi_manager_usb.cc index 9e4778c..9dd93f4 100644 --- a/media/midi/midi_manager_usb.cc +++ b/media/midi/midi_manager_usb.cc @@ -37,7 +37,7 @@ void MidiManagerUsb::Initialize(base::Callback<void(Result result)> callback) { void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client, uint32_t port_index, - const std::vector<uint8>& data, + const std::vector<uint8_t>& data, double timestamp) { if (port_index >= output_streams_.size()) { // |port_index| is provided by a renderer so we can't believe that it is @@ -55,7 +55,7 @@ void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client, void MidiManagerUsb::ReceiveUsbMidiData(UsbMidiDevice* device, int endpoint_number, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) { if (!input_stream_) @@ -80,22 +80,22 @@ void MidiManagerUsb::OnDeviceDetached(size_t index) { UsbMidiDevice* device = devices_[index]; for (size_t i = 0; i < output_streams_.size(); ++i) { if (output_streams_[i]->jack().device == device) { - SetOutputPortState(static_cast<uint32>(i), MIDI_PORT_DISCONNECTED); + SetOutputPortState(static_cast<uint32_t>(i), MIDI_PORT_DISCONNECTED); } } const std::vector<UsbMidiJack>& input_jacks = input_stream_->jacks(); for (size_t i = 0; i < input_jacks.size(); ++i) { if (input_jacks[i].device == device) { - SetInputPortState(static_cast<uint32>(i), MIDI_PORT_DISCONNECTED); + SetInputPortState(static_cast<uint32_t>(i), MIDI_PORT_DISCONNECTED); } } } void MidiManagerUsb::OnReceivedData(size_t jack_index, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) { - ReceiveMidiData(static_cast<uint32>(jack_index), data, size, time); + ReceiveMidiData(static_cast<uint32_t>(jack_index), data, size, time); } @@ -118,8 +118,8 @@ void MidiManagerUsb::OnEnumerateDevicesDone(bool result, bool MidiManagerUsb::AddPorts(UsbMidiDevice* device, int device_id) { UsbMidiDescriptorParser parser; - std::vector<uint8> descriptor = device->GetDescriptors(); - const uint8* data = descriptor.size() > 0 ? &descriptor[0] : NULL; + std::vector<uint8_t> descriptor = device->GetDescriptors(); + const uint8_t* data = descriptor.size() > 0 ? &descriptor[0] : NULL; std::vector<UsbMidiJack> jacks; bool parse_result = parser.Parse(device, data, diff --git a/media/midi/midi_manager_usb.h b/media/midi/midi_manager_usb.h index a91e3a3..c3b886f 100644 --- a/media/midi/midi_manager_usb.h +++ b/media/midi/midi_manager_usb.h @@ -8,7 +8,6 @@ #include <utility> #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" @@ -39,14 +38,14 @@ class USB_MIDI_EXPORT MidiManagerUsb // MidiManager implementation. void StartInitialization() override; void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) override; // UsbMidiDeviceDelegate implementation. void ReceiveUsbMidiData(UsbMidiDevice* device, int endpoint_number, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) override; void OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) override; @@ -54,7 +53,7 @@ class USB_MIDI_EXPORT MidiManagerUsb // UsbMidiInputStream::Delegate implementation. void OnReceivedData(size_t jack_index, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) override; diff --git a/media/midi/midi_manager_usb_unittest.cc b/media/midi/midi_manager_usb_unittest.cc index a9b90a9..57b723a 100644 --- a/media/midi/midi_manager_usb_unittest.cc +++ b/media/midi/midi_manager_usb_unittest.cc @@ -46,7 +46,7 @@ class FakeUsbMidiDevice : public UsbMidiDevice { explicit FakeUsbMidiDevice(Logger* logger) : logger_(logger) {} ~FakeUsbMidiDevice() override {} - std::vector<uint8> GetDescriptors() override { + std::vector<uint8_t> GetDescriptors() override { logger_->AddLog("UsbMidiDevice::GetDescriptors\n"); return descriptors_; } @@ -55,7 +55,7 @@ class FakeUsbMidiDevice : public UsbMidiDevice { std::string GetProductName() override { return product_name_; } std::string GetDeviceVersion() override { return device_version_; } - void Send(int endpoint_number, const std::vector<uint8>& data) override { + void Send(int endpoint_number, const std::vector<uint8_t>& data) override { logger_->AddLog("UsbMidiDevice::Send "); logger_->AddLog(base::StringPrintf("endpoint = %d data =", endpoint_number)); @@ -64,7 +64,7 @@ class FakeUsbMidiDevice : public UsbMidiDevice { logger_->AddLog("\n"); } - void SetDescriptors(const std::vector<uint8> descriptors) { + void SetDescriptors(const std::vector<uint8_t> descriptors) { descriptors_ = descriptors; } void SetManufacturer(const std::string& manufacturer) { @@ -78,7 +78,7 @@ class FakeUsbMidiDevice : public UsbMidiDevice { } private: - std::vector<uint8> descriptors_; + std::vector<uint8_t> descriptors_; std::string manufacturer_; std::string product_name_; std::string device_version_; @@ -103,17 +103,17 @@ class FakeMidiManagerClient : public MidiManagerClient { output_ports_.push_back(info); } - void SetInputPortState(uint32 port_index, MidiPortState state) override {} + void SetInputPortState(uint32_t port_index, MidiPortState state) override {} - void SetOutputPortState(uint32 port_index, MidiPortState state) override {} + void SetOutputPortState(uint32_t port_index, MidiPortState state) override {} void CompleteStartSession(Result result) override { complete_start_session_ = true; result_ = result; } - void ReceiveMidiData(uint32 port_index, - const uint8* data, + void ReceiveMidiData(uint32_t port_index, + const uint8_t* data, size_t size, double timestamp) override { logger_->AddLog("MidiManagerClient::ReceiveMidiData "); @@ -237,21 +237,19 @@ class MidiManagerUsbTest : public ::testing::Test { TEST_F(MidiManagerUsbTest, Initialize) { scoped_ptr<FakeUsbMidiDevice> device(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t descriptors[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; device->SetDescriptors(ToVector(descriptors)); device->SetManufacturer("vendor1"); @@ -295,7 +293,7 @@ TEST_F(MidiManagerUsbTest, Initialize) { TEST_F(MidiManagerUsbTest, InitializeMultipleDevices) { scoped_ptr<FakeUsbMidiDevice> device1(new FakeUsbMidiDevice(&logger_)); scoped_ptr<FakeUsbMidiDevice> device2(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = { + uint8_t descriptors[] = { 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, @@ -378,7 +376,7 @@ TEST_F(MidiManagerUsbTest, InitializeFail) { TEST_F(MidiManagerUsbTest, InitializeFailBecauseOfInvalidDescriptors) { scoped_ptr<FakeUsbMidiDevice> device(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = {0x04}; + uint8_t descriptors[] = {0x04}; device->SetDescriptors(ToVector(descriptors)); Initialize(); @@ -393,27 +391,24 @@ TEST_F(MidiManagerUsbTest, InitializeFailBecauseOfInvalidDescriptors) { TEST_F(MidiManagerUsbTest, Send) { Initialize(); scoped_ptr<FakeUsbMidiDevice> device(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t descriptors[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; device->SetDescriptors(ToVector(descriptors)); - uint8 data[] = { - 0x90, 0x45, 0x7f, - 0xf0, 0x00, 0x01, 0xf7, + uint8_t data[] = { + 0x90, 0x45, 0x7f, 0xf0, 0x00, 0x01, 0xf7, }; ScopedVector<UsbMidiDevice> devices; @@ -439,27 +434,24 @@ TEST_F(MidiManagerUsbTest, Send) { TEST_F(MidiManagerUsbTest, SendFromCompromizedRenderer) { scoped_ptr<FakeUsbMidiDevice> device(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t descriptors[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; device->SetDescriptors(ToVector(descriptors)); - uint8 data[] = { - 0x90, 0x45, 0x7f, - 0xf0, 0x00, 0x01, 0xf7, + uint8_t data[] = { + 0x90, 0x45, 0x7f, 0xf0, 0x00, 0x01, 0xf7, }; Initialize(); @@ -482,29 +474,26 @@ TEST_F(MidiManagerUsbTest, SendFromCompromizedRenderer) { TEST_F(MidiManagerUsbTest, Receive) { scoped_ptr<FakeUsbMidiDevice> device(new FakeUsbMidiDevice(&logger_)); - uint8 descriptors[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t descriptors[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; device->SetDescriptors(ToVector(descriptors)); - uint8 data[] = { - 0x09, 0x90, 0x45, 0x7f, - 0x04, 0xf0, 0x00, 0x01, - 0x49, 0x90, 0x88, 0x99, // This data should be ignored (CN = 4). - 0x05, 0xf7, 0x00, 0x00, + uint8_t data[] = { + 0x09, 0x90, 0x45, 0x7f, 0x04, 0xf0, 0x00, + 0x01, 0x49, 0x90, 0x88, 0x99, // This data should be ignored (CN = 4). + 0x05, 0xf7, 0x00, 0x00, }; Initialize(); @@ -530,21 +519,19 @@ TEST_F(MidiManagerUsbTest, Receive) { } TEST_F(MidiManagerUsbTest, AttachDevice) { - uint8 descriptors[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t descriptors[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; Initialize(); diff --git a/media/midi/midi_manager_win.cc b/media/midi/midi_manager_win.cc index efab827..dfbd3f9 100644 --- a/media/midi/midi_manager_win.cc +++ b/media/midi/midi_manager_win.cc @@ -104,20 +104,20 @@ ScopedMIDIHDR CreateMIDIHDR(size_t size) { } void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle, - const std::vector<uint8>& message) { + const std::vector<uint8_t>& message) { DCHECK_LE(message.size(), static_cast<size_t>(3)) << "A short MIDI message should be up to 3 bytes."; DWORD packed_message = 0; for (size_t i = 0; i < message.size(); ++i) - packed_message |= (static_cast<uint32>(message[i]) << (i * 8)); + packed_message |= (static_cast<uint32_t>(message[i]) << (i * 8)); MMRESULT result = midiOutShortMsg(midi_out_handle, packed_message); DLOG_IF(ERROR, result != MMSYSERR_NOERROR) << "Failed to output short message: " << GetOutErrorMessage(result); } void SendLongMidiMessageInternal(HMIDIOUT midi_out_handle, - const std::vector<uint8>& message) { + const std::vector<uint8_t>& message) { // Implementation note: // Sending a long MIDI message can be performed synchronously or // asynchronously depending on the driver. There are 2 options to support both @@ -214,12 +214,12 @@ struct MidiDeviceInfo final { // of two MIDI devices. // TODO(toyoshim): Consider to calculate MIDIPort.id here and use it as the // key. See crbug.com/467448. Then optimize the data for |MidiPortInfo|. - const uint16 manufacturer_id; - const uint16 product_id; - const uint32 driver_version; + const uint16_t manufacturer_id; + const uint16_t product_id; + const uint32_t driver_version; const base::string16 product_name; - const uint16 usb_vendor_id; - const uint16 usb_product_id; + const uint16_t usb_vendor_id; + const uint16_t usb_product_id; const bool is_usb_device; const bool is_software_synth; @@ -268,22 +268,22 @@ struct MidiDeviceInfo final { static bool IsSoftwareSynth(const MIDIOUTCAPS2W& caps) { return caps.wTechnology == MOD_SWSYNTH; } - static uint16 ExtractUsbVendorIdIfExists(const MIDIINCAPS2W& caps) { + static uint16_t ExtractUsbVendorIdIfExists(const MIDIINCAPS2W& caps) { if (!IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid)) return 0; return EXTRACT_USBAUDIO_MID(&caps.ManufacturerGuid); } - static uint16 ExtractUsbVendorIdIfExists(const MIDIOUTCAPS2W& caps) { + static uint16_t ExtractUsbVendorIdIfExists(const MIDIOUTCAPS2W& caps) { if (!IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid)) return 0; return EXTRACT_USBAUDIO_MID(&caps.ManufacturerGuid); } - static uint16 ExtractUsbProductIdIfExists(const MIDIINCAPS2W& caps) { + static uint16_t ExtractUsbProductIdIfExists(const MIDIINCAPS2W& caps) { if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid)) return 0; return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); } - static uint16 ExtractUsbProductIdIfExists(const MIDIOUTCAPS2W& caps) { + static uint16_t ExtractUsbProductIdIfExists(const MIDIOUTCAPS2W& caps) { if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid)) return 0; return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); @@ -311,10 +311,12 @@ bool IsUnsupportedDevice(const MidiDeviceInfo& info) { info.product_id == MM_MSFT_GENERIC_MIDISYNTH); } -using PortNumberCache = base::hash_map< - MidiDeviceInfo, - std::priority_queue<uint32, std::vector<uint32>, std::greater<uint32>>, - MidiDeviceInfo::Hasher>; +using PortNumberCache = + base::hash_map<MidiDeviceInfo, + std::priority_queue<uint32_t, + std::vector<uint32_t>, + std::greater<uint32_t>>, + MidiDeviceInfo::Hasher>; struct MidiInputDeviceState final : base::RefCountedThreadSafe<MidiInputDeviceState> { @@ -333,12 +335,12 @@ struct MidiInputDeviceState final base::TimeTicks start_time; // 0-based port index. We will try to reuse the previous port index when the // MIDI device is closed then reopened. - uint32 port_index; + uint32_t port_index; // A sequence number which represents how many times |port_index| is reused. // We can remove this field if we decide not to clear unsent events // when the device is disconnected. // See https://github.com/WebAudio/web-midi-api/issues/133 - uint64 port_age; + uint64_t port_age; // True if |start_time| is initialized. This field is not used so far, but // kept for the debugging purpose. bool start_time_initialized; @@ -361,12 +363,12 @@ struct MidiOutputDeviceState final HMIDIOUT midi_handle; // 0-based port index. We will try to reuse the previous port index when the // MIDI device is closed then reopened. - uint32 port_index; + uint32_t port_index; // A sequence number which represents how many times |port_index| is reused. // We can remove this field if we decide not to clear unsent events // when the device is disconnected. // See https://github.com/WebAudio/web-midi-api/issues/133 - uint64 port_age; + uint64_t port_age; // True if the device is already closed and |midi_handle| is considered to be // invalid. // TODO(toyoshim): Use std::atomic<bool> when it is allowed in Chromium @@ -502,8 +504,8 @@ class MidiServiceWinImpl : public MidiServiceWin, base::Unretained(this), Result::OK)); } - void SendMidiDataAsync(uint32 port_number, - const std::vector<uint8>& data, + void SendMidiDataAsync(uint32_t port_number, + const std::vector<uint8_t>& data, base::TimeTicks time) final { if (destructor_started) { LOG(ERROR) << "ThreadSafeSendData failed because MidiServiceWinImpl is " @@ -572,7 +574,7 @@ class MidiServiceWinImpl : public MidiServiceWin, } scoped_refptr<MidiOutputDeviceState> GetOutputDeviceFromPort( - uint32 port_number) { + uint32_t port_number) { base::AutoLock auto_lock(output_ports_lock_); if (output_ports_.size() <= port_number) return nullptr; @@ -635,12 +637,12 @@ class MidiServiceWinImpl : public MidiServiceWin, state->midi_header = CreateMIDIHDR(kBufferLength); const auto& state_device_info = state->device_info; bool add_new_port = false; - uint32 port_number = 0; + uint32_t port_number = 0; { base::AutoLock auto_lock(input_ports_lock_); const auto it = unused_input_ports_.find(state_device_info); if (it == unused_input_ports_.end()) { - port_number = static_cast<uint32>(input_ports_.size()); + port_number = static_cast<uint32_t>(input_ports_.size()); add_new_port = true; input_ports_.push_back(nullptr); input_ports_ages_.push_back(0); @@ -689,13 +691,14 @@ class MidiServiceWinImpl : public MidiServiceWin, auto state = GetInputDeviceFromHandle(midi_in_handle); if (!state) return; - const uint8 status_byte = static_cast<uint8>(param1 & 0xff); - const uint8 first_data_byte = static_cast<uint8>((param1 >> 8) & 0xff); - const uint8 second_data_byte = static_cast<uint8>((param1 >> 16) & 0xff); + const uint8_t status_byte = static_cast<uint8_t>(param1 & 0xff); + const uint8_t first_data_byte = static_cast<uint8_t>((param1 >> 8) & 0xff); + const uint8_t second_data_byte = + static_cast<uint8_t>((param1 >> 16) & 0xff); const DWORD elapsed_ms = param2; const size_t len = GetMidiMessageLength(status_byte); - const uint8 kData[] = {status_byte, first_data_byte, second_data_byte}; - std::vector<uint8> data; + const uint8_t kData[] = {status_byte, first_data_byte, second_data_byte}; + std::vector<uint8_t> data; data.assign(kData, kData + len); DCHECK_LE(len, arraysize(kData)); // MIM_DATA/MIM_LONGDATA message treats the time when midiInStart() is @@ -732,8 +735,8 @@ class MidiServiceWinImpl : public MidiServiceWin, return; } if (header->dwBytesRecorded > 0) { - const uint8* src = reinterpret_cast<const uint8*>(header->lpData); - std::vector<uint8> data; + const uint8_t* src = reinterpret_cast<const uint8_t*>(header->lpData); + std::vector<uint8_t> data; data.assign(src, src + header->dwBytesRecorded); // MIM_DATA/MIM_LONGDATA message treats the time when midiInStart() is // called as the origin of |elapsed_ms|. @@ -757,7 +760,7 @@ class MidiServiceWinImpl : public MidiServiceWin, auto state = GetInputDeviceFromHandle(midi_in_handle); if (!state) return; - const uint32 port_number = state->port_index; + const uint32_t port_number = state->port_index; const auto device_info(state->device_info); { base::AutoLock auto_lock(input_ports_lock_); @@ -818,12 +821,12 @@ class MidiServiceWinImpl : public MidiServiceWin, if (IsUnsupportedDevice(state_device_info)) return; bool add_new_port = false; - uint32 port_number = 0; + uint32_t port_number = 0; { base::AutoLock auto_lock(output_ports_lock_); const auto it = unused_output_ports_.find(state_device_info); if (it == unused_output_ports_.end()) { - port_number = static_cast<uint32>(output_ports_.size()); + port_number = static_cast<uint32_t>(output_ports_.size()); add_new_port = true; output_ports_.push_back(nullptr); output_ports_ages_.push_back(0); @@ -879,7 +882,7 @@ class MidiServiceWinImpl : public MidiServiceWin, auto state = GetOutputDeviceFromHandle(midi_out_handle); if (!state) return; - const uint32 port_number = state->port_index; + const uint32_t port_number = state->port_index; const auto device_info(state->device_info); { base::AutoLock auto_lock(output_ports_lock_); @@ -904,9 +907,9 @@ class MidiServiceWinImpl : public MidiServiceWin, DCHECK_EQ(sender_thread_.GetThreadId(), base::PlatformThread::CurrentId()); } - void SendOnSenderThread(uint32 port_number, - uint64 port_age, - const std::vector<uint8>& data, + void SendOnSenderThread(uint32_t port_number, + uint64_t port_age, + const std::vector<uint8_t>& data, base::TimeTicks time) { AssertOnSenderThread(); if (destructor_started) { @@ -935,7 +938,7 @@ class MidiServiceWinImpl : public MidiServiceWin, // MIDI Running status must be filtered out. MidiMessageQueue message_queue(false); message_queue.Add(data); - std::vector<uint8> message; + std::vector<uint8_t> message; while (true) { if (destructor_started) break; @@ -1048,8 +1051,8 @@ class MidiServiceWinImpl : public MidiServiceWin, delegate_->OnCompleteInitialization(result); } - void ReceiveMidiDataOnTaskThread(uint32 port_index, - std::vector<uint8> data, + void ReceiveMidiDataOnTaskThread(uint32_t port_index, + std::vector<uint8_t> data, base::TimeTicks time) { AssertOnTaskThread(); delegate_->OnReceiveMidiData(port_index, data, time); @@ -1065,12 +1068,13 @@ class MidiServiceWinImpl : public MidiServiceWin, delegate_->OnAddOutputPort(info); } - void SetInputPortStateOnTaskThread(uint32 port_index, MidiPortState state) { + void SetInputPortStateOnTaskThread(uint32_t port_index, MidiPortState state) { AssertOnTaskThread(); delegate_->OnSetInputPortState(port_index, state); } - void SetOutputPortStateOnTaskThread(uint32 port_index, MidiPortState state) { + void SetOutputPortStateOnTaskThread(uint32_t port_index, + MidiPortState state) { AssertOnTaskThread(); delegate_->OnSetOutputPortState(port_index, state); } @@ -1093,7 +1097,7 @@ class MidiServiceWinImpl : public MidiServiceWin, PortNumberCache unused_input_ports_; // GUARDED_BY(input_ports_lock_) std::vector<scoped_refptr<MidiInputDeviceState>> input_ports_; // GUARDED_BY(input_ports_lock_) - std::vector<uint64> input_ports_ages_; // GUARDED_BY(input_ports_lock_) + std::vector<uint64_t> input_ports_ages_; // GUARDED_BY(input_ports_lock_) base::Lock output_ports_lock_; base::hash_map<HMIDIOUT, scoped_refptr<MidiOutputDeviceState>> @@ -1101,7 +1105,7 @@ class MidiServiceWinImpl : public MidiServiceWin, PortNumberCache unused_output_ports_; // GUARDED_BY(output_ports_lock_) std::vector<scoped_refptr<MidiOutputDeviceState>> output_ports_; // GUARDED_BY(output_ports_lock_) - std::vector<uint64> output_ports_ages_; // GUARDED_BY(output_ports_lock_) + std::vector<uint64_t> output_ports_ages_; // GUARDED_BY(output_ports_lock_) // True if one thread reached MidiServiceWinImpl::~MidiServiceWinImpl(). Note // that MidiServiceWinImpl::~MidiServiceWinImpl() is blocked until @@ -1133,8 +1137,8 @@ void MidiManagerWin::Finalize() { } void MidiManagerWin::DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) { if (!midi_service_) return; @@ -1164,18 +1168,18 @@ void MidiManagerWin::OnAddOutputPort(MidiPortInfo info) { AddOutputPort(info); } -void MidiManagerWin::OnSetInputPortState(uint32 port_index, +void MidiManagerWin::OnSetInputPortState(uint32_t port_index, MidiPortState state) { SetInputPortState(port_index, state); } -void MidiManagerWin::OnSetOutputPortState(uint32 port_index, +void MidiManagerWin::OnSetOutputPortState(uint32_t port_index, MidiPortState state) { SetOutputPortState(port_index, state); } -void MidiManagerWin::OnReceiveMidiData(uint32 port_index, - const std::vector<uint8>& data, +void MidiManagerWin::OnReceiveMidiData(uint32_t port_index, + const std::vector<uint8_t>& data, base::TimeTicks time) { ReceiveMidiData(port_index, &data[0], data.size(), time); } diff --git a/media/midi/midi_manager_win.h b/media/midi/midi_manager_win.h index b54f9d1..9d1aee2 100644 --- a/media/midi/midi_manager_win.h +++ b/media/midi/midi_manager_win.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/threading/thread.h" #include "base/time/time.h" @@ -22,10 +21,12 @@ class MidiServiceWinDelegate { virtual void OnCompleteInitialization(Result result) = 0; virtual void OnAddInputPort(MidiPortInfo info) = 0; virtual void OnAddOutputPort(MidiPortInfo info) = 0; - virtual void OnSetInputPortState(uint32 port_index, MidiPortState state) = 0; - virtual void OnSetOutputPortState(uint32 port_index, MidiPortState state) = 0; - virtual void OnReceiveMidiData(uint32 port_index, - const std::vector<uint8>& data, + virtual void OnSetInputPortState(uint32_t port_index, + MidiPortState state) = 0; + virtual void OnSetOutputPortState(uint32_t port_index, + MidiPortState state) = 0; + virtual void OnReceiveMidiData(uint32_t port_index, + const std::vector<uint8_t>& data, base::TimeTicks time) = 0; }; @@ -35,8 +36,8 @@ class MidiServiceWin { // This method may return before the initialization is completed. virtual void InitializeAsync(MidiServiceWinDelegate* delegate) = 0; // This method may return before the specified data is actually sent. - virtual void SendMidiDataAsync(uint32 port_number, - const std::vector<uint8>& data, + virtual void SendMidiDataAsync(uint32_t port_number, + const std::vector<uint8_t>& data, base::TimeTicks time) = 0; }; @@ -49,18 +50,18 @@ class MidiManagerWin final : public MidiManager, public MidiServiceWinDelegate { void StartInitialization() final; void Finalize() final; void DispatchSendMidiData(MidiManagerClient* client, - uint32 port_index, - const std::vector<uint8>& data, + uint32_t port_index, + const std::vector<uint8_t>& data, double timestamp) final; // MidiServiceWinDelegate overrides: void OnCompleteInitialization(Result result) final; void OnAddInputPort(MidiPortInfo info) final; void OnAddOutputPort(MidiPortInfo info) final; - void OnSetInputPortState(uint32 port_index, MidiPortState state) final; - void OnSetOutputPortState(uint32 port_index, MidiPortState state) final; - void OnReceiveMidiData(uint32 port_index, - const std::vector<uint8>& data, + void OnSetInputPortState(uint32_t port_index, MidiPortState state) final; + void OnSetOutputPortState(uint32_t port_index, MidiPortState state) final; + void OnReceiveMidiData(uint32_t port_index, + const std::vector<uint8_t>& data, base::TimeTicks time) final; private: diff --git a/media/midi/midi_message_queue.cc b/media/midi/midi_message_queue.cc index 20fcc87..bfc05f1 100644 --- a/media/midi/midi_message_queue.cc +++ b/media/midi/midi_message_queue.cc @@ -13,18 +13,18 @@ namespace media { namespace midi { namespace { -const uint8 kSysEx = 0xf0; -const uint8 kEndOfSysEx = 0xf7; +const uint8_t kSysEx = 0xf0; +const uint8_t kEndOfSysEx = 0xf7; -bool IsDataByte(uint8 data) { +bool IsDataByte(uint8_t data) { return (data & 0x80) == 0; } -bool IsSystemRealTimeMessage(uint8 data) { +bool IsSystemRealTimeMessage(uint8_t data) { return 0xf8 <= data; } -bool IsSystemMessage(uint8 data) { +bool IsSystemMessage(uint8_t data) { return 0xf0 <= data; } @@ -35,21 +35,21 @@ MidiMessageQueue::MidiMessageQueue(bool allow_running_status) MidiMessageQueue::~MidiMessageQueue() {} -void MidiMessageQueue::Add(const std::vector<uint8>& data) { +void MidiMessageQueue::Add(const std::vector<uint8_t>& data) { queue_.insert(queue_.end(), data.begin(), data.end()); } -void MidiMessageQueue::Add(const uint8* data, size_t length) { +void MidiMessageQueue::Add(const uint8_t* data, size_t length) { queue_.insert(queue_.end(), data, data + length); } -void MidiMessageQueue::Get(std::vector<uint8>* message) { +void MidiMessageQueue::Get(std::vector<uint8_t>* message) { message->clear(); while (true) { // Check if |next_message_| is already a complete MIDI message or not. if (!next_message_.empty()) { - const uint8 status_byte = next_message_.front(); + const uint8_t status_byte = next_message_.front(); const size_t target_len = GetMidiMessageLength(status_byte); if (target_len == 0) { DCHECK_EQ(kSysEx, status_byte); @@ -83,7 +83,7 @@ void MidiMessageQueue::Get(std::vector<uint8>* message) { // at an arbitrary byte position of MIDI stream. Here we reorder // "System Real Time Messages" prior to |next_message_| so that each message // can be clearly separated as a complete MIDI message. - const uint8 next = queue_.front(); + const uint8_t next = queue_.front(); if (IsSystemRealTimeMessage(next)) { message->push_back(next); queue_.pop_front(); @@ -106,7 +106,7 @@ void MidiMessageQueue::Get(std::vector<uint8>* message) { continue; } - const uint8 status_byte = next_message_.front(); + const uint8_t status_byte = next_message_.front(); // If we receive a new non-data byte before completing the pending message, // drop the pending message and respin the loop to re-evaluate |next|. diff --git a/media/midi/midi_message_queue.h b/media/midi/midi_message_queue.h index e494c5a..8573781 100644 --- a/media/midi/midi_message_queue.h +++ b/media/midi/midi_message_queue.h @@ -5,10 +5,12 @@ #ifndef MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ #define MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ +#include <stdint.h> + #include <deque> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/midi/midi_export.h" namespace media { @@ -28,12 +30,12 @@ namespace midi { // MidiMessageQueue queue(true); // true to support "running status" // while (true) { // if (is_incoming_midi_data_available()) { -// std::vector<uint8> incoming_data; +// std::vector<uint8_t> incoming_data; // read_incoming_midi_data(&incoming_data) // queue.Add(incoming_data); // } // while (true) { -// std::vector<uint8> next_message; +// std::vector<uint8_t> next_message; // queue.Get(&next_message); // if (!next_message.empty()) // dispatch(next_message); @@ -47,8 +49,8 @@ class MIDI_EXPORT MidiMessageQueue { ~MidiMessageQueue(); // Enqueues |data| to the internal buffer. - void Add(const std::vector<uint8>& data); - void Add(const uint8* data, size_t length); + void Add(const std::vector<uint8_t>& data); + void Add(const uint8_t* data, size_t length); // Fills the next complete MIDI message into |message|. If |message| is // not empty, the data sequence falls into one of the following types of @@ -59,11 +61,11 @@ class MIDI_EXPORT MidiMessageQueue { // - Single "System Common Message" (w/o "System Real Time Messages") // - Single "System Real Time message" // |message| is empty if there is no complete MIDI message any more. - void Get(std::vector<uint8>* message); + void Get(std::vector<uint8_t>* message); private: - std::deque<uint8> queue_; - std::vector<uint8> next_message_; + std::deque<uint8_t> queue_; + std::vector<uint8_t> next_message_; const bool allow_running_status_; DISALLOW_COPY_AND_ASSIGN(MidiMessageQueue); }; diff --git a/media/midi/midi_message_queue_unittest.cc b/media/midi/midi_message_queue_unittest.cc index 4abdc5b..ce2c9fe 100644 --- a/media/midi/midi_message_queue_unittest.cc +++ b/media/midi/midi_message_queue_unittest.cc @@ -10,38 +10,37 @@ namespace media { namespace midi { namespace { -const uint8 kGMOn[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7 }; -const uint8 kPartialGMOn1st[] = { 0xf0 }; -const uint8 kPartialGMOn2nd[] = { 0x7e, 0x7f, 0x09, 0x01 }; -const uint8 kPartialGMOn3rd[] = { 0xf7 }; -const uint8 kGSOn[] = { - 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41, 0xf7, +const uint8_t kGMOn[] = {0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7}; +const uint8_t kPartialGMOn1st[] = {0xf0}; +const uint8_t kPartialGMOn2nd[] = {0x7e, 0x7f, 0x09, 0x01}; +const uint8_t kPartialGMOn3rd[] = {0xf7}; +const uint8_t kGSOn[] = { + 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41, 0xf7, }; -const uint8 kNoteOn[] = { 0x90, 0x3c, 0x7f }; -const uint8 kPartialNoteOn1st[] = { 0x90 }; -const uint8 kPartialNoteOn2nd[] = { 0x3c }; -const uint8 kPartialNoteOn3rd[] = { 0x7f }; +const uint8_t kNoteOn[] = {0x90, 0x3c, 0x7f}; +const uint8_t kPartialNoteOn1st[] = {0x90}; +const uint8_t kPartialNoteOn2nd[] = {0x3c}; +const uint8_t kPartialNoteOn3rd[] = {0x7f}; -const uint8 kNoteOnWithRunningStatus[] = { - 0x90, 0x3c, 0x7f, 0x3c, 0x7f, 0x3c, 0x7f, +const uint8_t kNoteOnWithRunningStatus[] = { + 0x90, 0x3c, 0x7f, 0x3c, 0x7f, 0x3c, 0x7f, }; -const uint8 kChannelPressure[] = { 0xd0, 0x01 }; -const uint8 kChannelPressureWithRunningStatus[] = { - 0xd0, 0x01, 0x01, 0x01, -}; -const uint8 kTimingClock[] = { 0xf8 }; -const uint8 kSystemCommonMessageTuneRequest[] = { 0xf6 }; -const uint8 kMTCFrame[] = { 0xf1, 0x00 }; -const uint8 kBrokenData1[] = { 0x92 }; -const uint8 kBrokenData2[] = { 0xf7 }; -const uint8 kBrokenData3[] = { 0xf2, 0x00 }; -const uint8 kDataByte0[] = { 0x00 }; - -const uint8 kReservedMessage1[] = { 0xf4 }; -const uint8 kReservedMessage2[] = { 0xf5 }; -const uint8 kReservedMessage1WithDataBytes[] = { - 0xf4, 0x01, 0x01, 0x01, 0x01, 0x01 +const uint8_t kChannelPressure[] = {0xd0, 0x01}; +const uint8_t kChannelPressureWithRunningStatus[] = { + 0xd0, 0x01, 0x01, 0x01, }; +const uint8_t kTimingClock[] = {0xf8}; +const uint8_t kSystemCommonMessageTuneRequest[] = {0xf6}; +const uint8_t kMTCFrame[] = {0xf1, 0x00}; +const uint8_t kBrokenData1[] = {0x92}; +const uint8_t kBrokenData2[] = {0xf7}; +const uint8_t kBrokenData3[] = {0xf2, 0x00}; +const uint8_t kDataByte0[] = {0x00}; + +const uint8_t kReservedMessage1[] = {0xf4}; +const uint8_t kReservedMessage2[] = {0xf5}; +const uint8_t kReservedMessage1WithDataBytes[] = {0xf4, 0x01, 0x01, + 0x01, 0x01, 0x01}; template <typename T, size_t N> void Add(MidiMessageQueue* queue, const T(&array)[N]) { @@ -72,7 +71,7 @@ template <typename T, size_t N> TEST(MidiMessageQueueTest, EmptyData) { MidiMessageQueue queue(false); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_TRUE(message.empty()); } @@ -92,7 +91,7 @@ TEST(MidiMessageQueueTest, RunningStatusDisabled) { Add(&queue, kTimingClock); Add(&queue, kBrokenData3); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_MESSAGE(kGMOn, message); queue.Get(&message); @@ -125,7 +124,7 @@ TEST(MidiMessageQueueTest, RunningStatusEnabled) { Add(&queue, kTimingClock); Add(&queue, kDataByte0); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_MESSAGE(kGMOn, message); queue.Get(&message); @@ -157,12 +156,12 @@ TEST(MidiMessageQueueTest, RunningStatusEnabled) { TEST(MidiMessageQueueTest, RunningStatusEnabledWithRealTimeEvent) { MidiMessageQueue queue(true); - const uint8 kNoteOnWithRunningStatusWithTimingClock[] = { - 0x90, 0xf8, 0x3c, 0xf8, 0x7f, 0xf8, 0x3c, 0xf8, 0x7f, 0xf8, 0x3c, 0xf8, - 0x7f, + const uint8_t kNoteOnWithRunningStatusWithTimingClock[] = { + 0x90, 0xf8, 0x3c, 0xf8, 0x7f, 0xf8, 0x3c, + 0xf8, 0x7f, 0xf8, 0x3c, 0xf8, 0x7f, }; Add(&queue, kNoteOnWithRunningStatusWithTimingClock); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_MESSAGE(kTimingClock, message); queue.Get(&message); @@ -187,11 +186,11 @@ TEST(MidiMessageQueueTest, RunningStatusEnabledWithRealTimeEvent) { TEST(MidiMessageQueueTest, RunningStatusEnabledWithSystemCommonMessage) { MidiMessageQueue queue(true); - const uint8 kNoteOnWithRunningStatusWithSystemCommonMessage[] = { - 0x90, 0x3c, 0x7f, 0xf1, 0x00, 0x3c, 0x7f, 0xf8, 0x90, 0x3c, 0x7f, + const uint8_t kNoteOnWithRunningStatusWithSystemCommonMessage[] = { + 0x90, 0x3c, 0x7f, 0xf1, 0x00, 0x3c, 0x7f, 0xf8, 0x90, 0x3c, 0x7f, }; Add(&queue, kNoteOnWithRunningStatusWithSystemCommonMessage); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_MESSAGE(kNoteOn, message); queue.Get(&message); @@ -205,17 +204,17 @@ TEST(MidiMessageQueueTest, RunningStatusEnabledWithSystemCommonMessage) { } TEST(MidiMessageQueueTest, Issue540016) { - const uint8 kData[] = { 0xf4, 0x3a }; + const uint8_t kData[] = {0xf4, 0x3a}; MidiMessageQueue queue(false); Add(&queue, kData); - std::vector<uint8> message; + std::vector<uint8_t> message; queue.Get(&message); EXPECT_TRUE(message.empty()); } TEST(MidiMessageQueueTest, ReconstructNonSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialNoteOn1st); queue.Get(&message); @@ -235,7 +234,7 @@ TEST(MidiMessageQueueTest, ReconstructNonSysExMessage) { TEST(MidiMessageQueueTest, ReconstructBrokenNonSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialNoteOn1st); queue.Get(&message); @@ -256,7 +255,7 @@ TEST(MidiMessageQueueTest, ReconstructBrokenNonSysExMessage) { TEST(MidiMessageQueueTest, ReconstructSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialGMOn1st); queue.Get(&message); @@ -276,7 +275,7 @@ TEST(MidiMessageQueueTest, ReconstructSysExMessage) { TEST(MidiMessageQueueTest, ReconstructBrokenSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialGMOn1st); queue.Get(&message); @@ -300,7 +299,7 @@ TEST(MidiMessageQueueTest, ReconstructBrokenSysExMessage) { TEST(MidiMessageQueueTest, OneByteMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kSystemCommonMessageTuneRequest); Add(&queue, kSystemCommonMessageTuneRequest); @@ -336,7 +335,7 @@ TEST(MidiMessageQueueTest, OneByteMessage) { TEST(MidiMessageQueueTest, OneByteMessageInjectedInNonSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialNoteOn1st); queue.Get(&message); @@ -360,7 +359,7 @@ TEST(MidiMessageQueueTest, OneByteMessageInjectedInNonSysExMessage) { TEST(MidiMessageQueueTest, OneByteMessageInjectedInSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kPartialGMOn1st); queue.Get(&message); @@ -384,7 +383,7 @@ TEST(MidiMessageQueueTest, OneByteMessageInjectedInSysExMessage) { TEST(MidiMessageQueueTest, ReservedMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; Add(&queue, kReservedMessage1); Add(&queue, kNoteOn); @@ -475,7 +474,7 @@ TEST(MidiMessageQueueTest, ReservedMessage) { TEST(MidiMessageQueueTest, ReservedMessageInjectedInNonSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; // Inject |kReservedMessage1| Add(&queue, kPartialNoteOn1st); @@ -522,7 +521,7 @@ TEST(MidiMessageQueueTest, ReservedMessageInjectedInNonSysExMessage) { TEST(MidiMessageQueueTest, ReservedMessageInjectedInSysExMessage) { MidiMessageQueue queue(true); - std::vector<uint8> message; + std::vector<uint8_t> message; // Inject |kReservedMessage1| Add(&queue, kPartialGMOn1st); diff --git a/media/midi/midi_message_util.cc b/media/midi/midi_message_util.cc index e329ac3..82d16f7 100644 --- a/media/midi/midi_message_util.cc +++ b/media/midi/midi_message_util.cc @@ -8,7 +8,7 @@ namespace media { namespace midi { -size_t GetMidiMessageLength(uint8 status_byte) { +size_t GetMidiMessageLength(uint8_t status_byte) { if (status_byte < 0x80) return 0; if (0x80 <= status_byte && status_byte <= 0xbf) diff --git a/media/midi/midi_message_util.h b/media/midi/midi_message_util.h index 851b65c..a2fc317 100644 --- a/media/midi/midi_message_util.h +++ b/media/midi/midi_message_util.h @@ -5,10 +5,12 @@ #ifndef MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ #define MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ +#include <stddef.h> +#include <stdint.h> + #include <deque> #include <vector> -#include "base/basictypes.h" #include "media/midi/midi_export.h" namespace media { @@ -20,15 +22,15 @@ namespace midi { // - MIDI System Exclusive message. // - End of System Exclusive message. // - Reserved System Common Message (0xf4, 0xf5) -MIDI_EXPORT size_t GetMidiMessageLength(uint8 status_byte); +MIDI_EXPORT size_t GetMidiMessageLength(uint8_t status_byte); -const uint8 kSysExByte = 0xf0; -const uint8 kEndOfSysExByte = 0xf7; +const uint8_t kSysExByte = 0xf0; +const uint8_t kEndOfSysExByte = 0xf7; -const uint8 kSysMessageBitMask = 0xf0; -const uint8 kSysMessageBitPattern = 0xf0; -const uint8 kSysRTMessageBitMask = 0xf8; -const uint8 kSysRTMessageBitPattern = 0xf8; +const uint8_t kSysMessageBitMask = 0xf0; +const uint8_t kSysMessageBitPattern = 0xf0; +const uint8_t kSysRTMessageBitMask = 0xf8; +const uint8_t kSysRTMessageBitPattern = 0xf8; } // namespace midi } // namespace media diff --git a/media/midi/midi_message_util_unittest.cc b/media/midi/midi_message_util_unittest.cc index cb284af..666687f 100644 --- a/media/midi/midi_message_util_unittest.cc +++ b/media/midi/midi_message_util_unittest.cc @@ -4,19 +4,20 @@ #include "media/midi/midi_message_util.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace media { namespace midi { namespace { -const uint8 kGMOn[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7 }; -const uint8 kNoteOn[] = { 0x90, 0x3c, 0x7f }; -const uint8 kSystemCommonMessageReserved1[] = { 0xf4 }; -const uint8 kSystemCommonMessageReserved2[] = { 0xf5 }; -const uint8 kSystemCommonMessageTuneRequest[] = { 0xf6 }; -const uint8 kChannelPressure[] = { 0xd0, 0x01 }; -const uint8 kTimingClock[] = { 0xf8 }; +const uint8_t kGMOn[] = {0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7}; +const uint8_t kNoteOn[] = {0x90, 0x3c, 0x7f}; +const uint8_t kSystemCommonMessageReserved1[] = {0xf4}; +const uint8_t kSystemCommonMessageReserved2[] = {0xf5}; +const uint8_t kSystemCommonMessageTuneRequest[] = {0xf6}; +const uint8_t kChannelPressure[] = {0xd0, 0x01}; +const uint8_t kTimingClock[] = {0xf8}; TEST(MidiMessageUtilTest, GetMidiMessageLength) { // Check basic functionarity diff --git a/media/midi/midi_output_port_android.cc b/media/midi/midi_output_port_android.cc index f82ad51..a9c3e4b 100644 --- a/media/midi/midi_output_port_android.cc +++ b/media/midi/midi_output_port_android.cc @@ -26,7 +26,7 @@ void MidiOutputPortAndroid::Close() { Java_MidiOutputPortAndroid_close(env, raw_port_.obj()); } -void MidiOutputPortAndroid::Send(const std::vector<uint8>& data) { +void MidiOutputPortAndroid::Send(const std::vector<uint8_t>& data) { if (data.size() == 0) { return; } diff --git a/media/midi/midi_output_port_android.h b/media/midi/midi_output_port_android.h index 5fe4b9d..c5bba22 100644 --- a/media/midi/midi_output_port_android.h +++ b/media/midi/midi_output_port_android.h @@ -22,7 +22,7 @@ class MidiOutputPortAndroid final { // Returns the when the operation succeeds or the port is already open. bool Open(); void Close(); - void Send(const std::vector<uint8>& data); + void Send(const std::vector<uint8_t>& data); static bool Register(JNIEnv* env); diff --git a/media/midi/midi_port_info.h b/media/midi/midi_port_info.h index c53c906..99e1e67 100644 --- a/media/midi/midi_port_info.h +++ b/media/midi/midi_port_info.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "media/midi/midi_export.h" namespace media { diff --git a/media/midi/usb_midi_descriptor_parser.cc b/media/midi/usb_midi_descriptor_parser.cc index 9d0af75..a3bc128 100644 --- a/media/midi/usb_midi_descriptor_parser.cc +++ b/media/midi/usb_midi_descriptor_parser.cc @@ -45,22 +45,22 @@ enum JackType { JACK_TYPE_EXTERNAL = 2, }; -const uint8 kAudioInterfaceClass = 1; -const uint8 kAudioMidiInterfaceSubclass = 3; +const uint8_t kAudioInterfaceClass = 1; +const uint8_t kAudioMidiInterfaceSubclass = 3; class JackMatcher { public: - explicit JackMatcher(uint8 id) : id_(id) {} + explicit JackMatcher(uint8_t id) : id_(id) {} bool operator() (const UsbMidiJack& jack) const { return jack.jack_id == id_; } private: - uint8 id_; + uint8_t id_; }; -int DecodeBcd(uint8 byte) { +int DecodeBcd(uint8_t byte) { DCHECK_LT((byte & 0xf0) >> 4, 0xa); DCHECK_LT(byte & 0x0f, 0xa); return ((byte & 0xf0) >> 4) * 10 + (byte & 0x0f); @@ -69,7 +69,7 @@ int DecodeBcd(uint8 byte) { } // namespace std::string UsbMidiDescriptorParser::DeviceInfo::BcdVersionToString( - uint16 version) { + uint16_t version) { return base::StringPrintf("%d.%02d", DecodeBcd(version >> 8), DecodeBcd(version & 0xff)); } @@ -82,7 +82,7 @@ UsbMidiDescriptorParser::UsbMidiDescriptorParser() UsbMidiDescriptorParser::~UsbMidiDescriptorParser() {} bool UsbMidiDescriptorParser::Parse(UsbMidiDevice* device, - const uint8* data, + const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks) { jacks->clear(); @@ -93,13 +93,13 @@ bool UsbMidiDescriptorParser::Parse(UsbMidiDevice* device, return result; } -bool UsbMidiDescriptorParser::ParseDeviceInfo( - const uint8* data, size_t size, DeviceInfo* info) { +bool UsbMidiDescriptorParser::ParseDeviceInfo(const uint8_t* data, + size_t size, + DeviceInfo* info) { *info = DeviceInfo(); - for (const uint8* current = data; - current < data + size; + for (const uint8_t* current = data; current < data + size; current += current[0]) { - uint8 length = current[0]; + uint8_t length = current[0]; if (length < 2) { DVLOG(1) << "Descriptor Type is not accessible."; return false; @@ -119,13 +119,12 @@ bool UsbMidiDescriptorParser::ParseDeviceInfo( } bool UsbMidiDescriptorParser::ParseInternal(UsbMidiDevice* device, - const uint8* data, + const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks) { - for (const uint8* current = data; - current < data + size; + for (const uint8_t* current = data; current < data + size; current += current[0]) { - uint8 length = current[0]; + uint8_t length = current[0]; if (length < 2) { DVLOG(1) << "Descriptor Type is not accessible."; return false; @@ -168,8 +167,9 @@ bool UsbMidiDescriptorParser::ParseInternal(UsbMidiDevice* device, return true; } -bool UsbMidiDescriptorParser::ParseDevice( - const uint8* data, size_t size, DeviceInfo* info) { +bool UsbMidiDescriptorParser::ParseDevice(const uint8_t* data, + size_t size, + DeviceInfo* info) { if (size < 0x12) { DVLOG(1) << "DEVICE header size is incorrect."; return false; @@ -183,15 +183,15 @@ bool UsbMidiDescriptorParser::ParseDevice( return true; } -bool UsbMidiDescriptorParser::ParseInterface(const uint8* data, size_t size) { +bool UsbMidiDescriptorParser::ParseInterface(const uint8_t* data, size_t size) { if (size != 9) { DVLOG(1) << "INTERFACE header size is incorrect."; return false; } incomplete_jacks_.clear(); - uint8 interface_class = data[5]; - uint8 interface_subclass = data[6]; + uint8_t interface_class = data[5]; + uint8_t interface_subclass = data[6]; // All descriptors of endpoints contained in this interface // precede the next INTERFACE descriptor. @@ -202,7 +202,7 @@ bool UsbMidiDescriptorParser::ParseInterface(const uint8* data, size_t size) { } bool UsbMidiDescriptorParser::ParseCSInterface(UsbMidiDevice* device, - const uint8* data, + const uint8_t* data, size_t size) { // Descriptor Type and Descriptor Subtype should be accessible. if (size < 3) { @@ -220,8 +220,8 @@ bool UsbMidiDescriptorParser::ParseCSInterface(UsbMidiDevice* device, DVLOG(1) << "CS_INTERFACE (MIDI JACK) header size is incorrect."; return false; } - uint8 jack_type = data[3]; - uint8 id = data[4]; + uint8_t jack_type = data[3]; + uint8_t id = data[4]; if (jack_type == JACK_TYPE_EMBEDDED) { // We can't determine the associated endpoint now. incomplete_jacks_.push_back(UsbMidiJack(device, id, 0, 0)); @@ -229,7 +229,7 @@ bool UsbMidiDescriptorParser::ParseCSInterface(UsbMidiDevice* device, return true; } -bool UsbMidiDescriptorParser::ParseEndpoint(const uint8* data, size_t size) { +bool UsbMidiDescriptorParser::ParseEndpoint(const uint8_t* data, size_t size) { if (size < 4) { DVLOG(1) << "ENDPOINT header size is incorrect."; return false; @@ -239,7 +239,7 @@ bool UsbMidiDescriptorParser::ParseEndpoint(const uint8* data, size_t size) { return true; } -bool UsbMidiDescriptorParser::ParseCSEndpoint(const uint8* data, +bool UsbMidiDescriptorParser::ParseCSEndpoint(const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks) { const size_t kSizeForEmptyJacks = 4; @@ -249,14 +249,14 @@ bool UsbMidiDescriptorParser::ParseCSEndpoint(const uint8* data, DVLOG(1) << "CS_ENDPOINT header size is incorrect."; return false; } - uint8 num_jacks = data[3]; + uint8_t num_jacks = data[3]; if (size != kSizeForEmptyJacks + num_jacks) { DVLOG(1) << "CS_ENDPOINT header size is incorrect."; return false; } for (size_t i = 0; i < num_jacks; ++i) { - uint8 jack = data[kSizeForEmptyJacks + i]; + uint8_t jack = data[kSizeForEmptyJacks + i]; std::vector<UsbMidiJack>::iterator it = std::find_if(incomplete_jacks_.begin(), incomplete_jacks_.end(), diff --git a/media/midi/usb_midi_descriptor_parser.h b/media/midi/usb_midi_descriptor_parser.h index 8f741ca..bb6f791 100644 --- a/media/midi/usb_midi_descriptor_parser.h +++ b/media/midi/usb_midi_descriptor_parser.h @@ -1,3 +1,4 @@ + // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -5,10 +6,12 @@ #ifndef MEDIA_MIDI_USB_MIDI_DESCRIPTOR_PARSER_H_ #define MEDIA_MIDI_USB_MIDI_DESCRIPTOR_PARSER_H_ +#include <stdint.h> + #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_jack.h" @@ -30,15 +33,15 @@ class USB_MIDI_EXPORT UsbMidiDescriptorParser { bcd_device_version(0), manufacturer_index(0), product_index(0) {} - uint16 vendor_id; - uint16 product_id; + uint16_t vendor_id; + uint16_t product_id; // The higher one byte represents the "major" number and the lower one byte // represents the "minor" number. - uint16 bcd_device_version; - uint8 manufacturer_index; - uint8 product_index; + uint16_t bcd_device_version; + uint8_t manufacturer_index; + uint8_t product_index; - static std::string BcdVersionToString(uint16); + static std::string BcdVersionToString(uint16_t); }; UsbMidiDescriptorParser(); @@ -48,29 +51,31 @@ class USB_MIDI_EXPORT UsbMidiDescriptorParser { // When an incorrect input is given, this method may return true but // never crashes. bool Parse(UsbMidiDevice* device, - const uint8* data, + const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks); - bool ParseDeviceInfo(const uint8* data, size_t size, DeviceInfo* info); + bool ParseDeviceInfo(const uint8_t* data, size_t size, DeviceInfo* info); private: bool ParseInternal(UsbMidiDevice* device, - const uint8* data, + const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks); - bool ParseDevice(const uint8* data, size_t size, DeviceInfo* info); - bool ParseInterface(const uint8* data, size_t size); - bool ParseCSInterface(UsbMidiDevice* device, const uint8* data, size_t size); - bool ParseEndpoint(const uint8* data, size_t size); - bool ParseCSEndpoint(const uint8* data, + bool ParseDevice(const uint8_t* data, size_t size, DeviceInfo* info); + bool ParseInterface(const uint8_t* data, size_t size); + bool ParseCSInterface(UsbMidiDevice* device, + const uint8_t* data, + size_t size); + bool ParseEndpoint(const uint8_t* data, size_t size); + bool ParseCSEndpoint(const uint8_t* data, size_t size, std::vector<UsbMidiJack>* jacks); void Clear(); bool is_parsing_usb_midi_interface_; - uint8 current_endpoint_address_; - uint8 current_cable_number_; + uint8_t current_endpoint_address_; + uint8_t current_cable_number_; std::vector<UsbMidiJack> incomplete_jacks_; diff --git a/media/midi/usb_midi_descriptor_parser_unittest.cc b/media/midi/usb_midi_descriptor_parser_unittest.cc index c0e569d..e0a68cc 100644 --- a/media/midi/usb_midi_descriptor_parser_unittest.cc +++ b/media/midi/usb_midi_descriptor_parser_unittest.cc @@ -21,7 +21,7 @@ TEST(UsbMidiDescriptorParserTest, ParseEmpty) { TEST(UsbMidiDescriptorParserTest, InvalidSize) { UsbMidiDescriptorParser parser; std::vector<UsbMidiJack> jacks; - uint8 data[] = {0x04}; + uint8_t data[] = {0x04}; EXPECT_FALSE(parser.Parse(nullptr, data, arraysize(data), &jacks)); EXPECT_TRUE(jacks.empty()); } @@ -31,10 +31,9 @@ TEST(UsbMidiDescriptorParserTest, NonExistingJackIsAssociated) { std::vector<UsbMidiJack> jacks; // Jack id=1 is found in a CS_ENDPOINT descriptor, but there is no definition // for the jack. - uint8 data[] = { - 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, - 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, - 0x01, + uint8_t data[] = { + 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, + 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, 0x01, }; EXPECT_FALSE(parser.Parse(nullptr, data, arraysize(data), &jacks)); EXPECT_TRUE(jacks.empty()); @@ -46,10 +45,9 @@ TEST(UsbMidiDescriptorParserTest, std::vector<UsbMidiJack> jacks; // a NON-MIDI INTERFACE descriptor followed by ENDPOINT and CS_ENDPOINT // descriptors (Compare with the previous test case). - uint8 data[] = { - 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x00, 0x07, - 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, - 0x01, + uint8_t data[] = { + 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x00, 0x07, 0x24, + 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, 0x01, }; EXPECT_TRUE(parser.Parse(nullptr, data, arraysize(data), &jacks)); EXPECT_TRUE(jacks.empty()); @@ -59,21 +57,19 @@ TEST(UsbMidiDescriptorParserTest, Parse) { UsbMidiDescriptorParser parser; std::vector<UsbMidiJack> jacks; // A complete device descriptor. - uint8 data[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, - 0x2d, 0x75, 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, - 0x75, 0x00, 0x02, 0x01, 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, - 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x09, 0x24, 0x01, 0x00, - 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, 0x00, 0x02, - 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, - 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, - 0x01, 0x03, 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, - 0x24, 0x03, 0x01, 0x07, 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, - 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, 0x00, 0x09, 0x24, 0x03, - 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, 0x02, 0x02, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, - 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x25, 0x01, 0x01, 0x07, + uint8_t data[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x86, 0x1a, 0x2d, 0x75, + 0x54, 0x02, 0x00, 0x02, 0x00, 0x01, 0x09, 0x02, 0x75, 0x00, 0x02, 0x01, + 0x00, 0x80, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x09, 0x24, 0x01, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01, 0x09, 0x04, 0x01, + 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, 0x24, 0x01, 0x00, 0x01, 0x51, + 0x00, 0x06, 0x24, 0x02, 0x01, 0x02, 0x00, 0x06, 0x24, 0x02, 0x01, 0x03, + 0x00, 0x06, 0x24, 0x02, 0x02, 0x06, 0x00, 0x09, 0x24, 0x03, 0x01, 0x07, + 0x01, 0x06, 0x01, 0x00, 0x09, 0x24, 0x03, 0x02, 0x04, 0x01, 0x02, 0x01, + 0x00, 0x09, 0x24, 0x03, 0x02, 0x05, 0x01, 0x03, 0x01, 0x00, 0x09, 0x05, + 0x02, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0x25, 0x01, 0x02, 0x02, + 0x03, 0x09, 0x05, 0x82, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x25, + 0x01, 0x01, 0x07, }; EXPECT_TRUE(parser.Parse(nullptr, data, arraysize(data), &jacks)); ASSERT_EQ(3u, jacks.size()); @@ -106,9 +102,9 @@ TEST(UsbMidiDescriptorParserTest, ParseDeviceInfoEmpty) { TEST(UsbMidiDescriptorParserTest, ParseDeviceInfo) { UsbMidiDescriptorParser parser; UsbMidiDescriptorParser::DeviceInfo info; - uint8 data[] = { - 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01, 0x23, - 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x0a, + uint8_t data[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01, + 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x0a, }; EXPECT_TRUE(parser.ParseDeviceInfo(data, arraysize(data), &info)); diff --git a/media/midi/usb_midi_device.h b/media/midi/usb_midi_device.h index c1dc8cd7..9f1ffbd 100644 --- a/media/midi/usb_midi_device.h +++ b/media/midi/usb_midi_device.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/scoped_vector.h" #include "base/time/time.h" @@ -28,7 +27,7 @@ class USB_MIDI_EXPORT UsbMidiDeviceDelegate { // Called when USB-MIDI data arrives at |device|. virtual void ReceiveUsbMidiData(UsbMidiDevice* device, int endpoint_number, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) = 0; @@ -68,7 +67,7 @@ class USB_MIDI_EXPORT UsbMidiDevice { virtual ~UsbMidiDevice() {} // Returns the descriptors of this device. - virtual std::vector<uint8> GetDescriptors() = 0; + virtual std::vector<uint8_t> GetDescriptors() = 0; // Return the name of the manufacturer. virtual std::string GetManufacturer() = 0; @@ -80,7 +79,7 @@ class USB_MIDI_EXPORT UsbMidiDevice { virtual std::string GetDeviceVersion() = 0; // Sends |data| to the given USB endpoint of this device. - virtual void Send(int endpoint_number, const std::vector<uint8>& data) = 0; + virtual void Send(int endpoint_number, const std::vector<uint8_t>& data) = 0; }; } // namespace midi diff --git a/media/midi/usb_midi_device_android.cc b/media/midi/usb_midi_device_android.cc index fe59e2f..464615e 100644 --- a/media/midi/usb_midi_device_android.cc +++ b/media/midi/usb_midi_device_android.cc @@ -4,7 +4,6 @@ #include "media/midi/usb_midi_device_android.h" - #include "base/android/jni_array.h" #include "base/i18n/icu_string_conversions.h" #include "base/strings/stringprintf.h" @@ -32,7 +31,7 @@ UsbMidiDeviceAndroid::~UsbMidiDeviceAndroid() { Java_UsbMidiDeviceAndroid_close(env, raw_device_.obj()); } -std::vector<uint8> UsbMidiDeviceAndroid::GetDescriptors() { +std::vector<uint8_t> UsbMidiDeviceAndroid::GetDescriptors() { return descriptors_; } @@ -49,9 +48,9 @@ std::string UsbMidiDeviceAndroid::GetDeviceVersion() { } void UsbMidiDeviceAndroid::Send(int endpoint_number, - const std::vector<uint8>& data) { + const std::vector<uint8_t>& data) { JNIEnv* env = base::android::AttachCurrentThread(); - const uint8* head = data.size() ? &data[0] : NULL; + const uint8_t* head = data.size() ? &data[0] : NULL; ScopedJavaLocalRef<jbyteArray> data_to_pass = base::android::ToJavaByteArray(env, head, data.size()); @@ -63,10 +62,10 @@ void UsbMidiDeviceAndroid::OnData(JNIEnv* env, const JavaParamRef<jobject>& caller, jint endpoint_number, const JavaParamRef<jbyteArray>& data) { - std::vector<uint8> bytes; + std::vector<uint8_t> bytes; base::android::JavaByteArrayToByteVector(env, data, &bytes); - const uint8* head = bytes.size() ? &bytes[0] : NULL; + const uint8_t* head = bytes.size() ? &bytes[0] : NULL; delegate_->ReceiveUsbMidiData(this, endpoint_number, head, bytes.size(), base::TimeTicks::Now()); } @@ -88,7 +87,7 @@ void UsbMidiDeviceAndroid::InitDeviceInfo() { UsbMidiDescriptorParser parser; UsbMidiDescriptorParser::DeviceInfo info; - const uint8* data = descriptors_.size() > 0 ? &descriptors_[0] : nullptr; + const uint8_t* data = descriptors_.size() > 0 ? &descriptors_[0] : nullptr; if (!parser.ParseDeviceInfo(data, descriptors_.size(), &info)) { // We don't report the error here. If it is critical, we will realize it @@ -108,26 +107,26 @@ void UsbMidiDeviceAndroid::InitDeviceInfo() { device_version_ = info.BcdVersionToString(info.bcd_device_version); } -std::vector<uint8> UsbMidiDeviceAndroid::GetStringDescriptor(int index) { +std::vector<uint8_t> UsbMidiDeviceAndroid::GetStringDescriptor(int index) { JNIEnv* env = base::android::AttachCurrentThread(); base::android::ScopedJavaLocalRef<jbyteArray> descriptors = Java_UsbMidiDeviceAndroid_getStringDescriptor(env, raw_device_.obj(), index); - std::vector<uint8> ret; + std::vector<uint8_t> ret; base::android::JavaByteArrayToByteVector(env, descriptors.obj(), &ret); return ret; } std::string UsbMidiDeviceAndroid::GetString(int index, const std::string& backup) { - const uint8 DESCRIPTOR_TYPE_STRING = 3; + const uint8_t DESCRIPTOR_TYPE_STRING = 3; if (!index) { // index 0 means there is no such descriptor. return backup; } - std::vector<uint8> descriptor = GetStringDescriptor(index); + std::vector<uint8_t> descriptor = GetStringDescriptor(index); if (descriptor.size() < 2 || descriptor.size() < descriptor[0] || descriptor[1] != DESCRIPTOR_TYPE_STRING) { // |descriptor| is not a valid string descriptor. diff --git a/media/midi/usb_midi_device_android.h b/media/midi/usb_midi_device_android.h index 0583608..27d2389 100644 --- a/media/midi/usb_midi_device_android.h +++ b/media/midi/usb_midi_device_android.h @@ -10,7 +10,6 @@ #include <vector> #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/callback.h" #include "media/midi/usb_midi_device.h" #include "media/midi/usb_midi_export.h" @@ -27,11 +26,11 @@ class USB_MIDI_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice { ~UsbMidiDeviceAndroid() override; // UsbMidiDevice implementation. - std::vector<uint8> GetDescriptors() override; + std::vector<uint8_t> GetDescriptors() override; std::string GetManufacturer() override; std::string GetProductName() override; std::string GetDeviceVersion() override; - void Send(int endpoint_number, const std::vector<uint8>& data) override; + void Send(int endpoint_number, const std::vector<uint8_t>& data) override; // Called by the Java world. void OnData(JNIEnv* env, @@ -44,14 +43,14 @@ class USB_MIDI_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice { private: void GetDescriptorsInternal(); void InitDeviceInfo(); - std::vector<uint8> GetStringDescriptor(int index); + std::vector<uint8_t> GetStringDescriptor(int index); std::string GetString(int index, const std::string& backup); // The actual device object. base::android::ScopedJavaGlobalRef<jobject> raw_device_; UsbMidiDeviceDelegate* delegate_; - std::vector<uint8> descriptors_; + std::vector<uint8_t> descriptors_; std::string manufacturer_; std::string product_; std::string device_version_; diff --git a/media/midi/usb_midi_device_factory_android.h b/media/midi/usb_midi_device_factory_android.h index 70913cc..e4f7d45 100644 --- a/media/midi/usb_midi_device_factory_android.h +++ b/media/midi/usb_midi_device_factory_android.h @@ -9,7 +9,6 @@ #include <vector> #include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "media/midi/usb_midi_device.h" diff --git a/media/midi/usb_midi_input_stream.cc b/media/midi/usb_midi_input_stream.cc index 10f7146..2eaa6e3 100644 --- a/media/midi/usb_midi_input_stream.cc +++ b/media/midi/usb_midi_input_stream.cc @@ -52,7 +52,7 @@ void UsbMidiInputStream::Add(const UsbMidiJack& jack) { void UsbMidiInputStream::OnReceivedData(UsbMidiDevice* device, int endpoint_number, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) { DCHECK_EQ(0u, size % kPacketSize); @@ -65,11 +65,11 @@ void UsbMidiInputStream::OnReceivedData(UsbMidiDevice* device, void UsbMidiInputStream::ProcessOnePacket(UsbMidiDevice* device, int endpoint_number, - const uint8* packet, + const uint8_t* packet, base::TimeTicks time) { // The first 4 bytes of the packet is accessible here. - uint8 code_index = packet[0] & 0x0f; - uint8 cable_number = packet[0] >> 4; + uint8_t code_index = packet[0] & 0x0f; + uint8_t cable_number = packet[0] >> 4; const size_t packet_size_table[16] = { 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1, }; diff --git a/media/midi/usb_midi_input_stream.h b/media/midi/usb_midi_input_stream.h index 8fb732e8..201ee17 100644 --- a/media/midi/usb_midi_input_stream.h +++ b/media/midi/usb_midi_input_stream.h @@ -8,7 +8,6 @@ #include <map> #include <vector> -#include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/time/time.h" #include "media/midi/usb_midi_export.h" @@ -30,7 +29,7 @@ class USB_MIDI_EXPORT UsbMidiInputStream { // This function is called when some data arrives to a USB-MIDI jack. // An input USB-MIDI jack corresponds to an input MIDIPortInfo. virtual void OnReceivedData(size_t jack_index, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) = 0; }; @@ -57,7 +56,7 @@ class USB_MIDI_EXPORT UsbMidiInputStream { // |size| must be a multiple of |kPacketSize|. void OnReceivedData(UsbMidiDevice* device, int endpoint_number, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time); @@ -69,7 +68,7 @@ class USB_MIDI_EXPORT UsbMidiInputStream { // The first |kPacketSize| bytes of |packet| must be accessible. void ProcessOnePacket(UsbMidiDevice* device, int endpoint_number, - const uint8* packet, + const uint8_t* packet, base::TimeTicks time); std::vector<UsbMidiJack> jacks_; diff --git a/media/midi/usb_midi_input_stream_unittest.cc b/media/midi/usb_midi_input_stream_unittest.cc index 99a9690..b38a477 100644 --- a/media/midi/usb_midi_input_stream_unittest.cc +++ b/media/midi/usb_midi_input_stream_unittest.cc @@ -24,11 +24,13 @@ class TestUsbMidiDevice : public UsbMidiDevice { public: TestUsbMidiDevice() {} ~TestUsbMidiDevice() override {} - std::vector<uint8> GetDescriptors() override { return std::vector<uint8>(); } + std::vector<uint8_t> GetDescriptors() override { + return std::vector<uint8_t>(); + } std::string GetManufacturer() override { return std::string(); } std::string GetProductName() override { return std::string(); } std::string GetDeviceVersion() override { return std::string(); } - void Send(int endpoint_number, const std::vector<uint8>& data) override {} + void Send(int endpoint_number, const std::vector<uint8_t>& data) override {} private: DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDevice); @@ -39,7 +41,7 @@ class MockDelegate : public UsbMidiInputStream::Delegate { MockDelegate() {} ~MockDelegate() override {} void OnReceivedData(size_t jack_index, - const uint8* data, + const uint8_t* data, size_t size, base::TimeTicks time) override { for (size_t i = 0; i < size; ++i) @@ -87,9 +89,8 @@ class UsbMidiInputStreamTest : public ::testing::Test { }; TEST_F(UsbMidiInputStreamTest, UnknownMessage) { - uint8 data[] = { - 0x40, 0xff, 0xff, 0xff, - 0x41, 0xff, 0xff, 0xff, + uint8_t data[] = { + 0x40, 0xff, 0xff, 0xff, 0x41, 0xff, 0xff, 0xff, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -97,10 +98,8 @@ TEST_F(UsbMidiInputStreamTest, UnknownMessage) { } TEST_F(UsbMidiInputStreamTest, SystemCommonMessage) { - uint8 data[] = { - 0x45, 0xf8, 0x00, 0x00, - 0x42, 0xf3, 0x22, 0x00, - 0x43, 0xf2, 0x33, 0x44, + uint8_t data[] = { + 0x45, 0xf8, 0x00, 0x00, 0x42, 0xf3, 0x22, 0x00, 0x43, 0xf2, 0x33, 0x44, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -110,11 +109,9 @@ TEST_F(UsbMidiInputStreamTest, SystemCommonMessage) { } TEST_F(UsbMidiInputStreamTest, SystemExclusiveMessage) { - uint8 data[] = { - 0x44, 0xf0, 0x11, 0x22, - 0x45, 0xf7, 0x00, 0x00, - 0x46, 0xf0, 0xf7, 0x00, - 0x47, 0xf0, 0x33, 0xf7, + uint8_t data[] = { + 0x44, 0xf0, 0x11, 0x22, 0x45, 0xf7, 0x00, 0x00, + 0x46, 0xf0, 0xf7, 0x00, 0x47, 0xf0, 0x33, 0xf7, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -125,14 +122,10 @@ TEST_F(UsbMidiInputStreamTest, SystemExclusiveMessage) { } TEST_F(UsbMidiInputStreamTest, ChannelMessage) { - uint8 data[] = { - 0x48, 0x80, 0x11, 0x22, - 0x49, 0x90, 0x33, 0x44, - 0x4a, 0xa0, 0x55, 0x66, - 0x4b, 0xb0, 0x77, 0x88, - 0x4c, 0xc0, 0x99, 0x00, - 0x4d, 0xd0, 0xaa, 0x00, - 0x4e, 0xe0, 0xbb, 0xcc, + uint8_t data[] = { + 0x48, 0x80, 0x11, 0x22, 0x49, 0x90, 0x33, 0x44, 0x4a, 0xa0, + 0x55, 0x66, 0x4b, 0xb0, 0x77, 0x88, 0x4c, 0xc0, 0x99, 0x00, + 0x4d, 0xd0, 0xaa, 0x00, 0x4e, 0xe0, 0xbb, 0xcc, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -146,8 +139,8 @@ TEST_F(UsbMidiInputStreamTest, ChannelMessage) { } TEST_F(UsbMidiInputStreamTest, SingleByteMessage) { - uint8 data[] = { - 0x4f, 0xf8, 0x00, 0x00, + uint8_t data[] = { + 0x4f, 0xf8, 0x00, 0x00, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -155,10 +148,8 @@ TEST_F(UsbMidiInputStreamTest, SingleByteMessage) { } TEST_F(UsbMidiInputStreamTest, DispatchForMultipleCables) { - uint8 data[] = { - 0x4f, 0xf8, 0x00, 0x00, - 0x5f, 0xfa, 0x00, 0x00, - 0x6f, 0xfb, 0x00, 0x00, + uint8_t data[] = { + 0x4f, 0xf8, 0x00, 0x00, 0x5f, 0xfa, 0x00, 0x00, 0x6f, 0xfb, 0x00, 0x00, }; stream_->OnReceivedData(&device1_, 7, data, arraysize(data), TimeTicks()); @@ -166,7 +157,7 @@ TEST_F(UsbMidiInputStreamTest, DispatchForMultipleCables) { } TEST_F(UsbMidiInputStreamTest, DispatchForDevice2) { - uint8 data[] = { 0x4f, 0xf8, 0x00, 0x00 }; + uint8_t data[] = {0x4f, 0xf8, 0x00, 0x00}; stream_->OnReceivedData(&device2_, 7, data, arraysize(data), TimeTicks()); EXPECT_EQ("0xf8 \n", delegate_.received_data()); diff --git a/media/midi/usb_midi_jack.h b/media/midi/usb_midi_jack.h index 8315564..65cb189 100644 --- a/media/midi/usb_midi_jack.h +++ b/media/midi/usb_midi_jack.h @@ -5,7 +5,8 @@ #ifndef MEDIA_MIDI_USB_MIDI_JACK_H_ #define MEDIA_MIDI_USB_MIDI_JACK_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "media/midi/usb_midi_export.h" namespace media { @@ -23,9 +24,9 @@ struct USB_MIDI_EXPORT UsbMidiJack { DIRECTION_OUT, }; UsbMidiJack(UsbMidiDevice* device, - uint8 jack_id, - uint8 cable_number, - uint8 endpoint_address) + uint8_t jack_id, + uint8_t cable_number, + uint8_t endpoint_address) : device(device), jack_id(jack_id), cable_number(cable_number), @@ -33,18 +34,16 @@ struct USB_MIDI_EXPORT UsbMidiJack { // Not owned UsbMidiDevice* device; // The id of this jack unique in the interface. - uint8 jack_id; + uint8_t jack_id; // The cable number of this jack in the associated endpoint. - uint8 cable_number; + uint8_t cable_number; // The address of the endpoint that this jack is associated with. - uint8 endpoint_address; + uint8_t endpoint_address; Direction direction() const { return (endpoint_address & 0x80) ? DIRECTION_IN : DIRECTION_OUT; } - uint8 endpoint_number() const { - return (endpoint_address & 0xf); - } + uint8_t endpoint_number() const { return (endpoint_address & 0xf); } }; } // namespace midi diff --git a/media/midi/usb_midi_output_stream.cc b/media/midi/usb_midi_output_stream.cc index ded37e4..11cce3c 100644 --- a/media/midi/usb_midi_output_stream.cc +++ b/media/midi/usb_midi_output_stream.cc @@ -14,16 +14,16 @@ namespace midi { UsbMidiOutputStream::UsbMidiOutputStream(const UsbMidiJack& jack) : jack_(jack), pending_size_(0), is_sending_sysex_(false) {} -void UsbMidiOutputStream::Send(const std::vector<uint8>& data) { +void UsbMidiOutputStream::Send(const std::vector<uint8_t>& data) { // To prevent link errors caused by DCHECK_*. const size_t kPacketContentSize = UsbMidiOutputStream::kPacketContentSize; DCHECK_LT(jack_.cable_number, 16u); - std::vector<uint8> data_to_send; + std::vector<uint8_t> data_to_send; size_t current = 0; size_t size = GetSize(data); while (current < size) { - uint8 first_byte = Get(data, current); + uint8_t first_byte = Get(data, current); if (first_byte == kSysExByte || is_sending_sysex_) { // System Exclusive messages if (!PushSysExMessage(data, ¤t, &data_to_send)) @@ -58,25 +58,25 @@ void UsbMidiOutputStream::Send(const std::vector<uint8>& data) { pending_size_ = size - current; } -size_t UsbMidiOutputStream::GetSize(const std::vector<uint8>& data) const { +size_t UsbMidiOutputStream::GetSize(const std::vector<uint8_t>& data) const { return data.size() + pending_size_; } -uint8_t UsbMidiOutputStream::Get(const std::vector<uint8>& data, - size_t index) const { +uint8_t UsbMidiOutputStream::Get(const std::vector<uint8_t>& data, + size_t index) const { DCHECK_LT(index, GetSize(data)); if (index < pending_size_) return pending_data_[index]; return data[index - pending_size_]; } -bool UsbMidiOutputStream::PushSysExMessage(const std::vector<uint8>& data, +bool UsbMidiOutputStream::PushSysExMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send) { + std::vector<uint8_t>* data_to_send) { size_t index = *current; size_t message_size = 0; const size_t kMessageSizeMax = 3; - uint8 message[kMessageSizeMax] = {}; + uint8_t message[kMessageSizeMax] = {}; while (index < GetSize(data)) { if (message_size == kMessageSizeMax) { @@ -89,7 +89,7 @@ bool UsbMidiOutputStream::PushSysExMessage(const std::vector<uint8>& data, is_sending_sysex_ = true; return true; } - uint8 byte = Get(data, index); + uint8_t byte = Get(data, index); if ((byte & kSysRTMessageBitMask) == kSysRTMessageBitPattern) { // System Real-Time messages interleaved in a SysEx message PushSysRTMessage(data, &index, data_to_send); @@ -99,7 +99,7 @@ bool UsbMidiOutputStream::PushSysExMessage(const std::vector<uint8>& data, message[message_size] = byte; ++message_size; if (byte == kEndOfSysExByte) { - uint8 code_index = static_cast<uint8>(message_size) + 0x4; + uint8_t code_index = static_cast<uint8_t>(message_size) + 0x4; DCHECK(code_index == 0x5 || code_index == 0x6 || code_index == 0x7); data_to_send->push_back((jack_.cable_number << 4) | code_index); data_to_send->insert(data_to_send->end(), @@ -115,11 +115,11 @@ bool UsbMidiOutputStream::PushSysExMessage(const std::vector<uint8>& data, } bool UsbMidiOutputStream::PushSysCommonMessage( - const std::vector<uint8>& data, + const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send) { + std::vector<uint8_t>* data_to_send) { size_t index = *current; - uint8 first_byte = Get(data, index); + uint8_t first_byte = Get(data, index); DCHECK_LE(0xf1, first_byte); DCHECK_LE(first_byte, 0xf7); DCHECK_EQ(0xf0, first_byte & 0xf8); @@ -136,7 +136,8 @@ bool UsbMidiOutputStream::PushSysCommonMessage( return false; } - uint8 code_index = message_size == 1 ? 0x5 : static_cast<uint8>(message_size); + uint8_t code_index = + message_size == 1 ? 0x5 : static_cast<uint8_t>(message_size); data_to_send->push_back((jack_.cable_number << 4) | code_index); for (size_t i = index; i < index + 3; ++i) data_to_send->push_back(i < index + message_size ? Get(data, i) : 0); @@ -144,11 +145,11 @@ bool UsbMidiOutputStream::PushSysCommonMessage( return true; } -void UsbMidiOutputStream::PushSysRTMessage(const std::vector<uint8>& data, +void UsbMidiOutputStream::PushSysRTMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send) { + std::vector<uint8_t>* data_to_send) { size_t index = *current; - uint8 first_byte = Get(data, index); + uint8_t first_byte = Get(data, index); DCHECK_LE(0xf8, first_byte); DCHECK_LE(first_byte, 0xff); @@ -159,11 +160,12 @@ void UsbMidiOutputStream::PushSysRTMessage(const std::vector<uint8>& data, *current += 1; } -bool UsbMidiOutputStream::PushChannelMessage(const std::vector<uint8>& data, - size_t* current, - std::vector<uint8>* data_to_send) { +bool UsbMidiOutputStream::PushChannelMessage( + const std::vector<uint8_t>& data, + size_t* current, + std::vector<uint8_t>* data_to_send) { size_t index = *current; - uint8 first_byte = Get(data, index); + uint8_t first_byte = Get(data, index); DCHECK_LE(0x80, (first_byte & 0xf0)); DCHECK_LE((first_byte & 0xf0), 0xe0); @@ -172,7 +174,7 @@ bool UsbMidiOutputStream::PushChannelMessage(const std::vector<uint8>& data, const size_t message_size_table[8] = { 3, 3, 3, 3, 2, 3, 3, 0, }; - uint8 code_index = first_byte >> 4; + uint8_t code_index = first_byte >> 4; DCHECK_LE(0x08, code_index); DCHECK_LE(code_index, 0x0e); size_t message_size = message_size_table[code_index & 0x7]; diff --git a/media/midi/usb_midi_output_stream.h b/media/midi/usb_midi_output_stream.h index 6fc7171..c176e46 100644 --- a/media/midi/usb_midi_output_stream.h +++ b/media/midi/usb_midi_output_stream.h @@ -5,9 +5,11 @@ #ifndef MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ #define MEDIA_MIDI_USB_MIDI_OUTPUT_STREAM_H_ +#include <stdint.h> + #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_jack.h" @@ -22,32 +24,32 @@ class USB_MIDI_EXPORT UsbMidiOutputStream { explicit UsbMidiOutputStream(const UsbMidiJack& jack); // Converts |data| to USB-MIDI data and send it to the jack. - void Send(const std::vector<uint8>& data); + void Send(const std::vector<uint8_t>& data); const UsbMidiJack& jack() const { return jack_; } private: - size_t GetSize(const std::vector<uint8>& data) const; - uint8_t Get(const std::vector<uint8>& data, size_t index) const; + size_t GetSize(const std::vector<uint8_t>& data) const; + uint8_t Get(const std::vector<uint8_t>& data, size_t index) const; - bool PushSysExMessage(const std::vector<uint8>& data, + bool PushSysExMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send); - bool PushSysCommonMessage(const std::vector<uint8>& data, + std::vector<uint8_t>* data_to_send); + bool PushSysCommonMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send); - void PushSysRTMessage(const std::vector<uint8>& data, + std::vector<uint8_t>* data_to_send); + void PushSysRTMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send); - bool PushChannelMessage(const std::vector<uint8>& data, + std::vector<uint8_t>* data_to_send); + bool PushChannelMessage(const std::vector<uint8_t>& data, size_t* current, - std::vector<uint8>* data_to_send); + std::vector<uint8_t>* data_to_send); static const size_t kPacketContentSize = 3; UsbMidiJack jack_; size_t pending_size_; - uint8 pending_data_[kPacketContentSize]; + uint8_t pending_data_[kPacketContentSize]; bool is_sending_sysex_; DISALLOW_COPY_AND_ASSIGN(UsbMidiOutputStream); diff --git a/media/midi/usb_midi_output_stream_unittest.cc b/media/midi/usb_midi_output_stream_unittest.cc index b0e2d5b..19c8d94 100644 --- a/media/midi/usb_midi_output_stream_unittest.cc +++ b/media/midi/usb_midi_output_stream_unittest.cc @@ -27,12 +27,14 @@ class MockUsbMidiDevice : public UsbMidiDevice { MockUsbMidiDevice() {} ~MockUsbMidiDevice() override {} - std::vector<uint8> GetDescriptors() override { return std::vector<uint8>(); } + std::vector<uint8_t> GetDescriptors() override { + return std::vector<uint8_t>(); + } std::string GetManufacturer() override { return std::string(); } std::string GetProductName() override { return std::string(); } std::string GetDeviceVersion() override { return std::string(); } - void Send(int endpoint_number, const std::vector<uint8>& data) override { + void Send(int endpoint_number, const std::vector<uint8_t>& data) override { for (size_t i = 0; i < data.size(); ++i) { log_ += base::StringPrintf("0x%02x ", data[i]); } @@ -64,35 +66,39 @@ class UsbMidiOutputStreamTest : public ::testing::Test { }; TEST_F(UsbMidiOutputStreamTest, SendEmpty) { - stream_->Send(std::vector<uint8>()); + stream_->Send(std::vector<uint8_t>()); EXPECT_EQ("", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendNoteOn) { - uint8 data[] = { 0x90, 0x45, 0x7f}; + uint8_t data[] = {0x90, 0x45, 0x7f}; stream_->Send(ToVector(data)); EXPECT_EQ("0x29 0x90 0x45 0x7f (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendNoteOnPending) { - stream_->Send(std::vector<uint8>(1, 0x90)); - stream_->Send(std::vector<uint8>(1, 0x45)); + stream_->Send(std::vector<uint8_t>(1, 0x90)); + stream_->Send(std::vector<uint8_t>(1, 0x45)); EXPECT_EQ("", device_.log()); - stream_->Send(std::vector<uint8>(1, 0x7f)); + stream_->Send(std::vector<uint8_t>(1, 0x7f)); EXPECT_EQ("0x29 0x90 0x45 0x7f (endpoint = 4)\n", device_.log()); device_.ClearLog(); - stream_->Send(std::vector<uint8>(1, 0x90)); - stream_->Send(std::vector<uint8>(1, 0x45)); + stream_->Send(std::vector<uint8_t>(1, 0x90)); + stream_->Send(std::vector<uint8_t>(1, 0x45)); EXPECT_EQ("", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendNoteOnBurst) { - uint8 data1[] = { 0x90, }; - uint8 data2[] = { 0x45, 0x7f, 0x90, 0x45, 0x71, 0x90, 0x45, 0x72, 0x90, }; + uint8_t data1[] = { + 0x90, + }; + uint8_t data2[] = { + 0x45, 0x7f, 0x90, 0x45, 0x71, 0x90, 0x45, 0x72, 0x90, + }; stream_->Send(ToVector(data1)); stream_->Send(ToVector(data2)); @@ -102,63 +108,81 @@ TEST_F(UsbMidiOutputStreamTest, SendNoteOnBurst) { } TEST_F(UsbMidiOutputStreamTest, SendNoteOff) { - uint8 data[] = { 0x80, 0x33, 0x44, }; + uint8_t data[] = { + 0x80, 0x33, 0x44, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x28 0x80 0x33 0x44 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendPolyphonicKeyPress) { - uint8 data[] = { 0xa0, 0x33, 0x44, }; + uint8_t data[] = { + 0xa0, 0x33, 0x44, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x2a 0xa0 0x33 0x44 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendControlChange) { - uint8 data[] = { 0xb7, 0x33, 0x44, }; + uint8_t data[] = { + 0xb7, 0x33, 0x44, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x2b 0xb7 0x33 0x44 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendProgramChange) { - uint8 data[] = { 0xc2, 0x33, }; + uint8_t data[] = { + 0xc2, 0x33, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x2c 0xc2 0x33 0x00 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendChannelPressure) { - uint8 data[] = { 0xd1, 0x33, 0x44, }; + uint8_t data[] = { + 0xd1, 0x33, 0x44, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x2d 0xd1 0x33 0x44 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendPitchWheelChange) { - uint8 data[] = { 0xe4, 0x33, 0x44, }; + uint8_t data[] = { + 0xe4, 0x33, 0x44, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x2e 0xe4 0x33 0x44 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendTwoByteSysEx) { - uint8 data[] = { 0xf0, 0xf7, }; + uint8_t data[] = { + 0xf0, 0xf7, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x26 0xf0 0xf7 0x00 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendThreeByteSysEx) { - uint8 data[] = { 0xf0, 0x4f, 0xf7, }; + uint8_t data[] = { + 0xf0, 0x4f, 0xf7, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x27 0xf0 0x4f 0xf7 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendFourByteSysEx) { - uint8 data[] = { 0xf0, 0x00, 0x01, 0xf7, }; + uint8_t data[] = { + 0xf0, 0x00, 0x01, 0xf7, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x24 0xf0 0x00 0x01 " @@ -166,7 +190,9 @@ TEST_F(UsbMidiOutputStreamTest, SendFourByteSysEx) { } TEST_F(UsbMidiOutputStreamTest, SendFiveByteSysEx) { - uint8 data[] = { 0xf0, 0x00, 0x01, 0x02, 0xf7, }; + uint8_t data[] = { + 0xf0, 0x00, 0x01, 0x02, 0xf7, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x24 0xf0 0x00 0x01 " @@ -174,7 +200,9 @@ TEST_F(UsbMidiOutputStreamTest, SendFiveByteSysEx) { } TEST_F(UsbMidiOutputStreamTest, SendSixByteSysEx) { - uint8 data[] = { 0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7, }; + uint8_t data[] = { + 0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x24 0xf0 0x00 0x01 " @@ -182,9 +210,15 @@ TEST_F(UsbMidiOutputStreamTest, SendSixByteSysEx) { } TEST_F(UsbMidiOutputStreamTest, SendPendingSysEx) { - uint8 data1[] = { 0xf0, 0x33, }; - uint8 data2[] = { 0x44, 0x55, 0x66, }; - uint8 data3[] = { 0x77, 0x88, 0x99, 0xf7, }; + uint8_t data1[] = { + 0xf0, 0x33, + }; + uint8_t data2[] = { + 0x44, 0x55, 0x66, + }; + uint8_t data3[] = { + 0x77, 0x88, 0x99, 0xf7, + }; stream_->Send(ToVector(data1)); EXPECT_EQ("", device_.log()); @@ -199,7 +233,9 @@ TEST_F(UsbMidiOutputStreamTest, SendPendingSysEx) { } TEST_F(UsbMidiOutputStreamTest, SendNoteOnAfterSysEx) { - uint8 data[] = { 0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7, 0x90, 0x44, 0x33, }; + uint8_t data[] = { + 0xf0, 0x00, 0x01, 0x02, 0x03, 0xf7, 0x90, 0x44, 0x33, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x24 0xf0 0x00 0x01 " @@ -208,36 +244,48 @@ TEST_F(UsbMidiOutputStreamTest, SendNoteOnAfterSysEx) { } TEST_F(UsbMidiOutputStreamTest, SendTimeCodeQuarterFrame) { - uint8 data[] = { 0xf1, 0x22, }; + uint8_t data[] = { + 0xf1, 0x22, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x22 0xf1 0x22 0x00 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendSongPositionPointer) { - uint8 data[] = { 0xf2, 0x22, 0x33, }; + uint8_t data[] = { + 0xf2, 0x22, 0x33, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x23 0xf2 0x22 0x33 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendSongSelect) { - uint8 data[] = { 0xf3, 0x22, }; + uint8_t data[] = { + 0xf3, 0x22, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x22 0xf3 0x22 0x00 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, TuneRequest) { - uint8 data[] = { 0xf6, }; + uint8_t data[] = { + 0xf6, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x25 0xf6 0x00 0x00 (endpoint = 4)\n", device_.log()); } TEST_F(UsbMidiOutputStreamTest, SendSongPositionPointerPending) { - uint8 data1[] = { 0xf2, 0x22, }; - uint8 data2[] = { 0x33, }; + uint8_t data1[] = { + 0xf2, 0x22, + }; + uint8_t data2[] = { + 0x33, + }; stream_->Send(ToVector(data1)); EXPECT_EQ("", device_.log()); @@ -247,7 +295,9 @@ TEST_F(UsbMidiOutputStreamTest, SendSongPositionPointerPending) { } TEST_F(UsbMidiOutputStreamTest, SendRealTimeMessages) { - uint8 data[] = { 0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff, }; + uint8_t data[] = { + 0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff, + }; stream_->Send(ToVector(data)); EXPECT_EQ("0x25 0xf8 0x00 0x00 " @@ -259,10 +309,8 @@ TEST_F(UsbMidiOutputStreamTest, SendRealTimeMessages) { } TEST_F(UsbMidiOutputStreamTest, SendRealTimeInSysExMessage) { - uint8 data[] = { - 0xf0, 0x00, 0x01, 0x02, - 0xf8, 0xfa, - 0x03, 0xf7, + uint8_t data[] = { + 0xf0, 0x00, 0x01, 0x02, 0xf8, 0xfa, 0x03, 0xf7, }; stream_->Send(ToVector(data)); diff --git a/media/mojo/services/media_type_converters.cc b/media/mojo/services/media_type_converters.cc index b98c111..4e73e40 100644 --- a/media/mojo/services/media_type_converters.cc +++ b/media/mojo/services/media_type_converters.cc @@ -526,7 +526,7 @@ media::interfaces::VideoDecoderConfigPtr TypeConverter< config->coded_size = Size::From(input.coded_size()); config->visible_rect = Rect::From(input.visible_rect()); config->natural_size = Size::From(input.natural_size()); - config->extra_data = mojo::Array<uint8>::From(input.extra_data()); + config->extra_data = mojo::Array<uint8_t>::From(input.extra_data()); config->is_encrypted = input.is_encrypted(); return config.Pass(); } diff --git a/media/mojo/services/media_type_converters_unittest.cc b/media/mojo/services/media_type_converters_unittest.cc index bf035b1..db23e92 100644 --- a/media/mojo/services/media_type_converters_unittest.cc +++ b/media/mojo/services/media_type_converters_unittest.cc @@ -20,7 +20,7 @@ namespace media { namespace { -void CompareBytes(uint8* original_data, uint8* result_data, size_t length) { +void CompareBytes(uint8_t* original_data, uint8_t* result_data, size_t length) { EXPECT_GT(length, 0u); EXPECT_EQ(memcmp(original_data, result_data, length), 0); } @@ -105,15 +105,15 @@ void CompareVideoFrames(const scoped_refptr<VideoFrame>& original, } // namespace TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_Normal) { - const uint8 kData[] = "hello, world"; - const uint8 kSideData[] = "sideshow bob"; + const uint8_t kData[] = "hello, world"; + const uint8_t kSideData[] = "sideshow bob"; const int kDataSize = arraysize(kData); const int kSideDataSize = arraysize(kSideData); // Original. scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize, - reinterpret_cast<const uint8*>(&kSideData), kSideDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize, + reinterpret_cast<const uint8_t*>(&kSideData), kSideDataSize)); buffer->set_timestamp(base::TimeDelta::FromMilliseconds(123)); buffer->set_duration(base::TimeDelta::FromMilliseconds(456)); buffer->set_splice_timestamp(base::TimeDelta::FromMilliseconds(200)); @@ -155,12 +155,12 @@ TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_EOS) { } TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_KeyFrame) { - const uint8 kData[] = "hello, world"; + const uint8_t kData[] = "hello, world"; const int kDataSize = arraysize(kData); // Original. scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize)); buffer->set_is_key_frame(true); EXPECT_TRUE(buffer->is_key_frame()); @@ -176,7 +176,7 @@ TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_KeyFrame) { } TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_EncryptedBuffer) { - const uint8 kData[] = "hello, world"; + const uint8_t kData[] = "hello, world"; const int kDataSize = arraysize(kData); const char kKeyId[] = "00112233445566778899aabbccddeeff"; const char kIv[] = "0123456789abcdef"; @@ -188,7 +188,7 @@ TEST(MediaTypeConvertersTest, ConvertDecoderBuffer_EncryptedBuffer) { // Original. scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( - reinterpret_cast<const uint8*>(&kData), kDataSize)); + reinterpret_cast<const uint8_t*>(&kData), kDataSize)); buffer->set_decrypt_config( make_scoped_ptr(new DecryptConfig(kKeyId, kIv, subsamples))); @@ -280,7 +280,7 @@ TEST(MediaTypeConvertersTest, ConvertAudioBuffer_MONO) { // Original. const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_MONO; const int kSampleRate = 48000; - scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>( + scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8_t>( kSampleFormatU8, kChannelLayout, ChannelLayoutToChannelCount(kChannelLayout), kSampleRate, 1, 1, kSampleRate / 100, base::TimeDelta()); diff --git a/media/renderers/gpu_video_accelerator_factories.h b/media/renderers/gpu_video_accelerator_factories.h index c9ac36f..c1d464e 100644 --- a/media/renderers/gpu_video_accelerator_factories.h +++ b/media/renderers/gpu_video_accelerator_factories.h @@ -69,12 +69,12 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories { virtual scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() = 0; // Allocate & delete native textures. - virtual bool CreateTextures(int32 count, + virtual bool CreateTextures(int32_t count, const gfx::Size& size, - std::vector<uint32>* texture_ids, + std::vector<uint32_t>* texture_ids, std::vector<gpu::Mailbox>* texture_mailboxes, - uint32 texture_target) = 0; - virtual void DeleteTexture(uint32 texture_id) = 0; + uint32_t texture_target) = 0; + virtual void DeleteTexture(uint32_t texture_id) = 0; virtual void WaitSyncToken(const gpu::SyncToken& sync_token) = 0; diff --git a/media/renderers/mock_gpu_video_accelerator_factories.cc b/media/renderers/mock_gpu_video_accelerator_factories.cc index 84ee888..23e25f4 100644 --- a/media/renderers/mock_gpu_video_accelerator_factories.cc +++ b/media/renderers/mock_gpu_video_accelerator_factories.cc @@ -72,7 +72,7 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { gfx::BufferFormat format_; const gfx::Size size_; size_t num_planes_; - std::vector<uint8> bytes_[kMaxPlanes]; + std::vector<uint8_t> bytes_[kMaxPlanes]; }; } // unnamed namespace diff --git a/media/renderers/mock_gpu_video_accelerator_factories.h b/media/renderers/mock_gpu_video_accelerator_factories.h index 3a206db..7980939 100644 --- a/media/renderers/mock_gpu_video_accelerator_factories.h +++ b/media/renderers/mock_gpu_video_accelerator_factories.h @@ -31,12 +31,12 @@ class MockGpuVideoAcceleratorFactories : public GpuVideoAcceleratorFactories { MOCK_METHOD0(DoCreateVideoEncodeAccelerator, VideoEncodeAccelerator*()); MOCK_METHOD5(CreateTextures, - bool(int32 count, + bool(int32_t count, const gfx::Size& size, - std::vector<uint32>* texture_ids, + std::vector<uint32_t>* texture_ids, std::vector<gpu::Mailbox>* texture_mailboxes, - uint32 texture_target)); - MOCK_METHOD1(DeleteTexture, void(uint32 texture_id)); + uint32_t texture_target)); + MOCK_METHOD1(DeleteTexture, void(uint32_t texture_id)); MOCK_METHOD1(WaitSyncToken, void(const gpu::SyncToken& sync_token)); MOCK_METHOD0(GetTaskRunner, scoped_refptr<base::SingleThreadTaskRunner>()); MOCK_METHOD0(GetVideoDecodeAcceleratorCapabilities, diff --git a/media/renderers/renderer_impl_unittest.cc b/media/renderers/renderer_impl_unittest.cc index 85ed9a0..7b74081 100644 --- a/media/renderers/renderer_impl_unittest.cc +++ b/media/renderers/renderer_impl_unittest.cc @@ -24,7 +24,7 @@ using ::testing::StrictMock; namespace media { -const int64 kStartPlayingTimeInMs = 100; +const int64_t kStartPlayingTimeInMs = 100; ACTION_P2(SetBufferingState, cb, buffering_state) { cb->Run(buffering_state); @@ -223,13 +223,13 @@ class RendererImplTest : public ::testing::Test { base::RunLoop().RunUntilIdle(); } - int64 GetMediaTimeMs() { + int64_t GetMediaTimeMs() { return renderer_impl_->GetMediaTime().InMilliseconds(); } bool IsMediaTimeAdvancing(double playback_rate) { - int64 start_time_ms = GetMediaTimeMs(); - const int64 time_to_advance_ms = 100; + int64_t start_time_ms = GetMediaTimeMs(); + const int64_t time_to_advance_ms = 100; test_tick_clock_.Advance( base::TimeDelta::FromMilliseconds(time_to_advance_ms)); diff --git a/media/renderers/skcanvas_video_renderer.cc b/media/renderers/skcanvas_video_renderer.cc index ec093da..68f2b28 100644 --- a/media/renderers/skcanvas_video_renderer.cc +++ b/media/renderers/skcanvas_video_renderer.cc @@ -270,7 +270,7 @@ class VideoImageGenerator : public SkImageGenerator { // TODO: Find a way (API change?) to avoid this copy. char* out_line = static_cast<char*>(planes[plane]); int out_line_stride = row_bytes[plane]; - uint8* in_line = frame_->data(plane) + offset; + uint8_t* in_line = frame_->data(plane) + offset; int in_line_stride = frame_->stride(plane); int plane_height = sizes[plane].height(); if (in_line_stride == out_line_stride) { @@ -311,7 +311,7 @@ SkCanvasVideoRenderer::~SkCanvasVideoRenderer() { void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame, SkCanvas* canvas, const gfx::RectF& dest_rect, - uint8 alpha, + uint8_t alpha, SkXfermode::Mode mode, VideoRotation video_rotation, const Context3D& context_3d) { @@ -473,7 +473,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kUPlane), video_frame->visible_data(VideoFrame::kVPlane), video_frame->stride(VideoFrame::kVPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height()); } else if (CheckColorSpace(video_frame, COLOR_SPACE_HD_REC709)) { @@ -483,7 +483,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kUPlane), video_frame->visible_data(VideoFrame::kVPlane), video_frame->stride(VideoFrame::kVPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height()); } else { @@ -493,7 +493,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kUPlane), video_frame->visible_data(VideoFrame::kVPlane), video_frame->stride(VideoFrame::kVPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height()); } @@ -505,7 +505,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kUPlane), video_frame->visible_data(VideoFrame::kVPlane), video_frame->stride(VideoFrame::kVPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height()); break; @@ -520,7 +520,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kVPlane), video_frame->visible_data(VideoFrame::kAPlane), video_frame->stride(VideoFrame::kAPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height(), 1); // 1 = enable RGB premultiplication by Alpha. @@ -533,7 +533,7 @@ void SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( video_frame->stride(VideoFrame::kUPlane), video_frame->visible_data(VideoFrame::kVPlane), video_frame->stride(VideoFrame::kVPlane), - static_cast<uint8*>(rgb_pixels), row_bytes, + static_cast<uint8_t*>(rgb_pixels), row_bytes, video_frame->visible_rect().width(), video_frame->visible_rect().height()); break; @@ -572,7 +572,7 @@ void SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( << mailbox_holder.texture_target; gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); - uint32 source_texture = gl->CreateAndConsumeTextureCHROMIUM( + uint32_t source_texture = gl->CreateAndConsumeTextureCHROMIUM( mailbox_holder.texture_target, mailbox_holder.mailbox.name); // The video is stored in a unmultiplied format, so premultiply diff --git a/media/renderers/skcanvas_video_renderer.h b/media/renderers/skcanvas_video_renderer.h index 3339413..433b03a 100644 --- a/media/renderers/skcanvas_video_renderer.h +++ b/media/renderers/skcanvas_video_renderer.h @@ -44,7 +44,7 @@ class MEDIA_EXPORT SkCanvasVideoRenderer { void Paint(const scoped_refptr<VideoFrame>& video_frame, SkCanvas* canvas, const gfx::RectF& dest_rect, - uint8 alpha, + uint8_t alpha, SkXfermode::Mode mode, VideoRotation video_rotation, const Context3D& context_3d); diff --git a/media/renderers/skcanvas_video_renderer_unittest.cc b/media/renderers/skcanvas_video_renderer_unittest.cc index fad340d..ffd2221 100644 --- a/media/renderers/skcanvas_video_renderer_unittest.cc +++ b/media/renderers/skcanvas_video_renderer_unittest.cc @@ -156,7 +156,7 @@ SkCanvasVideoRendererTest::SkCanvasVideoRendererTest() // Each color region in the cropped frame is on a 2x2 block granularity, to // avoid sharing UV samples between regions. - static const uint8 cropped_y_plane[] = { + static const uint8_t cropped_y_plane[] = { 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, @@ -175,14 +175,14 @@ SkCanvasVideoRendererTest::SkCanvasVideoRendererTest() 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, }; - static const uint8 cropped_u_plane[] = { + static const uint8_t cropped_u_plane[] = { 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, 128, 128, 84, 84, 84, 84, 43, 43, 43, 43, 255, 255, 255, 255, 43, 43, 43, 43, 255, 255, 255, 255, 43, 43, 43, 43, 255, 255, 255, 255, 43, 43, 43, 43, 255, 255, 255, 255, }; - static const uint8 cropped_v_plane[] = { + static const uint8_t cropped_v_plane[] = { 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, 128, 128, 255, 255, 255, 255, 21, 21, 21, 21, 107, 107, 107, diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index 755eb1a..2c17aff 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc @@ -1252,7 +1252,7 @@ TEST_P(Mp3FastSeekIntegrationTest, FastSeekAccuracy_MP3) { // // Quick TOC design (not pretty!): // - All MP3 TOCs are 100 bytes - // - Each byte is read as a uint8; value between 0 - 255. + // - Each byte is read as a uint8_t; value between 0 - 255. // - The index into this array is the numerator in the ratio: index / 100. // This fraction represents a playback time as a percentage of duration. // - The value at the given index is the numerator in the ratio: value / 256. diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc index dfa8411..b75a04c 100644 --- a/media/test/pipeline_integration_test_base.cc +++ b/media/test/pipeline_integration_test_base.cc @@ -69,7 +69,7 @@ void PipelineIntegrationTestBase::OnStatusCallback( void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB( EmeInitDataType type, - const std::vector<uint8>& init_data) { + const std::vector<uint8_t>& init_data) { DCHECK(!init_data.empty()); CHECK(!encrypted_media_init_data_cb_.is_null()); encrypted_media_init_data_cb_.Run(type, init_data); diff --git a/media/test/pipeline_integration_test_base.h b/media/test/pipeline_integration_test_base.h index 5d31085..7648384 100644 --- a/media/test/pipeline_integration_test_base.h +++ b/media/test/pipeline_integration_test_base.h @@ -122,7 +122,7 @@ class PipelineIntegrationTestBase { void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); void OnStatusCallback(PipelineStatus status); void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, - const std::vector<uint8>& init_data); + const std::vector<uint8_t>& init_data); void set_encrypted_media_init_data_cb( const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) { encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; diff --git a/media/video/fake_video_encode_accelerator.cc b/media/video/fake_video_encode_accelerator.cc index f0087db..0fabbde 100644 --- a/media/video/fake_video_encode_accelerator.cc +++ b/media/video/fake_video_encode_accelerator.cc @@ -44,7 +44,7 @@ FakeVideoEncodeAccelerator::GetSupportedProfiles() { bool FakeVideoEncodeAccelerator::Initialize(VideoPixelFormat input_format, const gfx::Size& input_visible_size, VideoCodecProfile output_profile, - uint32 initial_bitrate, + uint32_t initial_bitrate, Client* client) { if (!will_initialization_succeed_) { return false; @@ -79,8 +79,8 @@ void FakeVideoEncodeAccelerator::UseOutputBitstreamBuffer( } void FakeVideoEncodeAccelerator::RequestEncodingParametersChange( - uint32 bitrate, - uint32 framerate) { + uint32_t bitrate, + uint32_t framerate) { stored_bitrates_.push_back(bitrate); } @@ -113,7 +113,7 @@ void FakeVideoEncodeAccelerator::EncodeTask() { while (!queued_frames_.empty() && !available_buffers_.empty()) { bool force_key_frame = queued_frames_.front(); queued_frames_.pop(); - int32 bitstream_buffer_id = available_buffers_.front().id(); + int32_t bitstream_buffer_id = available_buffers_.front().id(); available_buffers_.pop_front(); bool key_frame = next_frame_is_first_frame_ || force_key_frame; next_frame_is_first_frame_ = false; @@ -128,7 +128,7 @@ void FakeVideoEncodeAccelerator::EncodeTask() { } void FakeVideoEncodeAccelerator::DoBitstreamBufferReady( - int32 bitstream_buffer_id, + int32_t bitstream_buffer_id, size_t payload_size, bool key_frame) const { client_->BitstreamBufferReady(bitstream_buffer_id, diff --git a/media/video/fake_video_encode_accelerator.h b/media/video/fake_video_encode_accelerator.h index 91b6f1d..d1f08e7 100644 --- a/media/video/fake_video_encode_accelerator.h +++ b/media/video/fake_video_encode_accelerator.h @@ -32,16 +32,16 @@ class MEDIA_EXPORT FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { bool Initialize(VideoPixelFormat input_format, const gfx::Size& input_visible_size, VideoCodecProfile output_profile, - uint32 initial_bitrate, + uint32_t initial_bitrate, Client* client) override; void Encode(const scoped_refptr<VideoFrame>& frame, bool force_keyframe) override; void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) override; - void RequestEncodingParametersChange(uint32 bitrate, - uint32 framerate) override; + void RequestEncodingParametersChange(uint32_t bitrate, + uint32_t framerate) override; void Destroy() override; - const std::vector<uint32>& stored_bitrates() const { + const std::vector<uint32_t>& stored_bitrates() const { return stored_bitrates_; } void SendDummyFrameForTesting(bool key_frame); @@ -52,13 +52,13 @@ class MEDIA_EXPORT FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { const gfx::Size& input_coded_size, size_t output_buffer_size) const; void EncodeTask(); - void DoBitstreamBufferReady(int32 bitstream_buffer_id, + void DoBitstreamBufferReady(int32_t bitstream_buffer_id, size_t payload_size, bool key_frame) const; // Our original (constructor) calling message loop used for all tasks. const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - std::vector<uint32> stored_bitrates_; + std::vector<uint32_t> stored_bitrates_; bool will_initialization_succeed_; VideoEncodeAccelerator::Client* client_; diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc index 4b23aad..1e6f1fc 100644 --- a/media/video/gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/gpu_memory_buffer_video_frame_pool.cc @@ -225,9 +225,9 @@ int RowsPerCopy(size_t plane, VideoPixelFormat format, int width) { void CopyRowsToI420Buffer(int first_row, int rows, int bytes_per_row, - const uint8* source, + const uint8_t* source, int source_stride, - uint8* output, + uint8_t* output, int dest_stride, const base::Closure& done) { TRACE_EVENT2("media", "CopyRowsToI420Buffer", "bytes_per_row", bytes_per_row, @@ -248,9 +248,9 @@ void CopyRowsToNV12Buffer(int first_row, int rows, int bytes_per_row, const scoped_refptr<VideoFrame>& source_frame, - uint8* dest_y, + uint8_t* dest_y, int dest_stride_y, - uint8* dest_uv, + uint8_t* dest_uv, int dest_stride_uv, const base::Closure& done) { TRACE_EVENT2("media", "CopyRowsToNV12Buffer", "bytes_per_row", bytes_per_row, @@ -283,7 +283,7 @@ void CopyRowsToUYVYBuffer(int first_row, int rows, int width, const scoped_refptr<VideoFrame>& source_frame, - uint8* output, + uint8_t* output, int dest_stride, const base::Closure& done) { TRACE_EVENT2("media", "CopyRowsToUYVYBuffer", "bytes_per_row", width * 2, @@ -391,7 +391,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame( bool GpuMemoryBufferVideoFramePool::PoolImpl::OnMemoryDump( const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* pmd) { - const uint64 tracing_process_id = + const uint64_t tracing_process_id = base::trace_event::MemoryDumpManager::GetInstance() ->GetTracingProcessId(); const int kImportance = 2; diff --git a/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc b/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc index 3a8318c..c1fc5ba 100644 --- a/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc +++ b/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc @@ -63,9 +63,9 @@ class GpuMemoryBufferVideoFramePoolTest : public ::testing::Test { static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( int dimension) { const int kDimension = 10; - static uint8 y_data[kDimension * kDimension] = {0}; - static uint8 u_data[kDimension * kDimension / 2] = {0}; - static uint8 v_data[kDimension * kDimension / 2] = {0}; + static uint8_t y_data[kDimension * kDimension] = {0}; + static uint8_t u_data[kDimension * kDimension / 2] = {0}; + static uint8_t v_data[kDimension * kDimension / 2] = {0}; DCHECK_LE(dimension, kDimension); gfx::Size size(dimension, dimension); diff --git a/media/video/jpeg_decode_accelerator.h b/media/video/jpeg_decode_accelerator.h index ec2763a..f1e1488 100644 --- a/media/video/jpeg_decode_accelerator.h +++ b/media/video/jpeg_decode_accelerator.h @@ -5,7 +5,6 @@ #ifndef MEDIA_VIDEO_JPEG_DECODE_ACCELERATOR_H_ #define MEDIA_VIDEO_JPEG_DECODE_ACCELERATOR_H_ -#include "base/basictypes.h" #include "media/base/bitstream_buffer.h" #include "media/base/media_export.h" #include "media/base/video_frame.h" diff --git a/media/video/mock_video_decode_accelerator.h b/media/video/mock_video_decode_accelerator.h index 87a5953..9e90828 100644 --- a/media/video/mock_video_decode_accelerator.h +++ b/media/video/mock_video_decode_accelerator.h @@ -9,7 +9,6 @@ #include <vector> -#include "base/basictypes.h" #include "media/base/bitstream_buffer.h" #include "media/base/video_decoder_config.h" #include "media/video/picture.h" @@ -28,7 +27,7 @@ class MockVideoDecodeAccelerator : public VideoDecodeAccelerator { MOCK_METHOD1(Decode, void(const BitstreamBuffer& bitstream_buffer)); MOCK_METHOD1(AssignPictureBuffers, void(const std::vector<PictureBuffer>& buffers)); - MOCK_METHOD1(ReusePictureBuffer, void(int32 picture_buffer_id)); + MOCK_METHOD1(ReusePictureBuffer, void(int32_t picture_buffer_id)); MOCK_METHOD0(Flush, void()); MOCK_METHOD0(Reset, void()); MOCK_METHOD0(Destroy, void()); diff --git a/media/video/picture.cc b/media/video/picture.cc index 6205795..315ad65 100644 --- a/media/video/picture.cc +++ b/media/video/picture.cc @@ -6,39 +6,35 @@ namespace media { -PictureBuffer::PictureBuffer(int32 id, gfx::Size size, uint32 texture_id) - : id_(id), size_(size), texture_id_(texture_id), internal_texture_id_(0) { -} +PictureBuffer::PictureBuffer(int32_t id, gfx::Size size, uint32_t texture_id) + : id_(id), size_(size), texture_id_(texture_id), internal_texture_id_(0) {} -PictureBuffer::PictureBuffer(int32 id, +PictureBuffer::PictureBuffer(int32_t id, gfx::Size size, - uint32 texture_id, - uint32 internal_texture_id) + uint32_t texture_id, + uint32_t internal_texture_id) : id_(id), size_(size), texture_id_(texture_id), - internal_texture_id_(internal_texture_id) { -} + internal_texture_id_(internal_texture_id) {} -PictureBuffer::PictureBuffer(int32 id, +PictureBuffer::PictureBuffer(int32_t id, gfx::Size size, - uint32 texture_id, + uint32_t texture_id, const gpu::Mailbox& texture_mailbox) : id_(id), size_(size), texture_id_(texture_id), internal_texture_id_(0), - texture_mailbox_(texture_mailbox) { -} + texture_mailbox_(texture_mailbox) {} -Picture::Picture(int32 picture_buffer_id, - int32 bitstream_buffer_id, +Picture::Picture(int32_t picture_buffer_id, + int32_t bitstream_buffer_id, const gfx::Rect& visible_rect, bool allow_overlay) : picture_buffer_id_(picture_buffer_id), bitstream_buffer_id_(bitstream_buffer_id), visible_rect_(visible_rect), - allow_overlay_(allow_overlay) { -} + allow_overlay_(allow_overlay) {} } // namespace media diff --git a/media/video/picture.h b/media/video/picture.h index 1fb5096..e997dbb 100644 --- a/media/video/picture.h +++ b/media/video/picture.h @@ -5,7 +5,6 @@ #ifndef MEDIA_VIDEO_PICTURE_H_ #define MEDIA_VIDEO_PICTURE_H_ -#include "base/basictypes.h" #include "gpu/command_buffer/common/mailbox.h" #include "media/base/media_export.h" #include "ui/gfx/geometry/rect.h" @@ -17,20 +16,18 @@ namespace media { // This is the media-namespace equivalent of PP_PictureBuffer_Dev. class MEDIA_EXPORT PictureBuffer { public: - PictureBuffer(int32 id, gfx::Size size, uint32 texture_id); - PictureBuffer(int32 id, + PictureBuffer(int32_t id, gfx::Size size, uint32_t texture_id); + PictureBuffer(int32_t id, gfx::Size size, - uint32 texture_id, - uint32 internal_texture_id); - PictureBuffer(int32 id, + uint32_t texture_id, + uint32_t internal_texture_id); + PictureBuffer(int32_t id, gfx::Size size, - uint32 texture_id, + uint32_t texture_id, const gpu::Mailbox& texture_mailbox); // Returns the client-specified id of the buffer. - int32 id() const { - return id_; - } + int32_t id() const { return id_; } // Returns the size of the buffer. gfx::Size size() const { @@ -40,21 +37,19 @@ class MEDIA_EXPORT PictureBuffer { // Returns the id of the texture. // NOTE: The texture id in the renderer process corresponds to a different // texture id in the GPU process. - uint32 texture_id() const { - return texture_id_; - } + uint32_t texture_id() const { return texture_id_; } - uint32 internal_texture_id() const { return internal_texture_id_; } + uint32_t internal_texture_id() const { return internal_texture_id_; } const gpu::Mailbox& texture_mailbox() const { return texture_mailbox_; } private: - int32 id_; + int32_t id_; gfx::Size size_; - uint32 texture_id_; - uint32 internal_texture_id_; + uint32_t texture_id_; + uint32_t internal_texture_id_; gpu::Mailbox texture_mailbox_; }; @@ -62,22 +57,18 @@ class MEDIA_EXPORT PictureBuffer { // This is the media-namespace equivalent of PP_Picture_Dev. class MEDIA_EXPORT Picture { public: - Picture(int32 picture_buffer_id, - int32 bitstream_buffer_id, + Picture(int32_t picture_buffer_id, + int32_t bitstream_buffer_id, const gfx::Rect& visible_rect, bool allow_overlay); // Returns the id of the picture buffer where this picture is contained. - int32 picture_buffer_id() const { - return picture_buffer_id_; - } + int32_t picture_buffer_id() const { return picture_buffer_id_; } // Returns the id of the bitstream buffer from which this frame was decoded. - int32 bitstream_buffer_id() const { - return bitstream_buffer_id_; - } + int32_t bitstream_buffer_id() const { return bitstream_buffer_id_; } - void set_bitstream_buffer_id(int32 bitstream_buffer_id) { + void set_bitstream_buffer_id(int32_t bitstream_buffer_id) { bitstream_buffer_id_ = bitstream_buffer_id; } @@ -89,8 +80,8 @@ class MEDIA_EXPORT Picture { bool allow_overlay() const { return allow_overlay_; } private: - int32 picture_buffer_id_; - int32 bitstream_buffer_id_; + int32_t picture_buffer_id_; + int32_t bitstream_buffer_id_; gfx::Rect visible_rect_; bool allow_overlay_; }; diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index 81f3794..d7e79c8 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h @@ -8,7 +8,6 @@ #include <memory> #include <vector> -#include "base/basictypes.h" #include "media/base/bitstream_buffer.h" #include "media/base/video_decoder_config.h" #include "media/video/picture.h" @@ -105,19 +104,19 @@ class MEDIA_EXPORT VideoDecodeAccelerator { // Callback to tell client how many and what size of buffers to provide. // Note that the actual count provided through AssignPictureBuffers() can be // larger than the value requested. - virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, + virtual void ProvidePictureBuffers(uint32_t requested_num_of_buffers, const gfx::Size& dimensions, - uint32 texture_target) = 0; + uint32_t texture_target) = 0; // Callback to dismiss picture buffer that was assigned earlier. - virtual void DismissPictureBuffer(int32 picture_buffer_id) = 0; + virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0; // Callback to deliver decoded pictures ready to be displayed. virtual void PictureReady(const Picture& picture) = 0; // Callback to notify that decoded has decoded the end of the current // bitstream buffer. - virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) = 0; + virtual void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) = 0; // Flush completion callback. virtual void NotifyFlushDone() = 0; @@ -184,7 +183,7 @@ class MEDIA_EXPORT VideoDecodeAccelerator { // // Parameters: // |picture_buffer_id| id of the picture buffer that is to be reused. - virtual void ReusePictureBuffer(int32 picture_buffer_id) = 0; + virtual void ReusePictureBuffer(int32_t picture_buffer_id) = 0; // Flushes the decoder: all pending inputs will be decoded and pictures handed // back to the client, followed by NotifyFlushDone() being called on the diff --git a/media/video/video_encode_accelerator.h b/media/video/video_encode_accelerator.h index 39ad0b7..ee0ee33 100644 --- a/media/video/video_encode_accelerator.h +++ b/media/video/video_encode_accelerator.h @@ -8,7 +8,6 @@ #include <memory> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/base/bitstream_buffer.h" #include "media/base/media_export.h" @@ -29,8 +28,8 @@ class MEDIA_EXPORT VideoEncodeAccelerator { ~SupportedProfile(); VideoCodecProfile profile; gfx::Size max_resolution; - uint32 max_framerate_numerator; - uint32 max_framerate_denominator; + uint32_t max_framerate_numerator; + uint32_t max_framerate_denominator; }; using SupportedProfiles = std::vector<SupportedProfile>; @@ -77,7 +76,7 @@ class MEDIA_EXPORT VideoEncodeAccelerator { // |bitstream_buffer_id| is the id of the buffer that is ready. // |payload_size| is the byte size of the used portion of the buffer. // |key_frame| is true if this delivered frame is a keyframe. - virtual void BitstreamBufferReady(int32 bitstream_buffer_id, + virtual void BitstreamBufferReady(int32_t bitstream_buffer_id, size_t payload_size, bool key_frame) = 0; @@ -116,7 +115,7 @@ class MEDIA_EXPORT VideoEncodeAccelerator { virtual bool Initialize(VideoPixelFormat input_format, const gfx::Size& input_visible_size, VideoCodecProfile output_profile, - uint32 initial_bitrate, + uint32_t initial_bitrate, Client* client) = 0; // Encodes the given frame. @@ -138,8 +137,8 @@ class MEDIA_EXPORT VideoEncodeAccelerator { // Parameters: // |bitrate| is the requested new bitrate, in bits per second. // |framerate| is the requested new framerate, in frames per second. - virtual void RequestEncodingParametersChange(uint32 bitrate, - uint32 framerate) = 0; + virtual void RequestEncodingParametersChange(uint32_t bitrate, + uint32_t framerate) = 0; // Destroys the encoder: all pending inputs and outputs are dropped // immediately and the component is freed. This call may asynchronously free |