Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: talk/app/webrtc/test/fakeaudiocapturemodule_unittest.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/rtpsender.cc ('k') | talk/app/webrtc/webrtcsdp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 virtual void SetUp() { 51 virtual void SetUp() {
52 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); 52 fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
53 EXPECT_TRUE(fake_audio_capture_module_.get() != NULL); 53 EXPECT_TRUE(fake_audio_capture_module_.get() != NULL);
54 } 54 }
55 55
56 // Callbacks inherited from webrtc::AudioTransport. 56 // Callbacks inherited from webrtc::AudioTransport.
57 // ADM is pushing data. 57 // ADM is pushing data.
58 int32_t RecordedDataIsAvailable(const void* audioSamples, 58 int32_t RecordedDataIsAvailable(const void* audioSamples,
59 const size_t nSamples, 59 const size_t nSamples,
60 const size_t nBytesPerSample, 60 const size_t nBytesPerSample,
61 const uint8_t nChannels, 61 const size_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) override { 67 uint32_t& newMicLevel) override {
68 rtc::CritScope cs(&crit_); 68 rtc::CritScope cs(&crit_);
69 rec_buffer_bytes_ = nSamples * nBytesPerSample; 69 rec_buffer_bytes_ = nSamples * nBytesPerSample;
70 if ((rec_buffer_bytes_ == 0) || 70 if ((rec_buffer_bytes_ == 0) ||
71 (rec_buffer_bytes_ > FakeAudioCaptureModule::kNumberSamples * 71 (rec_buffer_bytes_ > FakeAudioCaptureModule::kNumberSamples *
72 FakeAudioCaptureModule::kNumberBytesPerSample)) { 72 FakeAudioCaptureModule::kNumberBytesPerSample)) {
73 ADD_FAILURE(); 73 ADD_FAILURE();
74 return -1; 74 return -1;
75 } 75 }
76 memcpy(rec_buffer_, audioSamples, rec_buffer_bytes_); 76 memcpy(rec_buffer_, audioSamples, rec_buffer_bytes_);
77 ++push_iterations_; 77 ++push_iterations_;
78 newMicLevel = currentMicLevel; 78 newMicLevel = currentMicLevel;
79 return 0; 79 return 0;
80 } 80 }
81 81
82 // ADM is pulling data. 82 // ADM is pulling data.
83 int32_t NeedMorePlayData(const size_t nSamples, 83 int32_t NeedMorePlayData(const size_t nSamples,
84 const size_t nBytesPerSample, 84 const size_t nBytesPerSample,
85 const uint8_t nChannels, 85 const size_t nChannels,
86 const uint32_t samplesPerSec, 86 const uint32_t samplesPerSec,
87 void* audioSamples, 87 void* audioSamples,
88 size_t& nSamplesOut, 88 size_t& nSamplesOut,
89 int64_t* elapsed_time_ms, 89 int64_t* elapsed_time_ms,
90 int64_t* ntp_time_ms) override { 90 int64_t* ntp_time_ms) override {
91 rtc::CritScope cs(&crit_); 91 rtc::CritScope cs(&crit_);
92 ++pull_iterations_; 92 ++pull_iterations_;
93 const size_t audio_buffer_size = nSamples * nBytesPerSample; 93 const size_t audio_buffer_size = nSamples * nBytesPerSample;
94 const size_t bytes_out = RecordedDataReceived() ? 94 const size_t bytes_out = RecordedDataReceived() ?
95 CopyFromRecBuffer(audioSamples, audio_buffer_size): 95 CopyFromRecBuffer(audioSamples, audio_buffer_size):
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording()); 208 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording());
209 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording()); 209 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording());
210 210
211 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond); 211 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond);
212 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond); 212 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond);
213 213
214 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout()); 214 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout());
215 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording()); 215 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording());
216 } 216 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/rtpsender.cc ('k') | talk/app/webrtc/webrtcsdp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698