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

Side by Side Diff: talk/app/webrtc/test/fakeaudiocapturemodule.h

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: google::int32 Created 5 years, 3 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "webrtc/modules/audio_device/include/audio_device.h" 46 #include "webrtc/modules/audio_device/include/audio_device.h"
47 47
48 namespace rtc { 48 namespace rtc {
49 class Thread; 49 class Thread;
50 } // namespace rtc 50 } // namespace rtc
51 51
52 class FakeAudioCaptureModule 52 class FakeAudioCaptureModule
53 : public webrtc::AudioDeviceModule, 53 : public webrtc::AudioDeviceModule,
54 public rtc::MessageHandler { 54 public rtc::MessageHandler {
55 public: 55 public:
56 typedef uint16 Sample; 56 typedef uint16_t Sample;
57 57
58 // The value for the following constants have been derived by running VoE 58 // The value for the following constants have been derived by running VoE
59 // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz. 59 // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz.
60 static const size_t kNumberSamples = 440; 60 static const size_t kNumberSamples = 440;
61 static const size_t kNumberBytesPerSample = sizeof(Sample); 61 static const size_t kNumberBytesPerSample = sizeof(Sample);
62 62
63 // Creates a FakeAudioCaptureModule or returns NULL on failure. 63 // Creates a FakeAudioCaptureModule or returns NULL on failure.
64 static rtc::scoped_refptr<FakeAudioCaptureModule> Create(); 64 static rtc::scoped_refptr<FakeAudioCaptureModule> Create();
65 65
66 // Returns the number of frames that have been successfully pulled by the 66 // Returns the number of frames that have been successfully pulled by the
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // Periodcally called function that ensures that frames are pulled and pushed 231 // Periodcally called function that ensures that frames are pulled and pushed
232 // periodically if enabled/started. 232 // periodically if enabled/started.
233 void ProcessFrameP(); 233 void ProcessFrameP();
234 // Pulls frames from the registered webrtc::AudioTransport. 234 // Pulls frames from the registered webrtc::AudioTransport.
235 void ReceiveFrameP(); 235 void ReceiveFrameP();
236 // Pushes frames to the registered webrtc::AudioTransport. 236 // Pushes frames to the registered webrtc::AudioTransport.
237 void SendFrameP(); 237 void SendFrameP();
238 238
239 // The time in milliseconds when Process() was last called or 0 if no call 239 // The time in milliseconds when Process() was last called or 0 if no call
240 // has been made. 240 // has been made.
241 uint32 last_process_time_ms_; 241 uint32_t last_process_time_ms_;
242 242
243 // Callback for playout and recording. 243 // Callback for playout and recording.
244 webrtc::AudioTransport* audio_callback_; 244 webrtc::AudioTransport* audio_callback_;
245 245
246 bool recording_; // True when audio is being pushed from the instance. 246 bool recording_; // True when audio is being pushed from the instance.
247 bool playing_; // True when audio is being pulled by the instance. 247 bool playing_; // True when audio is being pulled by the instance.
248 248
249 bool play_is_initialized_; // True when the instance is ready to pull audio. 249 bool play_is_initialized_; // True when the instance is ready to pull audio.
250 bool rec_is_initialized_; // True when the instance is ready to push audio. 250 bool rec_is_initialized_; // True when the instance is ready to push audio.
251 251
252 // Input to and output from RecordedDataIsAvailable(..) makes it possible to 252 // Input to and output from RecordedDataIsAvailable(..) makes it possible to
253 // modify the current mic level. The implementation does not care about the 253 // modify the current mic level. The implementation does not care about the
254 // mic level so it just feeds back what it receives. 254 // mic level so it just feeds back what it receives.
255 uint32_t current_mic_level_; 255 uint32_t current_mic_level_;
256 256
257 // next_frame_time_ is updated in a non-drifting manner to indicate the next 257 // next_frame_time_ is updated in a non-drifting manner to indicate the next
258 // wall clock time the next frame should be generated and received. started_ 258 // wall clock time the next frame should be generated and received. started_
259 // ensures that next_frame_time_ can be initialized properly on first call. 259 // ensures that next_frame_time_ can be initialized properly on first call.
260 bool started_; 260 bool started_;
261 uint32 next_frame_time_; 261 uint32_t next_frame_time_;
262 262
263 rtc::scoped_ptr<rtc::Thread> process_thread_; 263 rtc::scoped_ptr<rtc::Thread> process_thread_;
264 264
265 // Buffer for storing samples received from the webrtc::AudioTransport. 265 // Buffer for storing samples received from the webrtc::AudioTransport.
266 char rec_buffer_[kNumberSamples * kNumberBytesPerSample]; 266 char rec_buffer_[kNumberSamples * kNumberBytesPerSample];
267 // Buffer for samples to send to the webrtc::AudioTransport. 267 // Buffer for samples to send to the webrtc::AudioTransport.
268 char send_buffer_[kNumberSamples * kNumberBytesPerSample]; 268 char send_buffer_[kNumberSamples * kNumberBytesPerSample];
269 269
270 // Counter of frames received that have samples of high enough amplitude to 270 // Counter of frames received that have samples of high enough amplitude to
271 // indicate that the frames are not faked somewhere in the audio pipeline 271 // indicate that the frames are not faked somewhere in the audio pipeline
272 // (e.g. by a jitter buffer). 272 // (e.g. by a jitter buffer).
273 int frames_received_; 273 int frames_received_;
274 274
275 // Protects variables that are accessed from process_thread_ and 275 // Protects variables that are accessed from process_thread_ and
276 // the main thread. 276 // the main thread.
277 mutable rtc::CriticalSection crit_; 277 mutable rtc::CriticalSection crit_;
278 // Protects |audio_callback_| that is accessed from process_thread_ and 278 // Protects |audio_callback_| that is accessed from process_thread_ and
279 // the main thread. 279 // the main thread.
280 rtc::CriticalSection crit_callback_; 280 rtc::CriticalSection crit_callback_;
281 }; 281 };
282 282
283 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ 283 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698