| OLD | NEW |
| (Empty) |
| 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_PAYLOAD_SPLITTER_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ | |
| 13 | |
| 14 #include "webrtc/base/constructormagic.h" | |
| 15 #include "webrtc/modules/audio_coding/neteq/packet.h" | |
| 16 | |
| 17 namespace webrtc { | |
| 18 | |
| 19 // Forward declarations. | |
| 20 class DecoderDatabase; | |
| 21 | |
| 22 // This class handles splitting of payloads into smaller parts. | |
| 23 | |
| 24 // For RED and FEC the splitting is done internally. Other codecs' packets are | |
| 25 // split by calling AudioDecoder::SplitPacket. | |
| 26 class PayloadSplitter { | |
| 27 public: | |
| 28 enum SplitterReturnCodes { | |
| 29 kOK = 0, | |
| 30 kNoSplit = 1, | |
| 31 kFrameSplitError = -2, | |
| 32 kUnknownPayloadType = -3, | |
| 33 kRedLengthMismatch = -4, | |
| 34 kFecSplitError = -5, | |
| 35 }; | |
| 36 | |
| 37 PayloadSplitter() {} | |
| 38 | |
| 39 virtual ~PayloadSplitter() {} | |
| 40 | |
| 41 // Splits each packet in |packet_list| into its separate RED payloads. Each | |
| 42 // RED payload is packetized into a Packet. The original elements in | |
| 43 // |packet_list| are properly deleted, and replaced by the new packets. | |
| 44 // Note that all packets in |packet_list| must be RED payloads, i.e., have | |
| 45 // RED headers according to RFC 2198 at the very beginning of the payload. | |
| 46 // Returns kOK or an error. | |
| 47 virtual int SplitRed(PacketList* packet_list); | |
| 48 | |
| 49 // Iterates through |packet_list| and, duplicate each audio payload that has | |
| 50 // FEC as new packet for redundant decoding. The decoder database is needed to | |
| 51 // get information about which payload type each packet contains. | |
| 52 virtual int SplitFec(PacketList* packet_list, | |
| 53 DecoderDatabase* decoder_database); | |
| 54 | |
| 55 // Checks all packets in |packet_list|. Packets that are DTMF events or | |
| 56 // comfort noise payloads are kept. Except that, only one single payload type | |
| 57 // is accepted. Any packet with another payload type is discarded. | |
| 58 virtual int CheckRedPayloads(PacketList* packet_list, | |
| 59 const DecoderDatabase& decoder_database); | |
| 60 | |
| 61 private: | |
| 62 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadSplitter); | |
| 63 }; | |
| 64 | |
| 65 } // namespace webrtc | |
| 66 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ | |
| OLD | NEW |