本文整理汇总了C++中rtp_profile_get_payload函数的典型用法代码示例。如果您正苦于以下问题:C++ rtp_profile_get_payload函数的具体用法?C++ rtp_profile_get_payload怎么用?C++ rtp_profile_get_payload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtp_profile_get_payload函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
MSFilter *set_CODECFilter(RtpProfile *profile, int pt, int mode){
PayloadType *payload;
switch(mode){
case MEDIA_API_DECODER:
payload = rtp_profile_get_payload(profile, pt);
if(payload == NULL){
api_error("media_api: undefined payload in URL\n");
return NULL;
}
return ms_decoder_new_with_string_id(payload->mime_type);
//Commented this to include the new RtpProfile
/*if(pt != -1) return ms_decoder_new_with_pt(pt);
*else return ms_copy_new();
*/
case MEDIA_API_ENCODER:
payload = rtp_profile_get_payload(profile, pt);
if(payload == NULL){
api_error("media_api: undefined payload in URL\n");
return NULL;
}
return ms_encoder_new_with_string_id(payload->mime_type);
/*if(pt != -1) return ms_encoder_new_with_pt(pt);
*else return ms_copy_new();
*/
}
}
示例2: ms_snd_card_create_writer
bool myAudioStream::init_filters(const QString & payload)
{
/** Init filters **/
stream->soundwrite = ms_snd_card_create_writer(playcard);
RtpProfile *profile = rtp_session_get_profile(stream->session);
PayloadType *pt;
/* List all available payloads */
QMap<QString,int> payloads;
for (int i = 0; i < RTP_PROFILE_MAX_PAYLOADS; i++) {
pt = rtp_profile_get_payload(profile,i);
if (pt != 0) {
QString payload(pt->mime_type);
if (payloads.contains(payload)) {
payload.append(" " + QString::number(pt->clock_rate));
}
payloads.insert(payload,i);
}
}
if (!payloads.contains(payload)) {
ms_error("Could not find payload %s", payload.toStdString().c_str());
return false;
}
int payload_type_number = payloads.value(payload);
/* Create filters */
pt = rtp_profile_get_payload(profile,payload_type_number);
stream->decoder = ms_filter_create_decoder(pt->mime_type);
stream->rtprecv = ms_filter_new(MS_RTP_RECV_ID);
stream->dtmfgen = ms_filter_new(MS_DTMF_GEN_ID);
/** Configure filter options **/
/* Set payload type to use when receiving */
rtp_session_set_payload_type(stream->session, payload_type_number);
/* Set session used by rtprecv */
ms_filter_call_method(stream->rtprecv,MS_RTP_RECV_SET_SESSION,stream->session);
/* Setup soundwrite and decoder parameters */
int sr = pt->clock_rate;
int chan = pt->channels;
if (ms_filter_call_method(stream->soundwrite, MS_FILTER_SET_SAMPLE_RATE, &sr) !=0 ) {
ms_error("Problem setting sample rate on soundwrite filter!");
return false;
}
if (ms_filter_call_method(stream->soundwrite, MS_FILTER_SET_NCHANNELS, &chan) != 0) {
ms_error("Failed to set sample rate on soundwrite filter!");
return false;
}
if (ms_filter_call_method(stream->decoder, MS_FILTER_SET_SAMPLE_RATE, &sr) != 0) {
ms_error("Problem setting sample rate on decoder filter!");
return false;
}
return true;
}
示例3: rtp_profile_get_payload_from_mime
PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime)
{
int pt;
pt=rtp_profile_get_payload_number_from_mime(profile,mime);
if (pt==-1) return NULL;
else return rtp_profile_get_payload(profile,pt);
}
示例4: rtp_profile_find_payload
PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate,int channels)
{
int i;
i=rtp_profile_find_payload_number(prof,mime,rate,channels);
if (i>=0) return rtp_profile_get_payload(prof,i);
return NULL;
}
示例5: rtp_session_get_avpf_rr_interval
uint16_t rtp_session_get_avpf_rr_interval(RtpSession *session) {
PayloadType *pt = rtp_profile_get_payload(session->rcv.profile, session->rcv.pt);
PayloadTypeAvpfParams params;
if (!pt) return RTCP_DEFAULT_REPORT_INTERVAL;
params=payload_type_get_avpf_params(pt);
return (uint16_t)params.trr_interval;
}
示例6: receiver_process
static void receiver_process(MSFilter * f)
{
ReceiverData *d = (ReceiverData *) f->data;
mblk_t *m;
uint32_t timestamp;
if (d->session == NULL)
return;
if (d->reset_jb){
ms_message("Reseting jitter buffer");
rtp_session_resync(d->session);
d->reset_jb=FALSE;
}
if (d->starting){
PayloadType *pt=rtp_profile_get_payload(
rtp_session_get_profile(d->session),
rtp_session_get_recv_payload_type(d->session));
if (pt && pt->type!=PAYLOAD_VIDEO)
rtp_session_flush_sockets(d->session);
d->starting=FALSE;
}
timestamp = (uint32_t) (f->ticker->time * (d->rate/1000));
while ((m = rtp_session_recvm_with_ts(d->session, timestamp)) != NULL) {
mblk_set_timestamp_info(m, rtp_get_timestamp(m));
mblk_set_marker_info(m, rtp_get_markbit(m));
mblk_set_cseq(m, rtp_get_seqnumber(m));
rtp_get_payload(m,&m->b_rptr);
ms_queue_put(f->outputs[0], m);
}
}
示例7: init_video_streams
static void init_video_streams(video_stream_tester_t *vst1, video_stream_tester_t *vst2, bool_t avpf, bool_t one_way, OrtpNetworkSimulatorParams *params, int payload_type) {
PayloadType *pt;
create_video_stream(vst1, payload_type);
create_video_stream(vst2, payload_type);
/* Enable/disable avpf. */
pt = rtp_profile_get_payload(&rtp_profile, payload_type);
CU_ASSERT_PTR_NOT_NULL_FATAL(pt);
if (avpf == TRUE) {
payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
} else {
payload_type_unset_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
}
/* Configure network simulator. */
if ((params != NULL) && (params->enabled == TRUE)) {
rtp_session_enable_network_simulation(vst1->vs->ms.sessions.rtp_session, params);
rtp_session_enable_network_simulation(vst2->vs->ms.sessions.rtp_session, params);
}
if (one_way == TRUE) {
video_stream_set_direction(vst1->vs, VideoStreamRecvOnly);
}
CU_ASSERT_EQUAL(video_stream_start(vst1->vs, &rtp_profile, vst2->local_ip, vst2->local_rtp, vst2->local_ip, vst2->local_rtcp, payload_type, 50, vst1->cam), 0);
CU_ASSERT_EQUAL(video_stream_start(vst2->vs, &rtp_profile, vst1->local_ip, vst1->local_rtp, vst1->local_ip, vst1->local_rtcp, payload_type, 50, vst2->cam), 0);
}
示例8: get_receiver_output_fmt
static int get_receiver_output_fmt(MSFilter *f, void *arg) {
ReceiverData *d = (ReceiverData *) f->data;
MSPinFormat *pinFmt = (MSPinFormat *)arg;
PayloadType *pt = rtp_profile_get_payload(rtp_session_get_profile(d->session), rtp_session_get_send_payload_type(d->session));
pinFmt->fmt = ms_factory_get_audio_format(f->factory, pt->mime_type, pt->clock_rate, pt->channels, NULL);
return 0;
}
示例9: receiver_check_payload_type
/*returns TRUE if the packet is ok to be sent to output queue*/
static bool_t receiver_check_payload_type(MSFilter *f, ReceiverData *d, mblk_t *m){
int ptn=rtp_get_payload_type(m);
PayloadType *pt;
if (ptn==d->current_pt) return TRUE;
pt=rtp_profile_get_payload(rtp_session_get_profile(d->session), ptn);
if (pt==NULL){
ms_warning("Discarding packet with unknown payload type %i",ptn);
return FALSE;
}
if (strcasecmp(pt->mime_type,"CN")==0){
MSCngData cngdata;
uint8_t *data=NULL;
int datasize=rtp_get_payload(m, &data);
if (data){
if (datasize<= sizeof(cngdata.data)){
memcpy(cngdata.data, data, datasize);
cngdata.datasize=datasize;
ms_filter_notify(f, MS_RTP_RECV_GENERIC_CN_RECEIVED, &cngdata);
}else{
ms_warning("CN packet has unexpected size %i", datasize);
}
}
return FALSE;
}
d->current_pt = ptn;
return TRUE;
}
示例10: simple_analyzer_process_rtcp
static bool_t simple_analyzer_process_rtcp(MSQosAnalyzer *objbase, mblk_t *rtcp){
MSSimpleQosAnalyzer *obj=(MSSimpleQosAnalyzer*)objbase;
rtpstats_t *cur;
const report_block_t *rb=NULL;
bool_t got_stats=FALSE;
if (rtcp_is_SR(rtcp)){
rb=rtcp_SR_get_report_block(rtcp,0);
}else if (rtcp_is_RR(rtcp)){
rb=rtcp_RR_get_report_block(rtcp,0);
}
if (rb && report_block_get_ssrc(rb)==rtp_session_get_send_ssrc(obj->session)){
obj->curindex++;
cur=&obj->stats[obj->curindex % STATS_HISTORY];
if (obj->clockrate==0){
PayloadType *pt=rtp_profile_get_payload(rtp_session_get_send_profile(obj->session),rtp_session_get_send_payload_type(obj->session));
if (pt!=NULL) obj->clockrate=pt->clock_rate;
else return FALSE;
}
if (ortp_loss_rate_estimator_process_report_block(objbase->lre,&obj->session->rtp,rb)){
cur->lost_percentage=ortp_loss_rate_estimator_get_value(objbase->lre);
cur->int_jitter=1000.0*(float)report_block_get_interarrival_jitter(rb)/(float)obj->clockrate;
cur->rt_prop=rtp_session_get_round_trip_propagation(obj->session);
ms_message("MSSimpleQosAnalyzer: lost_percentage=%f, int_jitter=%f ms, rt_prop=%f sec",
cur->lost_percentage,cur->int_jitter,cur->rt_prop);
got_stats=TRUE;
}
}
return got_stats;
}
示例11: payload_type_fill_from_rtpmap
static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){
if (rtpmap==NULL){
PayloadType *refpt=rtp_profile_get_payload(&av_profile,payload_type_get_number(pt));
if (refpt){
pt->mime_type=ms_strdup(refpt->mime_type);
pt->clock_rate=refpt->clock_rate;
}else{
ms_error("payload number %i has no rtpmap and is unknown in AV Profile, ignored.",
payload_type_get_number(pt));
return -1;
}
}else{
char *mime=ms_strdup(rtpmap);
char *p=strchr(mime,'/');
if (p){
char *chans;
*p='\0';
p++;
chans=strchr(p,'/');
if (chans){
*chans='\0';
chans++;
pt->channels=atoi(chans);
}else pt->channels=1;
pt->clock_rate=atoi(p);
}
pt->mime_type=mime;
}
return 0;
}
示例12: rtp_session_avpf_payload_type_feature_enabled
bool_t rtp_session_avpf_payload_type_feature_enabled(RtpSession *session, unsigned char feature) {
PayloadType *pt = rtp_profile_get_payload(session->rcv.profile, session->rcv.pt);
PayloadTypeAvpfParams params;
if (!pt) return FALSE;
params = payload_type_get_avpf_params(pt);
if (params.features & feature) return TRUE;
return FALSE;
}
示例13: rtp_session_get_send_payload_type
/**
* Allocates a new rtp packet to be used to add named telephony events. The application can use
* then rtp_session_add_telephone_event() to add named events to the packet.
* Finally the packet has to be sent with rtp_session_sendm_with_ts().
*
* @param session a rtp session.
* @param start boolean to indicate if the marker bit should be set.
*
* @return a message block containing the rtp packet if successfull, NULL if the rtp session
* cannot support telephony event (because the rtp profile it is bound to does not include
* a telephony event payload type).
**/
mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start)
{
mblk_t *mp;
rtp_header_t *rtp;
PayloadType *cur_pt=rtp_profile_get_payload(session->snd.profile, rtp_session_get_send_payload_type(session));
int tev_pt = session->tev_send_pt;
if (tev_pt != -1){
PayloadType *cur_tev_pt=rtp_profile_get_payload(session->snd.profile, tev_pt);
if (!cur_tev_pt){
ortp_error("Undefined telephone-event payload type %i choosen for sending telephone event", tev_pt);
tev_pt = -1;
}else if (cur_pt && cur_tev_pt->clock_rate != cur_pt->clock_rate){
ortp_warning("Telephone-event payload type %i has clockrate %i while main audio codec has clockrate %i: this is not permitted.",
tev_pt, cur_tev_pt->clock_rate, cur_pt->clock_rate);
}
}
if (tev_pt == -1){
tev_pt = rtp_profile_find_payload_number(session->snd.profile, "telephone-event", cur_pt ? cur_pt->clock_rate : 8000, 1);
}
return_val_if_fail(tev_pt!=-1,NULL);
mp=allocb(RTP_FIXED_HEADER_SIZE+TELEPHONY_EVENTS_ALLOCATED_SIZE,BPRI_MED);
if (mp==NULL) return NULL;
rtp=(rtp_header_t*)mp->b_rptr;
rtp->version = 2;
rtp->markbit=start;
rtp->padbit = 0;
rtp->extbit = 0;
rtp->cc = 0;
rtp->ssrc = session->snd.ssrc;
/* timestamp set later, when packet is sended */
/*seq number set later, when packet is sended */
/*set the payload type */
rtp->paytype=tev_pt;
/*copy the payload */
mp->b_wptr+=RTP_FIXED_HEADER_SIZE;
return mp;
}
示例14: linphone_core_update_allocated_audio_bandwidth_in_call
static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *md, const SalStreamDescription *desc, int *used_pt){
int bw;
const MSList *elem;
RtpProfile *prof=rtp_profile_new("Call profile");
bool_t first=TRUE;
int remote_bw=0;
LinphoneCore *lc=call->core;
int up_ptime=0;
*used_pt=-1;
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
int number;
if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) {
if (desc->type==SalAudio){
linphone_core_update_allocated_audio_bandwidth_in_call(call,pt);
up_ptime=linphone_core_get_upload_ptime(lc);
}
*used_pt=payload_type_get_number(pt);
first=FALSE;
}
if (desc->bandwidth>0) remote_bw=desc->bandwidth;
else if (md->bandwidth>0) {
/*case where b=AS is given globally, not per stream*/
remote_bw=md->bandwidth;
if (desc->type==SalVideo){
remote_bw=get_video_bandwidth(remote_bw,call->audio_bw);
}
}
if (desc->type==SalAudio){
bw=get_min_bandwidth(call->audio_bw,remote_bw);
}else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw);
if (bw>0) pt->normal_bitrate=bw*1000;
else if (desc->type==SalAudio){
pt->normal_bitrate=-1;
}
if (desc->ptime>0){
up_ptime=desc->ptime;
}
if (up_ptime>0){
char tmp[40];
snprintf(tmp,sizeof(tmp),"ptime=%i",up_ptime);
payload_type_append_send_fmtp(pt,tmp);
}
number=payload_type_get_number(pt);
if (rtp_profile_get_payload(prof,number)!=NULL){
ms_warning("A payload type with number %i already exists in profile !",number);
}else
rtp_profile_set_payload(prof,number,pt);
}
return prof;
}
示例15: receiver_preprocess
static void receiver_preprocess(MSFilter * f){
ReceiverData *d = (ReceiverData *) f->data;
if (d->session){
PayloadType *pt=rtp_profile_get_payload(
rtp_session_get_profile(d->session),
rtp_session_get_recv_payload_type(d->session));
if (pt){
if (pt->type!=PAYLOAD_VIDEO)
rtp_session_flush_sockets(d->session);
}
}
}