ossu | a70695a | 2016-09-22 02:06:28 -0700 | [diff] [blame] | 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 WEBRTC_MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_ |
| 13 | |
ossu | a70695a | 2016-09-22 02:06:28 -0700 | [diff] [blame] | 14 | #include "webrtc/modules/audio_coding/neteq/packet.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 15 | #include "webrtc/rtc_base/constructormagic.h" |
ossu | a70695a | 2016-09-22 02:06:28 -0700 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | // Forward declarations. |
| 20 | class DecoderDatabase; |
| 21 | |
| 22 | // This class handles splitting of RED payloads into smaller parts. |
| 23 | // Codec-specific packet splitting can be performed by |
| 24 | // AudioDecoder::ParsePayload. |
| 25 | class RedPayloadSplitter { |
| 26 | public: |
| 27 | RedPayloadSplitter() {} |
| 28 | |
| 29 | virtual ~RedPayloadSplitter() {} |
| 30 | |
| 31 | // Splits each packet in |packet_list| into its separate RED payloads. Each |
| 32 | // RED payload is packetized into a Packet. The original elements in |
| 33 | // |packet_list| are properly deleted, and replaced by the new packets. |
| 34 | // Note that all packets in |packet_list| must be RED payloads, i.e., have |
| 35 | // RED headers according to RFC 2198 at the very beginning of the payload. |
| 36 | // Returns kOK or an error. |
| 37 | virtual bool SplitRed(PacketList* packet_list); |
| 38 | |
| 39 | // Checks all packets in |packet_list|. Packets that are DTMF events or |
| 40 | // comfort noise payloads are kept. Except that, only one single payload type |
| 41 | // is accepted. Any packet with another payload type is discarded. Returns |
| 42 | // the number of discarded packets. |
| 43 | virtual int CheckRedPayloads(PacketList* packet_list, |
| 44 | const DecoderDatabase& decoder_database); |
| 45 | |
| 46 | private: |
| 47 | RTC_DISALLOW_COPY_AND_ASSIGN(RedPayloadSplitter); |
| 48 | }; |
| 49 | |
| 50 | } // namespace webrtc |
| 51 | #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_RED_PAYLOAD_SPLITTER_H_ |