Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit d99c35a

Browse files
committed
Revert "Changes for fake audio on headless platform"
This reverts commit 61912d5. This change introduced too much code in header, and some code doesn't with 108. Revert it and apply it manually later if it's needed.
1 parent 846553f commit d99c35a

File tree

3 files changed

+10
-92
lines changed

3 files changed

+10
-92
lines changed

media/engine/webrtc_voice_engine.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "media/engine/webrtc_media_engine.h"
3434
#include "modules/async_audio_processing/async_audio_processing.h"
3535
#include "modules/audio_device/audio_device_impl.h"
36-
#include "modules/audio_device/include/fake_audio_device.h"
3736
#include "modules/audio_mixer/audio_mixer_impl.h"
3837
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
3938
#include "modules/audio_processing/include/audio_processing.h"
@@ -359,9 +358,6 @@ void WebRtcVoiceEngine::Init() {
359358
webrtc::AudioDeviceModule::kPlatformDefaultAudio, task_queue_factory_);
360359
}
361360
#endif // WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE
362-
if (!adm_) {
363-
adm_ = new rtc::RefCountedObject<webrtc::FakeAudioDeviceModule>();
364-
}
365361
RTC_CHECK(adm());
366362
webrtc::adm_helpers::Init(adm());
367363

modules/audio_device/include/audio_device_default.h

Lines changed: 10 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@
1111
#ifndef MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_
1212
#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_
1313

14-
#include "modules/audio_device/audio_device_buffer.h"
1514
#include "modules/audio_device/include/audio_device.h"
16-
#include "api/task_queue/default_task_queue_factory.h"
17-
#include "api/task_queue/task_queue_factory.h"
18-
#include "rtc_base/critical_section.h"
19-
#include "rtc_base/platform_thread.h"
20-
#include "rtc_base/time_utils.h"
21-
#include "system_wrappers/include/sleep.h"
2215

2316
namespace webrtc {
2417
namespace webrtc_impl {
@@ -29,15 +22,11 @@ namespace webrtc_impl {
2922
template <typename T>
3023
class AudioDeviceModuleDefault : public T {
3124
public:
32-
AudioDeviceModuleDefault() {
33-
task_queue_factory = webrtc::CreateDefaultTaskQueueFactory();
34-
audio_device_buffer.reset(new AudioDeviceBuffer(task_queue_factory.get()));
35-
playout_frames_in_10ms = 48000 / 100;
36-
}
25+
AudioDeviceModuleDefault() {}
3726
virtual ~AudioDeviceModuleDefault() {}
3827

3928
int32_t RegisterAudioCallback(AudioTransport* audioCallback) override {
40-
return audio_device_buffer->RegisterAudioCallback(audioCallback);
29+
return 0;
4130
}
4231
int32_t Init() override { return 0; }
4332
int32_t InitSpeaker() override { return 0; }
@@ -47,17 +36,7 @@ class AudioDeviceModuleDefault : public T {
4736
return 0;
4837
}
4938
int32_t SetStereoPlayout(bool enable) override { return 0; }
50-
int32_t StopPlayout() override {
51-
{
52-
rtc::CritScope lock(&_critSect);
53-
playing = false;
54-
}
55-
if (play_thread.get()) {
56-
play_thread->Stop();
57-
play_thread.reset();
58-
}
59-
return 0;
60-
}
39+
int32_t StopPlayout() override { return 0; }
6140
int32_t InitMicrophone() override { return 0; }
6241
int32_t SetRecordingDevice(uint16_t index) override { return 0; }
6342
int32_t SetRecordingDevice(
@@ -86,35 +65,16 @@ class AudioDeviceModuleDefault : public T {
8665
char guid[kAdmMaxGuidSize]) override {
8766
return 0;
8867
}
89-
int32_t PlayoutIsAvailable(bool* available) override {
90-
*available = true;
91-
return 0;
92-
}
93-
int32_t InitPlayout() override {
94-
rtc::CritScope lock(&_critSect);
95-
if (audio_device_buffer.get()) {
96-
audio_device_buffer->SetPlayoutSampleRate(48000);
97-
audio_device_buffer->SetPlayoutChannels(2);
98-
}
99-
return 0;
100-
}
68+
int32_t PlayoutIsAvailable(bool* available) override { return 0; }
69+
int32_t InitPlayout() override { return 0; }
10170
bool PlayoutIsInitialized() const override { return true; }
10271
int32_t RecordingIsAvailable(bool* available) override { return 0; }
10372
int32_t InitRecording() override { return 0; }
10473
bool RecordingIsInitialized() const override { return true; }
105-
int32_t StartPlayout() override {
106-
if (playing)
107-
return 0;
108-
109-
playing = true;
110-
play_thread.reset(new rtc::PlatformThread(PlayThreadFunc,
111-
this, "fake_audio_play_thread", rtc::kRealtimePriority));
112-
play_thread->Start();
113-
return 0;
114-
}
115-
bool Playing() const override { return playing; }
74+
int32_t StartPlayout() override { return 0; }
75+
bool Playing() const override { return false; }
11676
int32_t StartRecording() override { return 0; }
117-
bool Recording() const override { return true; }
77+
bool Recording() const override { return false; }
11878
bool SpeakerIsInitialized() const override { return true; }
11979
bool MicrophoneIsInitialized() const override { return true; }
12080
int32_t SpeakerVolumeIsAvailable(bool* available) override { return 0; }
@@ -134,12 +94,12 @@ class AudioDeviceModuleDefault : public T {
13494
int32_t SetMicrophoneMute(bool enable) override { return 0; }
13595
int32_t MicrophoneMute(bool* enabled) const override { return 0; }
13696
int32_t StereoPlayoutIsAvailable(bool* available) const override {
137-
*available = true;
97+
*available = false;
13898
return 0;
13999
}
140100
int32_t StereoPlayout(bool* enabled) const override { return 0; }
141101
int32_t StereoRecordingIsAvailable(bool* available) const override {
142-
*available = true;
102+
*available = false;
143103
return 0;
144104
}
145105
int32_t StereoRecording(bool* enabled) const override { return 0; }
@@ -156,40 +116,6 @@ class AudioDeviceModuleDefault : public T {
156116

157117
int32_t GetPlayoutUnderrunCount() const override { return -1; }
158118

159-
bool PlayThreadProcess() {
160-
if (!playing)
161-
return false;
162-
int64_t current_time = rtc::TimeMillis();
163-
164-
_critSect.Enter();
165-
if (last_call_millis == 0 ||
166-
current_time - last_call_millis >= 10) {
167-
_critSect.Leave();
168-
audio_device_buffer->RequestPlayoutData(playout_frames_in_10ms);
169-
_critSect.Enter();
170-
last_call_millis = current_time;
171-
}
172-
_critSect.Leave();
173-
int64_t delta_time = rtc::TimeMillis() - current_time;
174-
if (delta_time < 10) {
175-
SleepMs(10 - delta_time);
176-
}
177-
return true;
178-
}
179-
180-
static void PlayThreadFunc(void* pThis) {
181-
AudioDeviceModuleDefault* device = static_cast<AudioDeviceModuleDefault*>(pThis);
182-
while (device->PlayThreadProcess()) {
183-
}
184-
}
185-
std::unique_ptr<AudioDeviceBuffer> audio_device_buffer;
186-
std::unique_ptr<rtc::PlatformThread> play_thread;
187-
size_t playout_frames_in_10ms;
188-
rtc::CriticalSection _critSect;
189-
bool playing = false;
190-
int64_t last_call_millis = 0;
191-
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory;
192-
193119
#if defined(WEBRTC_IOS)
194120
int GetPlayoutAudioParameters(AudioParameters* params) const override {
195121
return -1;

modules/audio_processing/audio_processing_impl.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,9 +1790,6 @@ void AudioProcessingImpl::InitializeHighPassFilter(bool forced_reset) {
17901790
}
17911791

17921792
void AudioProcessingImpl::InitializeEchoController() {
1793-
#if defined(WEBRTC_LINUX)
1794-
return;
1795-
#else
17961793
bool use_echo_controller =
17971794
echo_control_factory_ ||
17981795
(config_.echo_canceller.enabled && !config_.echo_canceller.mobile_mode);
@@ -1869,7 +1866,6 @@ void AudioProcessingImpl::InitializeEchoController() {
18691866

18701867
submodules_.echo_control_mobile.reset();
18711868
aecm_render_signal_queue_.reset();
1872-
#endif
18731869
}
18741870

18751871
void AudioProcessingImpl::InitializeGainController1() {

0 commit comments

Comments
 (0)