Break apart AudioCodingModule and AcmReceiver This change makes AudioCodingModule a pure sender and AcmReceiver a pure receiver. The Config struct is in practice no longer used by AudioCodingModule, so a new definition is included in AcmReceiver. The old definition remains in AudioCodingModule while downstream clients are being updated. Bug: webrtc:14867 Change-Id: If0d0b4214c5aa278cf6c85c5b62c6da644de20e0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291533 Reviewed-by: Tomas Lundqvist <tomasl@google.com> Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org> Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39244}
diff --git a/modules/audio_coding/include/audio_coding_module.h b/modules/audio_coding/include/audio_coding_module.h index 8b518fb..d7bee84 100644 --- a/modules/audio_coding/include/audio_coding_module.h +++ b/modules/audio_coding/include/audio_coding_module.h
@@ -64,11 +64,11 @@ AudioCodingModule() {} public: + // Deprecated. Will be deleted when downlink clients have migrated off it. struct Config { - explicit Config( - rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr); - Config(const Config&); - ~Config(); + Config() = default; + Config(const Config&) = default; + ~Config() = default; NetEq::Config neteq_config; Clock* clock; @@ -76,13 +76,12 @@ NetEqFactory* neteq_factory = nullptr; }; + static std::unique_ptr<AudioCodingModule> Create(); + // Deprecated. Will be deleted when downlink clients have migrated to the + // above method. static AudioCodingModule* Create(const Config& config); virtual ~AudioCodingModule() = default; - /////////////////////////////////////////////////////////////////////////// - // Sender - // - // `modifier` is called exactly once with one argument: a pointer to the // unique_ptr that holds the current encoder (which is null if there is no // current encoder). For the duration of the call, `modifier` has exclusive @@ -153,89 +152,9 @@ virtual int SetPacketLossRate(int packet_loss_rate) = 0; /////////////////////////////////////////////////////////////////////////// - // Receiver - // - - /////////////////////////////////////////////////////////////////////////// - // int32_t InitializeReceiver() - // Any decoder-related state of ACM will be initialized to the - // same state when ACM is created. This will not interrupt or - // effect encoding functionality of ACM. ACM would lose all the - // decoding-related settings by calling this function. - // For instance, all registered codecs are deleted and have to be - // registered again. - // - // Return value: - // -1 if failed to initialize, - // 0 if succeeded. - // - virtual int32_t InitializeReceiver() = 0; - - // Replace any existing decoders with the given payload type -> decoder map. - virtual void SetReceiveCodecs( - const std::map<int, SdpAudioFormat>& codecs) = 0; - - /////////////////////////////////////////////////////////////////////////// - // int32_t IncomingPacket() - // Call this function to insert a parsed RTP packet into ACM. - // - // Inputs: - // -incoming_payload : received payload. - // -payload_len_bytes : the length of payload in bytes. - // -rtp_info : the relevant information retrieved from RTP - // header. - // - // Return value: - // -1 if failed to push in the payload - // 0 if payload is successfully pushed in. - // - virtual int32_t IncomingPacket(const uint8_t* incoming_payload, - size_t payload_len_bytes, - const RTPHeader& rtp_header) = 0; - - /////////////////////////////////////////////////////////////////////////// - // int32_t PlayoutData10Ms( - // Get 10 milliseconds of raw audio data for playout, at the given sampling - // frequency. ACM will perform a resampling if required. - // - // Input: - // -desired_freq_hz : the desired sampling frequency, in Hertz, of the - // output audio. If set to -1, the function returns - // the audio at the current sampling frequency. - // - // Output: - // -audio_frame : output audio frame which contains raw audio data - // and other relevant parameters. - // -muted : if true, the sample data in audio_frame is not - // populated, and must be interpreted as all zero. - // - // Return value: - // -1 if the function fails, - // 0 if the function succeeds. - // - virtual int32_t PlayoutData10Ms(int32_t desired_freq_hz, - AudioFrame* audio_frame, - bool* muted) = 0; - - /////////////////////////////////////////////////////////////////////////// // statistics // - /////////////////////////////////////////////////////////////////////////// - // int32_t GetNetworkStatistics() - // Get network statistics. Note that the internal statistics of NetEq are - // reset by this call. - // - // Input: - // -network_statistics : a structure that contains network statistics. - // - // Return value: - // -1 if failed to set the network statistics, - // 0 if statistics are set successfully. - // - virtual int32_t GetNetworkStatistics( - NetworkStatistics* network_statistics) = 0; - virtual ANAStats GetANAStats() const = 0; virtual int GetTargetBitrate() const = 0;