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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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 int kNumberSamples = 440; | 60 static const size_t kNumberSamples = 440; |
61 static const int 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 |
67 // instance. Note that correctly detecting success can only be done if the | 67 // instance. Note that correctly detecting success can only be done if the |
68 // pulled frame was generated/pushed from a FakeAudioCaptureModule. | 68 // pulled frame was generated/pushed from a FakeAudioCaptureModule. |
69 int frames_received() const; | 69 int frames_received() const; |
70 | 70 |
71 // Following functions are inherited from webrtc::AudioDeviceModule. | 71 // Following functions are inherited from webrtc::AudioDeviceModule. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ |
OLD | NEW |