Home | History | Annotate | Download | only in neteq
      1 /*
      2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
     12 
     13 #include "webrtc/modules/audio_coding/neteq/accelerate.h"
     14 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
     15 #include "webrtc/modules/audio_coding/neteq/decoder_database.h"
     16 #include "webrtc/modules/audio_coding/neteq/delay_manager.h"
     17 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
     18 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
     19 #include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
     20 #include "webrtc/modules/audio_coding/neteq/expand.h"
     21 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h"
     22 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
     23 #include "webrtc/modules/audio_coding/neteq/payload_splitter.h"
     24 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
     25 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h"
     26 
     27 namespace webrtc {
     28 
     29 // Creates all classes needed and inject them into a new NetEqImpl object.
     30 // Return the new object.
     31 NetEq* NetEq::Create(const NetEq::Config& config) {
     32   BufferLevelFilter* buffer_level_filter = new BufferLevelFilter;
     33   DecoderDatabase* decoder_database = new DecoderDatabase;
     34   DelayPeakDetector* delay_peak_detector = new DelayPeakDetector;
     35   DelayManager* delay_manager =
     36       new DelayManager(config.max_packets_in_buffer, delay_peak_detector);
     37   delay_manager->SetMaximumDelay(config.max_delay_ms);
     38   DtmfBuffer* dtmf_buffer = new DtmfBuffer(config.sample_rate_hz);
     39   DtmfToneGenerator* dtmf_tone_generator = new DtmfToneGenerator;
     40   PacketBuffer* packet_buffer = new PacketBuffer(config.max_packets_in_buffer);
     41   PayloadSplitter* payload_splitter = new PayloadSplitter;
     42   TimestampScaler* timestamp_scaler = new TimestampScaler(*decoder_database);
     43   AccelerateFactory* accelerate_factory = new AccelerateFactory;
     44   ExpandFactory* expand_factory = new ExpandFactory;
     45   PreemptiveExpandFactory* preemptive_expand_factory =
     46       new PreemptiveExpandFactory;
     47   return new NetEqImpl(config,
     48                        buffer_level_filter,
     49                        decoder_database,
     50                        delay_manager,
     51                        delay_peak_detector,
     52                        dtmf_buffer,
     53                        dtmf_tone_generator,
     54                        packet_buffer,
     55                        payload_splitter,
     56                        timestamp_scaler,
     57                        accelerate_factory,
     58                        expand_factory,
     59                        preemptive_expand_factory);
     60 }
     61 
     62 }  // namespace webrtc
     63