ios没有直接得api用来封装传输rtp,但是经常有用到得接收过来得音视频数据,经过X264处理转换便可以封装为Rtp包进行直接发送。大家可以看代码:

 

 1 #include "rtpsession.h"
 2 
 3 02. #include "rtppacket.h"
 4 
 5 03. #include "rtpudpv4transmitter.h"
 6 
 7 04. #include "rtpipv4address.h"
 8 
 9 05. #include "rtpsessionparams.h"
10 
11 06. #include "rtperrors.h"
12 
13 07. 
14 
15 08. @interface VideoRTPPack : NSObject<SocketHandlerDelegate> 
16 
17 09. {
18 
19 10.         RTPSession          m_RTPSession;
20 
21 11.         
22 
23 12.         NSMutableDictionary *dicDataBuffer;
24 
25 13. }
26 
27 14. 
28 
29 15. @property(nonatomic, retain) NSMutableDictionary *dicDataBuffer;
30 
31 16. 
32 
33 17. - (id)initWithVideoRTP:(NSString *)hostIP onPort:(unsigned short)port;
34 
35 18. 
36 
37 19. - (void)createVideoRTP:(NSString *)host onPort:(unsigned short)port;
38 
39 20. 
40 
41 21. - (void)SendVideoPacket:(unsigned char*)videoData 
42 
43 22.                                         Nal:(int)_nal
44 
45 23.                                    Size:(size_t)videoDataSize 
46 
47 24.                                    User:(unsigned long)user_id
48 
49 25.                                 FrameID:(int)video_frame_id;
50 
51 26. 
52 
53 27. - (void)resendSubPacketData:(int)frameID withSubPack:(int)packID;
54 
55 28. 
56 
57 29. - (void)closeVideoRTP;
58 
59 30. 
60 
61 31. @end
View Code

相关文章:

  • 2021-05-30
  • 2021-11-20
  • 2021-08-02
  • 2021-10-27
  • 2022-12-23
  • 2021-04-29
  • 2021-09-08
  • 2021-12-22
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-04-10
  • 2021-08-19
  • 2021-05-19
相关资源
相似解决方案