OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ |
13 | 13 |
14 #include "webrtc/base/constructormagic.h" | 14 #include "webrtc/base/constructormagic.h" |
15 #include "webrtc/modules/audio_coding/neteq/packet.h" | 15 #include "webrtc/modules/audio_coding/neteq/packet.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 // Forward declarations. | 19 // Forward declarations. |
20 class DecoderDatabase; | 20 class DecoderDatabase; |
21 | 21 |
22 // This class handles splitting of payloads into smaller parts. | 22 // This class handles splitting of RED payloads into smaller parts. |
23 | 23 // Codec-specific packet splitting can be performed by |
24 // For RED and FEC the splitting is done internally. Other codecs' packets are | 24 // AudioDecoder::ParsePayload. |
25 // split by calling AudioDecoder::SplitPacket. | |
26 class PayloadSplitter { | 25 class PayloadSplitter { |
kwiberg-webrtc
2016/09/19 11:07:49
+1 for making this RedPayloadSplitter. Or PayloadS
ossu
2016/09/19 11:41:01
Acknowledged.
| |
27 public: | 26 public: |
28 enum SplitterReturnCodes { | 27 enum SplitterReturnCodes { |
29 kOK = 0, | 28 kOK = 0, |
30 kNoSplit = 1, | |
31 kFrameSplitError = -2, | |
32 kUnknownPayloadType = -3, | |
33 kRedLengthMismatch = -4, | 29 kRedLengthMismatch = -4, |
34 kFecSplitError = -5, | |
35 }; | 30 }; |
kwiberg-webrtc
2016/09/19 11:07:49
:-)
ossu
2016/09/19 11:41:01
Yeah, maybe just have RedPayloadSplitter return a
kwiberg-webrtc
2016/09/19 11:55:16
Yes. Or an enum class, but a bool should be enough
| |
36 | 31 |
37 PayloadSplitter() {} | 32 PayloadSplitter() {} |
38 | 33 |
39 virtual ~PayloadSplitter() {} | 34 virtual ~PayloadSplitter() {} |
40 | 35 |
41 // Splits each packet in |packet_list| into its separate RED payloads. Each | 36 // Splits each packet in |packet_list| into its separate RED payloads. Each |
42 // RED payload is packetized into a Packet. The original elements in | 37 // RED payload is packetized into a Packet. The original elements in |
43 // |packet_list| are properly deleted, and replaced by the new packets. | 38 // |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 | 39 // 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. | 40 // RED headers according to RFC 2198 at the very beginning of the payload. |
46 // Returns kOK or an error. | 41 // Returns kOK or an error. |
47 virtual int SplitRed(PacketList* packet_list); | 42 virtual int SplitRed(PacketList* packet_list); |
48 | 43 |
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 | 44 // 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 | 45 // comfort noise payloads are kept. Except that, only one single payload type |
57 // is accepted. Any packet with another payload type is discarded. | 46 // is accepted. Any packet with another payload type is discarded. |
58 virtual int CheckRedPayloads(PacketList* packet_list, | 47 virtual int CheckRedPayloads(PacketList* packet_list, |
59 const DecoderDatabase& decoder_database); | 48 const DecoderDatabase& decoder_database); |
60 | 49 |
61 private: | 50 private: |
62 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadSplitter); | 51 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadSplitter); |
63 }; | 52 }; |
64 | 53 |
65 } // namespace webrtc | 54 } // namespace webrtc |
66 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ | 55 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PAYLOAD_SPLITTER_H_ |
OLD | NEW |