1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_NOT_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_NOT_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/time/time.h"
11 #include "content/common/content_export.h"
12 #include "third_party/webrtc/modules/audio_device/include/audio_device.h"
16 // WebRtcAudioDeviceNotImpl contains default implementations of all methods
17 // in the webrtc::AudioDeviceModule which are currently not supported in Chrome.
18 // The real implementation is in WebRtcAudioDeviceImpl and it derives from
19 // this class. The main purpose of breaking out non-implemented methods into
20 // a separate unit is to make WebRtcAudioDeviceImpl more readable and easier
22 class CONTENT_EXPORT WebRtcAudioDeviceNotImpl
23 : NON_EXPORTED_BASE(public webrtc::AudioDeviceModule
) {
25 WebRtcAudioDeviceNotImpl();
27 // webrtc::Module implementation.
28 // TODO(henrika): it is possible to add functionality in these methods.
29 // Only adding very basic support for now without triggering any callback
30 // in the webrtc::AudioDeviceObserver interface.
31 int64_t TimeUntilNextProcess() override
;
32 int32_t Process() override
;
34 // Methods in webrtc::AudioDeviceModule which are not yet implemented.
35 // The idea is that we can move methods from this class to the real
36 // implementation in WebRtcAudioDeviceImpl when needed.
38 int32_t RegisterEventObserver(
39 webrtc::AudioDeviceObserver
* event_callback
) override
;
40 int32_t ActiveAudioLayer(AudioLayer
* audio_layer
) const override
;
41 webrtc::AudioDeviceModule::ErrorCode
LastError() const override
;
42 int16_t PlayoutDevices() override
;
43 int16_t RecordingDevices() override
;
44 int32_t PlayoutDeviceName(uint16_t index
,
45 char name
[webrtc::kAdmMaxDeviceNameSize
],
46 char guid
[webrtc::kAdmMaxGuidSize
]) override
;
47 int32_t RecordingDeviceName(uint16_t index
,
48 char name
[webrtc::kAdmMaxDeviceNameSize
],
49 char guid
[webrtc::kAdmMaxGuidSize
]) override
;
50 int32_t SetPlayoutDevice(uint16_t index
) override
;
51 int32_t SetPlayoutDevice(WindowsDeviceType device
) override
;
52 int32_t SetRecordingDevice(uint16_t index
) override
;
53 int32_t SetRecordingDevice(WindowsDeviceType device
) override
;
54 int32_t InitPlayout() override
;
55 int32_t InitRecording() override
;
56 int32_t SetWaveOutVolume(uint16_t volume_left
,
57 uint16_t volume_right
) override
;
58 int32_t WaveOutVolume(uint16_t* volume_left
,
59 uint16_t* volume_right
) const override
;
60 int32_t InitSpeaker() override
;
61 bool SpeakerIsInitialized() const override
;
62 int32_t InitMicrophone() override
;
63 bool MicrophoneIsInitialized() const override
;
64 int32_t SpeakerVolumeIsAvailable(bool* available
) override
;
65 int32_t SetSpeakerVolume(uint32_t volume
) override
;
66 int32_t SpeakerVolume(uint32_t* volume
) const override
;
67 int32_t MaxSpeakerVolume(uint32_t* max_volume
) const override
;
68 int32_t MinSpeakerVolume(uint32_t* min_volume
) const override
;
69 int32_t SpeakerVolumeStepSize(uint16_t* step_size
) const override
;
70 int32_t MicrophoneVolumeIsAvailable(bool* available
) override
;
71 int32_t MicrophoneVolumeStepSize(uint16_t* step_size
) const override
;
72 int32_t SpeakerMuteIsAvailable(bool* available
) override
;
73 int32_t SetSpeakerMute(bool enable
) override
;
74 int32_t SpeakerMute(bool* enabled
) const override
;
75 int32_t MicrophoneMuteIsAvailable(bool* available
) override
;
76 int32_t SetMicrophoneMute(bool enable
) override
;
77 int32_t MicrophoneMute(bool* enabled
) const override
;
78 int32_t MicrophoneBoostIsAvailable(bool* available
) override
;
79 int32_t SetMicrophoneBoost(bool enable
) override
;
80 int32_t MicrophoneBoost(bool* enabled
) const override
;
81 int32_t SetStereoPlayout(bool enable
) override
;
82 int32_t StereoPlayout(bool* enabled
) const override
;
83 int32_t SetStereoRecording(bool enable
) override
;
84 int32_t StereoRecording(bool* enabled
) const override
;
85 int32_t SetRecordingChannel(const ChannelType channel
) override
;
86 int32_t RecordingChannel(ChannelType
* channel
) const override
;
87 int32_t SetPlayoutBuffer(const BufferType type
, uint16_t size_ms
) override
;
88 int32_t PlayoutBuffer(BufferType
* type
, uint16_t* size_ms
) const override
;
89 int32_t CPULoad(uint16_t* load
) const override
;
90 int32_t StartRawOutputFileRecording(
91 const char pcm_file_name_utf8
[webrtc::kAdmMaxFileNameSize
]) override
;
92 int32_t StopRawOutputFileRecording() override
;
93 int32_t StartRawInputFileRecording(
94 const char pcm_file_name_utf8
[webrtc::kAdmMaxFileNameSize
]) override
;
95 int32_t StopRawInputFileRecording() override
;
96 int32_t SetRecordingSampleRate(const uint32_t samples_per_sec
) override
;
97 int32_t SetPlayoutSampleRate(const uint32_t samples_per_sec
) override
;
98 int32_t ResetAudioDevice() override
;
99 int32_t SetLoudspeakerStatus(bool enable
) override
;
100 int32_t GetLoudspeakerStatus(bool* enabled
) const override
;
101 int32_t SetAGC(bool enable
) override
;
102 bool AGC() const override
;
103 bool BuiltInAECIsAvailable() const override
;
104 int32_t EnableBuiltInAEC(bool enable
) override
;
107 ~WebRtcAudioDeviceNotImpl() override
{};
110 base::TimeTicks last_process_time_
;
111 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceNotImpl
);
114 } // namespace content
116 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_NOT_IMPL_H_