| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/client/audio_player.h" | 5 #include "remoting/client/audio_player.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 packet->set_encoding(AudioPacket::ENCODING_RAW); | 92 packet->set_encoding(AudioPacket::ENCODING_RAW); |
| 93 packet->set_sampling_rate(rate); | 93 packet->set_sampling_rate(rate); |
| 94 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); | 94 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); |
| 95 packet->set_channels(AudioPacket::CHANNELS_STEREO); | 95 packet->set_channels(AudioPacket::CHANNELS_STEREO); |
| 96 | 96 |
| 97 // The data must be a multiple of 4 bytes (channels x bytes_per_sample). | 97 // The data must be a multiple of 4 bytes (channels x bytes_per_sample). |
| 98 std::string data; | 98 std::string data; |
| 99 data.resize(samples * kAudioSampleBytes, kDummyAudioData); | 99 data.resize(samples * kAudioSampleBytes, kDummyAudioData); |
| 100 packet->add_data(data); | 100 packet->add_data(data); |
| 101 | 101 |
| 102 return packet.Pass(); | 102 return packet; |
| 103 } | 103 } |
| 104 | 104 |
| 105 scoped_ptr<AudioPacket> CreatePacket44100Hz(int samples) { | 105 scoped_ptr<AudioPacket> CreatePacket44100Hz(int samples) { |
| 106 return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_44100, | 106 return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_44100, |
| 107 samples); | 107 samples); |
| 108 } | 108 } |
| 109 | 109 |
| 110 scoped_ptr<AudioPacket> CreatePacket48000Hz(int samples) { | 110 scoped_ptr<AudioPacket> CreatePacket48000Hz(int samples) { |
| 111 return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_48000, | 111 return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_48000, |
| 112 samples); | 112 samples); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 // Attempt to consume a frame of 25 samples. | 304 // Attempt to consume a frame of 25 samples. |
| 305 ConsumeAudioFrame(); | 305 ConsumeAudioFrame(); |
| 306 ASSERT_EQ(0, GetNumQueuedSamples()); | 306 ASSERT_EQ(0, GetNumQueuedSamples()); |
| 307 ASSERT_EQ(0, GetNumQueuedPackets()); | 307 ASSERT_EQ(0, GetNumQueuedPackets()); |
| 308 ASSERT_EQ(0, GetBytesConsumed()); | 308 ASSERT_EQ(0, GetBytesConsumed()); |
| 309 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); | 309 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace remoting | 312 } // namespace remoting |
| OLD | NEW |