| 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 int GetNumQueuedPackets() { | 80 int GetNumQueuedPackets() { |
| 81 return static_cast<int>(audio_->queued_packets_.size()); | 81 return static_cast<int>(audio_->queued_packets_.size()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 int GetBytesConsumed() { | 84 int GetBytesConsumed() { |
| 85 return static_cast<int>(audio_->bytes_consumed_); | 85 return static_cast<int>(audio_->bytes_consumed_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 scoped_ptr<AudioPlayer> audio_; | 88 scoped_ptr<AudioPlayer> audio_; |
| 89 scoped_array<char> buffer_; | 89 scoped_ptr<char[]> buffer_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 scoped_ptr<AudioPacket> CreatePacketWithSamplingRate( | 92 scoped_ptr<AudioPacket> CreatePacketWithSamplingRate( |
| 93 AudioPacket::SamplingRate rate, int samples) { | 93 AudioPacket::SamplingRate rate, int samples) { |
| 94 scoped_ptr<AudioPacket> packet(new AudioPacket()); | 94 scoped_ptr<AudioPacket> packet(new AudioPacket()); |
| 95 packet->set_encoding(AudioPacket::ENCODING_RAW); | 95 packet->set_encoding(AudioPacket::ENCODING_RAW); |
| 96 packet->set_sampling_rate(rate); | 96 packet->set_sampling_rate(rate); |
| 97 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); | 97 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); |
| 98 packet->set_channels(AudioPacket::CHANNELS_STEREO); | 98 packet->set_channels(AudioPacket::CHANNELS_STEREO); |
| 99 | 99 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // Attempt to consume a frame of 25 samples. | 319 // Attempt to consume a frame of 25 samples. |
| 320 ConsumeAudioFrame(); | 320 ConsumeAudioFrame(); |
| 321 ASSERT_EQ(0, GetNumQueuedSamples()); | 321 ASSERT_EQ(0, GetNumQueuedSamples()); |
| 322 ASSERT_EQ(0, GetNumQueuedPackets()); | 322 ASSERT_EQ(0, GetNumQueuedPackets()); |
| 323 ASSERT_EQ(0, GetBytesConsumed()); | 323 ASSERT_EQ(0, GetBytesConsumed()); |
| 324 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); | 324 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace remoting | 327 } // namespace remoting |
| OLD | NEW |