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

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: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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/statstypes.cc ('k') | talk/app/webrtc/test/fakeaudiocapturemodule.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 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Periodcally called function that ensures that frames are pulled and pushed 235 // Periodcally called function that ensures that frames are pulled and pushed
236 // periodically if enabled/started. 236 // periodically if enabled/started.
237 void ProcessFrameP(); 237 void ProcessFrameP();
238 // Pulls frames from the registered webrtc::AudioTransport. 238 // Pulls frames from the registered webrtc::AudioTransport.
239 void ReceiveFrameP(); 239 void ReceiveFrameP();
240 // Pushes frames to the registered webrtc::AudioTransport. 240 // Pushes frames to the registered webrtc::AudioTransport.
241 void SendFrameP(); 241 void SendFrameP();
242 242
243 // The time in milliseconds when Process() was last called or 0 if no call 243 // The time in milliseconds when Process() was last called or 0 if no call
244 // has been made. 244 // has been made.
245 uint32 last_process_time_ms_; 245 uint32_t last_process_time_ms_;
246 246
247 // Callback for playout and recording. 247 // Callback for playout and recording.
248 webrtc::AudioTransport* audio_callback_; 248 webrtc::AudioTransport* audio_callback_;
249 249
250 bool recording_; // True when audio is being pushed from the instance. 250 bool recording_; // True when audio is being pushed from the instance.
251 bool playing_; // True when audio is being pulled by the instance. 251 bool playing_; // True when audio is being pulled by the instance.
252 252
253 bool play_is_initialized_; // True when the instance is ready to pull audio. 253 bool play_is_initialized_; // True when the instance is ready to pull audio.
254 bool rec_is_initialized_; // True when the instance is ready to push audio. 254 bool rec_is_initialized_; // True when the instance is ready to push audio.
255 255
256 // Input to and output from RecordedDataIsAvailable(..) makes it possible to 256 // Input to and output from RecordedDataIsAvailable(..) makes it possible to
257 // modify the current mic level. The implementation does not care about the 257 // modify the current mic level. The implementation does not care about the
258 // mic level so it just feeds back what it receives. 258 // mic level so it just feeds back what it receives.
259 uint32_t current_mic_level_; 259 uint32_t current_mic_level_;
260 260
261 // next_frame_time_ is updated in a non-drifting manner to indicate the next 261 // next_frame_time_ is updated in a non-drifting manner to indicate the next
262 // wall clock time the next frame should be generated and received. started_ 262 // wall clock time the next frame should be generated and received. started_
263 // ensures that next_frame_time_ can be initialized properly on first call. 263 // ensures that next_frame_time_ can be initialized properly on first call.
264 bool started_; 264 bool started_;
265 uint32 next_frame_time_; 265 uint32_t next_frame_time_;
266 266
267 rtc::scoped_ptr<rtc::Thread> process_thread_; 267 rtc::scoped_ptr<rtc::Thread> process_thread_;
268 268
269 // Buffer for storing samples received from the webrtc::AudioTransport. 269 // Buffer for storing samples received from the webrtc::AudioTransport.
270 char rec_buffer_[kNumberSamples * kNumberBytesPerSample]; 270 char rec_buffer_[kNumberSamples * kNumberBytesPerSample];
271 // Buffer for samples to send to the webrtc::AudioTransport. 271 // Buffer for samples to send to the webrtc::AudioTransport.
272 char send_buffer_[kNumberSamples * kNumberBytesPerSample]; 272 char send_buffer_[kNumberSamples * kNumberBytesPerSample];
273 273
274 // Counter of frames received that have samples of high enough amplitude to 274 // Counter of frames received that have samples of high enough amplitude to
275 // indicate that the frames are not faked somewhere in the audio pipeline 275 // indicate that the frames are not faked somewhere in the audio pipeline
276 // (e.g. by a jitter buffer). 276 // (e.g. by a jitter buffer).
277 int frames_received_; 277 int frames_received_;
278 278
279 // Protects variables that are accessed from process_thread_ and 279 // Protects variables that are accessed from process_thread_ and
280 // the main thread. 280 // the main thread.
281 mutable rtc::CriticalSection crit_; 281 mutable rtc::CriticalSection crit_;
282 // Protects |audio_callback_| that is accessed from process_thread_ and 282 // Protects |audio_callback_| that is accessed from process_thread_ and
283 // the main thread. 283 // the main thread.
284 rtc::CriticalSection crit_callback_; 284 rtc::CriticalSection crit_callback_;
285 }; 285 };
286 286
287 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ 287 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/statstypes.cc ('k') | talk/app/webrtc/test/fakeaudiocapturemodule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698