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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } // namespace rtc | 51 } // namespace rtc |
52 | 52 |
53 class FakeAudioCaptureModule | 53 class FakeAudioCaptureModule |
54 : public webrtc::AudioDeviceModule, | 54 : public webrtc::AudioDeviceModule, |
55 public rtc::MessageHandler { | 55 public rtc::MessageHandler { |
56 public: | 56 public: |
57 typedef uint16 Sample; | 57 typedef uint16 Sample; |
58 | 58 |
59 // The value for the following constants have been derived by running VoE | 59 // The value for the following constants have been derived by running VoE |
60 // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz. | 60 // using a real ADM. The constants correspond to 10ms of mono audio at 44kHz. |
61 enum{kNumberSamples = 440}; | 61 static const int kNumberSamples = 440; |
62 enum{kNumberBytesPerSample = sizeof(Sample)}; | 62 static const int kNumberBytesPerSample = sizeof(Sample); |
63 | 63 |
64 // Creates a FakeAudioCaptureModule or returns NULL on failure. | 64 // Creates a FakeAudioCaptureModule or returns NULL on failure. |
65 // |process_thread| is used to push and pull audio frames to and from the | 65 // |process_thread| is used to push and pull audio frames to and from the |
66 // returned instance. Note: ownership of |process_thread| is not handed over. | 66 // returned instance. Note: ownership of |process_thread| is not handed over. |
67 static rtc::scoped_refptr<FakeAudioCaptureModule> Create( | 67 static rtc::scoped_refptr<FakeAudioCaptureModule> Create( |
68 rtc::Thread* process_thread); | 68 rtc::Thread* process_thread); |
69 | 69 |
70 // Returns the number of frames that have been successfully pulled by the | 70 // Returns the number of frames that have been successfully pulled by the |
71 // instance. Note that correctly detecting success can only be done if the | 71 // instance. Note that correctly detecting success can only be done if the |
72 // pulled frame was generated/pushed from a FakeAudioCaptureModule. | 72 // pulled frame was generated/pushed from a FakeAudioCaptureModule. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 // Protects variables that are accessed from process_thread_ and | 282 // Protects variables that are accessed from process_thread_ and |
283 // the main thread. | 283 // the main thread. |
284 mutable rtc::CriticalSection crit_; | 284 mutable rtc::CriticalSection crit_; |
285 // Protects |audio_callback_| that is accessed from process_thread_ and | 285 // Protects |audio_callback_| that is accessed from process_thread_ and |
286 // the main thread. | 286 // the main thread. |
287 rtc::CriticalSection crit_callback_; | 287 rtc::CriticalSection crit_callback_; |
288 }; | 288 }; |
289 | 289 |
290 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ | 290 #endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_ |
OLD | NEW |