OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const uint32_t nSamples, | 59 const uint32_t nSamples, |
60 const uint8_t nBytesPerSample, | 60 const uint8_t nBytesPerSample, |
61 const uint8_t nChannels, | 61 const uint8_t nChannels, |
62 const uint32_t samplesPerSec, | 62 const uint32_t samplesPerSec, |
63 const uint32_t totalDelayMS, | 63 const uint32_t totalDelayMS, |
64 const int32_t clockDrift, | 64 const int32_t clockDrift, |
65 const uint32_t currentMicLevel, | 65 const uint32_t currentMicLevel, |
66 const bool keyPressed, | 66 const bool keyPressed, |
67 uint32_t& newMicLevel) { | 67 uint32_t& newMicLevel) { |
68 rec_buffer_bytes_ = nSamples * nBytesPerSample; | 68 rec_buffer_bytes_ = nSamples * nBytesPerSample; |
69 if ((rec_buffer_bytes_ <= 0) || | 69 if ((rec_buffer_bytes_ == 0) || |
70 (rec_buffer_bytes_ > FakeAudioCaptureModule::kNumberSamples * | 70 (rec_buffer_bytes_ > FakeAudioCaptureModule::kNumberSamples * |
71 FakeAudioCaptureModule::kNumberBytesPerSample)) { | 71 FakeAudioCaptureModule::kNumberBytesPerSample)) { |
72 ADD_FAILURE(); | 72 ADD_FAILURE(); |
73 return -1; | 73 return -1; |
74 } | 74 } |
75 memcpy(rec_buffer_, audioSamples, rec_buffer_bytes_); | 75 memcpy(rec_buffer_, audioSamples, rec_buffer_bytes_); |
76 ++push_iterations_; | 76 ++push_iterations_; |
77 newMicLevel = currentMicLevel; | 77 newMicLevel = currentMicLevel; |
78 return 0; | 78 return 0; |
79 } | 79 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording()); | 198 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording()); |
199 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording()); | 199 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording()); |
200 | 200 |
201 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond); | 201 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond); |
202 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond); | 202 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond); |
203 | 203 |
204 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout()); | 204 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout()); |
205 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording()); | 205 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording()); |
206 } | 206 } |
OLD | NEW |