| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 class AudioTransportAPI: public AudioTransport { | 76 class AudioTransportAPI: public AudioTransport { |
| 77 public: | 77 public: |
| 78 AudioTransportAPI(AudioDeviceModule* audioDevice) | 78 AudioTransportAPI(AudioDeviceModule* audioDevice) |
| 79 : rec_count_(0), | 79 : rec_count_(0), |
| 80 play_count_(0) { | 80 play_count_(0) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 ~AudioTransportAPI() {} | 83 ~AudioTransportAPI() {} |
| 84 | 84 |
| 85 int32_t RecordedDataIsAvailable(const void* audioSamples, | 85 int32_t RecordedDataIsAvailable(const void* audioSamples, |
| 86 const uint32_t nSamples, | 86 const size_t nSamples, |
| 87 const uint8_t nBytesPerSample, | 87 const size_t nBytesPerSample, |
| 88 const uint8_t nChannels, | 88 const uint8_t nChannels, |
| 89 const uint32_t sampleRate, | 89 const uint32_t sampleRate, |
| 90 const uint32_t totalDelay, | 90 const uint32_t totalDelay, |
| 91 const int32_t clockSkew, | 91 const int32_t clockSkew, |
| 92 const uint32_t currentMicLevel, | 92 const uint32_t currentMicLevel, |
| 93 const bool keyPressed, | 93 const bool keyPressed, |
| 94 uint32_t& newMicLevel) override { | 94 uint32_t& newMicLevel) override { |
| 95 rec_count_++; | 95 rec_count_++; |
| 96 if (rec_count_ % 100 == 0) { | 96 if (rec_count_ % 100 == 0) { |
| 97 if (nChannels == 1) { | 97 if (nChannels == 1) { |
| 98 // mono | 98 // mono |
| 99 TEST_LOG("-"); | 99 TEST_LOG("-"); |
| 100 } else if ((nChannels == 2) && (nBytesPerSample == 2)) { | 100 } else if ((nChannels == 2) && (nBytesPerSample == 2)) { |
| 101 // stereo but only using one channel | 101 // stereo but only using one channel |
| 102 TEST_LOG("-|"); | 102 TEST_LOG("-|"); |
| 103 } else { | 103 } else { |
| 104 // stereo | 104 // stereo |
| 105 TEST_LOG("--"); | 105 TEST_LOG("--"); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 return 0; | 108 return 0; |
| 109 } | 109 } |
| 110 | 110 |
| 111 int32_t NeedMorePlayData(const uint32_t nSamples, | 111 int32_t NeedMorePlayData(const size_t nSamples, |
| 112 const uint8_t nBytesPerSample, | 112 const size_t nBytesPerSample, |
| 113 const uint8_t nChannels, | 113 const uint8_t nChannels, |
| 114 const uint32_t sampleRate, | 114 const uint32_t sampleRate, |
| 115 void* audioSamples, | 115 void* audioSamples, |
| 116 uint32_t& nSamplesOut, | 116 size_t& nSamplesOut, |
| 117 int64_t* elapsed_time_ms, | 117 int64_t* elapsed_time_ms, |
| 118 int64_t* ntp_time_ms) override { | 118 int64_t* ntp_time_ms) override { |
| 119 play_count_++; | 119 play_count_++; |
| 120 if (play_count_ % 100 == 0) { | 120 if (play_count_ % 100 == 0) { |
| 121 if (nChannels == 1) { | 121 if (nChannels == 1) { |
| 122 TEST_LOG("+"); | 122 TEST_LOG("+"); |
| 123 } else { | 123 } else { |
| 124 TEST_LOG("++"); | 124 TEST_LOG("++"); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 nSamplesOut = 480; | 127 nSamplesOut = 480; |
| 128 return 0; | 128 return 0; |
| 129 } | 129 } |
| 130 | 130 |
| 131 int OnDataAvailable(const int voe_channels[], | 131 int OnDataAvailable(const int voe_channels[], |
| 132 int number_of_voe_channels, | 132 int number_of_voe_channels, |
| 133 const int16_t* audio_data, | 133 const int16_t* audio_data, |
| 134 int sample_rate, | 134 int sample_rate, |
| 135 int number_of_channels, | 135 int number_of_channels, |
| 136 int number_of_frames, | 136 size_t number_of_frames, |
| 137 int audio_delay_milliseconds, | 137 int audio_delay_milliseconds, |
| 138 int current_volume, | 138 int current_volume, |
| 139 bool key_pressed, | 139 bool key_pressed, |
| 140 bool need_audio_processing) override { | 140 bool need_audio_processing) override { |
| 141 return 0; | 141 return 0; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void PushCaptureData(int voe_channel, const void* audio_data, | 144 void PushCaptureData(int voe_channel, const void* audio_data, |
| 145 int bits_per_sample, int sample_rate, | 145 int bits_per_sample, int sample_rate, |
| 146 int number_of_channels, | 146 int number_of_channels, |
| 147 int number_of_frames) override {} | 147 size_t number_of_frames) override {} |
| 148 | 148 |
| 149 void PullRenderData(int bits_per_sample, int sample_rate, | 149 void PullRenderData(int bits_per_sample, int sample_rate, |
| 150 int number_of_channels, int number_of_frames, | 150 int number_of_channels, size_t number_of_frames, |
| 151 void* audio_data, | 151 void* audio_data, |
| 152 int64_t* elapsed_time_ms, | 152 int64_t* elapsed_time_ms, |
| 153 int64_t* ntp_time_ms) override {} | 153 int64_t* ntp_time_ms) override {} |
| 154 private: | 154 private: |
| 155 uint32_t rec_count_; | 155 uint32_t rec_count_; |
| 156 uint32_t play_count_; | 156 uint32_t play_count_; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 class AudioDeviceAPITest: public testing::Test { | 159 class AudioDeviceAPITest: public testing::Test { |
| 160 protected: | 160 protected: |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 // TODO(kjellander): Fix so these tests pass on Mac. | 1822 // TODO(kjellander): Fix so these tests pass on Mac. |
| 1823 #if !defined(WEBRTC_MAC) | 1823 #if !defined(WEBRTC_MAC) |
| 1824 EXPECT_EQ(0, audio_device_->InitPlayout()); | 1824 EXPECT_EQ(0, audio_device_->InitPlayout()); |
| 1825 EXPECT_EQ(0, audio_device_->StartPlayout()); | 1825 EXPECT_EQ(0, audio_device_->StartPlayout()); |
| 1826 #endif | 1826 #endif |
| 1827 | 1827 |
| 1828 EXPECT_EQ(-1, audio_device_->GetLoudspeakerStatus(&loudspeakerOn)); | 1828 EXPECT_EQ(-1, audio_device_->GetLoudspeakerStatus(&loudspeakerOn)); |
| 1829 #endif | 1829 #endif |
| 1830 EXPECT_EQ(0, audio_device_->StopPlayout()); | 1830 EXPECT_EQ(0, audio_device_->StopPlayout()); |
| 1831 } | 1831 } |
| OLD | NEW |