• 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_PACK_IMPL_H
17 #define OHOS_SHARING_RTP_PACK_IMPL_H
18 
19 #include <map>
20 #include "rtp_codec.h"
21 #include "rtp_def.h"
22 #include "rtp_pack.h"
23 #include "rtp_packet.h"
24 
25 namespace OHOS {
26 namespace Sharing {
27 class RtpPackImpl : public RtpPack {
28 public:
29     RtpPackImpl(uint32_t ssrc, size_t mtuSize, uint32_t sampleRate, uint8_t pt, RtpPayloadStream ps,
30                 uint32_t channels = 1);
31     ~RtpPackImpl() = default;
32 
33     void SetOnRtpPack(const OnRtpPack &cb) override;
34     void InputFrame(const Frame::Ptr &frame) override;
35 
36 private:
37     void InitEncoder();
38 
39 private:
40     uint8_t pt_ = 0;
41     uint16_t seq_ = 0;
42     uint32_t ssrc_ = 0;
43     uint32_t channels_ = 1;
44     uint32_t sampleRate_ = 0;
45 
46     size_t mtuSize_ = 0;
47 
48     RtpEncoder::Ptr rtpEncoder_ = nullptr;
49     RtpPayloadStream ps_ = RtpPayloadStream::H264;
50 };
51 } // namespace Sharing
52 } // namespace OHOS
53 #endif