1 /*
2  *  Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_FAX_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_FAX_H_
13 
14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/modules/audio_coding/neteq/decision_logic.h"
16 #include "webrtc/typedefs.h"
17 
18 namespace webrtc {
19 
20 // Implementation of the DecisionLogic class for playout modes kPlayoutFax and
21 // kPlayoutOff.
22 class DecisionLogicFax : public DecisionLogic {
23  public:
24   // Constructor.
DecisionLogicFax(int fs_hz,size_t output_size_samples,NetEqPlayoutMode playout_mode,DecoderDatabase * decoder_database,const PacketBuffer & packet_buffer,DelayManager * delay_manager,BufferLevelFilter * buffer_level_filter)25   DecisionLogicFax(int fs_hz,
26                    size_t output_size_samples,
27                    NetEqPlayoutMode playout_mode,
28                    DecoderDatabase* decoder_database,
29                    const PacketBuffer& packet_buffer,
30                    DelayManager* delay_manager,
31                    BufferLevelFilter* buffer_level_filter)
32       : DecisionLogic(fs_hz, output_size_samples, playout_mode,
33                       decoder_database, packet_buffer, delay_manager,
34                       buffer_level_filter) {
35   }
36 
37  protected:
38   // Returns the operation that should be done next. |sync_buffer| and |expand|
39   // are provided for reference. |decoder_frame_length| is the number of samples
40   // obtained from the last decoded frame. If there is a packet available, the
41   // packet header should be supplied in |packet_header|; otherwise it should
42   // be NULL. The mode resulting form the last call to NetEqImpl::GetAudio is
43   // supplied in |prev_mode|. If there is a DTMF event to play, |play_dtmf|
44   // should be set to true. The output variable |reset_decoder| will be set to
45   // true if a reset is required; otherwise it is left unchanged (i.e., it can
46   // remain true if it was true before the call).
47   Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer,
48                                     const Expand& expand,
49                                     size_t decoder_frame_length,
50                                     const RTPHeader* packet_header,
51                                     Modes prev_mode,
52                                     bool play_dtmf,
53                                     bool* reset_decoder) override;
54 
55  private:
56   RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogicFax);
57 };
58 
59 }  // namespace webrtc
60 #endif  // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_FAX_H_
61