Bug 1397793 - Move away from VoEExternalMedia "external" API in AudioConduit.cpp. r=dminor

This forces us to do a copy. It's not the end of the world but could be avoided.
The number of channels received is now explicit (via
`AudioFrame::num_channels_`), instead of being guessed based on the number of
samples (considering we're always dealing with 10ms of audio, and we know the
rate).

It's still coupled a bit with audio devices, but we cheat, and use a "fake audio
device", which isn't going to touch actual OS APIs.

MozReview-Commit-ID: 1Tfajkv1HQR

--HG--
extra : rebase_source : f9ed6f1beeb3745dc17c4e6264808d1918e8906c
extra : histedit_source : 4338aea961b861462caa79afab66ebaea06e40b2
This commit is contained in:
Paul Adenot 2017-10-31 17:33:42 +01:00
Родитель 43c980e20d
Коммит 42b91c9e61
4 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -17,6 +17,7 @@
// Audio Engine Includes
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_volume_control.h"
#include "webrtc/voice_engine/include/voe_codec.h"
@ -174,6 +175,7 @@ public:
explicit WebrtcAudioConduit():
mVoiceEngine(nullptr),
mFakeAudioDevice(new webrtc::FakeAudioDeviceModule()),
mTransportMonitor("WebrtcAudioConduit"),
mTransmitterTransport(nullptr),
mReceiverTransport(nullptr),
@ -297,6 +299,7 @@ private:
void DumpCodecDB() const;
webrtc::VoiceEngine* mVoiceEngine;
UniquePtr<webrtc::FakeAudioDeviceModule> mFakeAudioDevice;
mozilla::ReentrantMonitor mTransportMonitor;
RefPtr<TransportInterface> mTransmitterTransport;
RefPtr<TransportInterface> mReceiverTransport;
@ -334,6 +337,8 @@ private:
uint32_t mLastTimestamp;
webrtc::AudioFrame mAudioFrame; // for output pulls
uint32_t mSamples;
uint32_t mLastSyncLog;

Просмотреть файл

@ -2104,7 +2104,7 @@ public:
if (source_->AppendToTrack(track_id_, &segment)) {
played_ticks_ += frames;
if (MOZ_LOG_TEST(AudioLogModule(), LogLevel::Debug)) {
if (played_ticks_ > last_log_ + graph->GraphRate()) { // ~ 1 second
if (played_ticks_ > last_log_ + rate) { // ~ 1 second
MOZ_LOG(AudioLogModule(), LogLevel::Debug,
("%p: Inserting %zu samples into track %d, total = %" PRIu64,
(void*) this, frames, track_id_, played_ticks_));

Просмотреть файл

@ -27,7 +27,6 @@
// Should come from MediaEngine.h, but that's a pain to include here
// because of the MOZILLA_EXTERNAL_LINKAGE stuff.
#define WEBRTC_DEFAULT_SAMPLE_RATE 32000
#define WEBRTC_MAX_SAMPLE_RATE 48000
class nsIPrincipal;

Просмотреть файл

@ -2269,6 +2269,7 @@ PeerConnectionImpl::InsertAudioLevelForContributingSource(
break;
}
}
return NS_OK;
}