tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

red_payload_splitter.h (2081B)


      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 #ifndef MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_
     12 #define MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_
     13 
     14 #include <cstddef>
     15 
     16 #include "modules/audio_coding/neteq/packet.h"
     17 
     18 namespace webrtc {
     19 
     20 class DecoderDatabase;
     21 
     22 static const size_t kRedHeaderLength = 4;  // 4 bytes RED header.
     23 static const size_t kRedLastHeaderLength =
     24    1;  // reduced size for last RED header.
     25 // This class handles splitting of RED payloads into smaller parts.
     26 // Codec-specific packet splitting can be performed by
     27 // AudioDecoder::ParsePayload.
     28 class RedPayloadSplitter {
     29 public:
     30  RedPayloadSplitter() {}
     31 
     32  virtual ~RedPayloadSplitter() {}
     33 
     34  RedPayloadSplitter(const RedPayloadSplitter&) = delete;
     35  RedPayloadSplitter& operator=(const RedPayloadSplitter&) = delete;
     36 
     37  // Splits each packet in `packet_list` into its separate RED payloads. Each
     38  // RED payload is packetized into a Packet. The original elements in
     39  // `packet_list` are properly deleted, and replaced by the new packets.
     40  // Note that all packets in `packet_list` must be RED payloads, i.e., have
     41  // RED headers according to RFC 2198 at the very beginning of the payload.
     42  // Returns kOK or an error.
     43  virtual bool SplitRed(PacketList* packet_list);
     44 
     45  // Checks all packets in `packet_list`. Packets that are DTMF events or
     46  // comfort noise payloads are kept. Except that, only one single payload type
     47  // is accepted. Any packet with another payload type is discarded.
     48  virtual void CheckRedPayloads(PacketList* packet_list,
     49                                const DecoderDatabase& decoder_database);
     50 };
     51 
     52 }  // namespace webrtc
     53 #endif  // MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_