/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// VoipCore is the implementatino of VoIP APIs listed in api/voip directory. // It manages a vector of AudioChannel objects where each is mapped with a // ChannelId (int) type. ChannelId is the primary key to locate a specific // AudioChannel object to operate requested VoIP API from the caller. // // This class receives required audio components from caller at construction and // owns the life cycle of them to orchestrate the proper destruction sequence. class VoipCore : public VoipEngine, public VoipBase, public VoipNetwork, public VoipCodec, public VoipDtmf, public VoipStatistics, public VoipVolumeControl { public:
VoipCore(const Environment& env,
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
rtc::scoped_refptr<AudioDeviceModule> audio_device_module,
rtc::scoped_refptr<AudioProcessing> audio_processing);
~VoipCore() override = default;
private: // Initialize ADM and default audio device if needed. // Returns true if ADM is successfully initialized or already in such state // (e.g called more than once). Returns false when ADM fails to initialize // which would presumably render further processing useless. Note that such // failure won't necessarily succeed in next initialization attempt as it // would mean changing the ADM implementation. From Android N and onwards, the // mobile app may not be able to gain microphone access when in background // mode. Therefore it would be better to delay the logic as late as possible. bool InitializeIfNeeded();
// Fetches the corresponding AudioChannel assigned with given `channel`. // Returns nullptr if not found.
rtc::scoped_refptr<AudioChannel> GetChannel(ChannelId channel_id);
// Updates AudioTransportImpl with a new set of actively sending AudioSender // (AudioEgress). This needs to be invoked whenever StartSend/StopSend is // involved by caller. Returns false when the selected audio device fails to // initialize where it can't expect to deliver any audio input sample. bool UpdateAudioTransportWithSenders();
// Synchronization for these are handled internally. const Environment env_;
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory_;
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
// Synchronization is handled internally by AudioProcessing. // Must be placed before `audio_device_module_` for proper destruction.
rtc::scoped_refptr<AudioProcessing> audio_processing_;
// Synchronization is handled internally by AudioMixer. // Must be placed before `audio_device_module_` for proper destruction.
rtc::scoped_refptr<AudioMixer> audio_mixer_;
// Synchronization is handled internally by AudioTransportImpl. // Must be placed before `audio_device_module_` for proper destruction.
std::unique_ptr<AudioTransportImpl> audio_transport_;
// Synchronization is handled internally by AudioDeviceModule.
rtc::scoped_refptr<AudioDeviceModule> audio_device_module_;
Mutex lock_;
// Member to track a next ChannelId for new AudioChannel. int next_channel_id_ RTC_GUARDED_BY(lock_) = 0;
// Container to track currently active AudioChannel objects mapped by // ChannelId.
std::unordered_map<ChannelId, rtc::scoped_refptr<AudioChannel>> channels_
RTC_GUARDED_BY(lock_);
// Boolean flag to ensure initialization only occurs once. bool initialized_ RTC_GUARDED_BY(lock_) = false;
};
} // namespace webrtc
#endif// AUDIO_VOIP_VOIP_CORE_H_
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.