OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 callback_map_.erase(type); | 35 callback_map_.erase(type); |
36 return 0; | 36 return 0; |
37 } | 37 } |
38 WEBRTC_STUB(GetAudioFrame, (int channel, int desired_sample_rate_hz, | 38 WEBRTC_STUB(GetAudioFrame, (int channel, int desired_sample_rate_hz, |
39 AudioFrame* frame)); | 39 AudioFrame* frame)); |
40 WEBRTC_STUB(SetExternalMixing, (int channel, bool enable)); | 40 WEBRTC_STUB(SetExternalMixing, (int channel, bool enable)); |
41 | 41 |
42 // Use this to trigger the Process() callback to a registered media processor. | 42 // Use this to trigger the Process() callback to a registered media processor. |
43 // If |audio| is NULL, a zero array of the correct length will be forwarded. | 43 // If |audio| is NULL, a zero array of the correct length will be forwarded. |
44 void CallProcess(ProcessingTypes type, int16_t* audio, | 44 void CallProcess(ProcessingTypes type, int16_t* audio, |
45 int samples_per_channel, int sample_rate_hz, | 45 size_t samples_per_channel, int sample_rate_hz, |
46 int num_channels) { | 46 int num_channels) { |
47 const int length = samples_per_channel * num_channels; | 47 const size_t length = samples_per_channel * num_channels; |
48 rtc::scoped_ptr<int16_t[]> data; | 48 rtc::scoped_ptr<int16_t[]> data; |
49 if (!audio) { | 49 if (!audio) { |
50 data.reset(new int16_t[length]); | 50 data.reset(new int16_t[length]); |
51 memset(data.get(), 0, length * sizeof(data[0])); | 51 memset(data.get(), 0, length * sizeof(data[0])); |
52 audio = data.get(); | 52 audio = data.get(); |
53 } | 53 } |
54 | 54 |
55 std::map<ProcessingTypes, VoEMediaProcess*>::const_iterator it = | 55 std::map<ProcessingTypes, VoEMediaProcess*>::const_iterator it = |
56 callback_map_.find(type); | 56 callback_map_.find(type); |
57 if (it != callback_map_.end()) { | 57 if (it != callback_map_.end()) { |
58 it->second->Process(0, type, audio, samples_per_channel, sample_rate_hz, | 58 it->second->Process(0, type, audio, samples_per_channel, sample_rate_hz, |
59 num_channels == 2 ? true : false); | 59 num_channels == 2 ? true : false); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 std::map<ProcessingTypes, VoEMediaProcess*> callback_map_; | 64 std::map<ProcessingTypes, VoEMediaProcess*> callback_map_; |
65 }; | 65 }; |
66 | 66 |
67 } // namespace webrtc | 67 } // namespace webrtc |
68 | 68 |
69 #endif // WEBRTC_VOICE_ENGINE_INCLUDE_MOCK_FAKE_VOE_EXTERNAL_MEDIA_H_ | 69 #endif // WEBRTC_VOICE_ENGINE_INCLUDE_MOCK_FAKE_VOE_EXTERNAL_MEDIA_H_ |
OLD | NEW |