1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TEXT_RTP_PAYLOAD_DECODER_NODE_H
18 #define TEXT_RTP_PAYLOAD_DECODER_NODE_H
19 
20 #include <BaseNode.h>
21 #include <ImsMediaBitReader.h>
22 #include <ImsMediaDataQueue.h>
23 
24 class TextRtpPayloadDecoderNode : public BaseNode
25 {
26 public:
27     TextRtpPayloadDecoderNode(BaseSessionCallback* callback = nullptr);
28     virtual ~TextRtpPayloadDecoderNode();
29     virtual kBaseNodeId GetNodeId();
30     virtual ImsMediaResult Start();
31     virtual void Stop();
32     virtual bool IsRunTime();
33     virtual bool IsSourceNode();
34     virtual void OnDataFromFrontNode(ImsMediaSubType subtype, uint8_t* data, uint32_t size,
35             uint32_t timestamp, bool mark, uint32_t seqNum,
36             ImsMediaSubType dataType = ImsMediaSubType::MEDIASUBTYPE_UNDEFINED,
37             uint32_t arrivalTime = 0);
38     virtual void SetConfig(void* config);
39     virtual bool IsSameConfig(void* config);
40 
41 private:
42     void DecodeT140(uint8_t* data, uint32_t size, ImsMediaSubType subtype, uint32_t timestamp,
43             bool mark, uint32_t nSeqNum);
44 
45     int32_t mCodecType;
46     uint8_t mPayload[MAX_RTT_LEN];
47     ImsMediaBitReader mBitReader;
48 };
49 
50 #endif
51