• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_SHARING_RTP_UNPACK_IMPL_H
17 #define OHOS_SHARING_RTP_UNPACK_IMPL_H
18 
19 #include "rtp_codec.h"
20 #include "rtp_def.h"
21 #include "rtp_queue.h"
22 #include "rtp_unpack.h"
23 
24 namespace OHOS {
25 namespace Sharing {
26 class RtpUnpackImpl : public RtpUnpack {
27 public:
28     RtpUnpackImpl() = default;
29     RtpUnpackImpl(const RtpPlaylodParam &rpp);
30     ~RtpUnpackImpl();
31 
32     void SetSdp(const std::string &sdp);
33     void SetOnRtpUnpack(const OnRtpUnpack &cb) override;
34     void SetOnRtpNotify(const OnRtpNotify &cb) override;
35 
36     void Release() override;
37     void ParseRtp(const char *data, size_t len) override;
38 
39 private:
40     void OnRtpDecode(int32_t pt, const Frame::Ptr &frame);
41     void OnRtpSorted(uint16_t seq, const RtpPacket::Ptr &rtp);
42 
43     void CreateRtpDecoder(const RtpPlaylodParam &rpp);
44 
45 private:
46     uint16_t nextOutSeq_ = 0;
47 
48     std::map<uint8_t, RtpDecoder::Ptr> rtpDecoder_;
49     std::map<uint8_t, RtpPacketSortor::Ptr> rtpSort_;
50     std::chrono::steady_clock::time_point lastReportMissTime_ = std::chrono::steady_clock::now();
51 };
52 } // namespace Sharing
53 } // namespace OHOS
54 #endif