《程序代码分析1》.doc

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《程序代码分析1》.doc

一、源代码的构建框架 实现了 RTP 与 RTCP 协议。payload type,该结构用于指定编码类型,以及与其相关的时钟速率、采样率等一些参数,参见下图。 struct _PayloadType { int type; /**< one of PAYLOAD_* macros*/ int clock_rate; /**< rtp clock rate*/ char bits_per_sample; /* in case of continuous audio data */ char *zero_pattern; int pattern_length; /* other useful information for the application*/ int normal_bitrate; /*in bit/s */ char *mime_type; /**<actually the submime, ex: pcm, pcma, gsm*/ int channels; /**< number of channels of audio */ char *recv_fmtp; /* various format parameters for the incoming stream */ char *send_fmtp; /* various format parameters for the outgoing stream */ int flags; void *user_data; }; 在代码中,不同的媒体类型有不同的 payloadtype 结构体与之对应,h263,g729,MPEG4等。 因为每种编码都有其独有的特点,而且许多参数也不一样,所以 RTP 包头中使用 payload 域标记负载的类型,一方面接收端可以就此判断负载的类型,从而选择对应的解码器进行解码播放;另一方面,代码在进行时间戳等方面的计算时可以更加方便一点。 所有系统当前支持的payload 类型都被放在一个数组中, 由全局变量 av_profile 这个结构体实例统领 除了 payloadtype 结构体外,一个更重要的结构体是 rtpsession。该结构体即是一个会话的抽象,与会话相关的各种信息都定义在该结构体上或者能够通过该结构体找到。要使用oRTP 进行媒体数据的传输,需要先创建一个会话,之后所有数据的传输都在会话上完成或 基于会话完成。rtpsession结构体的定义如下: struct _RtpSession { RtpSession *next; /* next RtpSession, when the session are enqueued by the scheduler */ int mask_pos; /* the position in the scheduler mask of RtpSession : do not move this field: it is part of the ABI since the session_set macros use it*/ struct { RtpProfile *profile; int pt; unsigned int ssrc; WaitPoint wp; int telephone_events_pt; /* the payload type used for telephony events */ } snd,rcv; unsigned int inc_ssrc_candidate; int inc_same_ssrc_count; int hw_recv_pt; /* recv payload type before jitter buffer */ int recv_buf_size; RtpSignalTable on_ssrc_changed; RtpSignalTable on_payload_type_changed; RtpSignalTable on_telephone_event_packet; RtpSignalTable on_telephone_event; RtpSignalTable on_timestamp_jump; RtpSignalTable on_network_error; RtpSignalTable on_rtcp_bye; struct _OList *signal_tables; struct _OList *eventqs; msgb_allocator_t allocator; RtpStream rtp; Rtc

文档评论(0)

iyjt + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档