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_MAKER_H 17 #define OHOS_SHARING_RTP_MAKER_H 18 19 #include <functional> 20 #include <memory> 21 #include "rtp_packet.h" 22 23 namespace OHOS { 24 namespace Sharing { 25 class RtpMaker { 26 public: 27 using Ptr = std::shared_ptr<RtpMaker>; 28 29 RtpMaker(uint32_t ssrc, size_t mtuSize, uint8_t payloadType, uint32_t sampleRate, uint16_t seq = 0); 30 ~RtpMaker(); 31 32 uint32_t GetSsrc() const; 33 size_t GetMaxSize() const; 34 RtpPacket::Ptr MakeRtp(const void *data, size_t len, bool mark, uint32_t stamp); 35 36 private: 37 uint8_t pt_ = 0; 38 uint16_t seq_ = 0; 39 uint32_t ssrc_ = 0; 40 uint32_t sampleRate_ = 0; 41 42 size_t mtuSize_ = 0; 43 }; 44 } // namespace Sharing 45 } // namespace OHOS 46 #endif