Ignore:
Timestamp:
Dec 10, 2010 11:04:30 AM (13 years ago)
Author:
bennylp
Message:

Migration of current video works from private repository to this repository. This closed #1176

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/master_port.c

    r3214 r3392  
    5757    unsigned samples_per_frame; 
    5858    unsigned bytes_per_frame; 
     59    pjmedia_audio_format_detail *u_afd, *d_afd; 
    5960    pj_status_t status; 
    6061 
     
    6263    PJ_ASSERT_RETURN(pool && u_port && d_port && p_m, PJ_EINVAL); 
    6364 
     65    u_afd = pjmedia_format_get_audio_format_detail(&u_port->info.fmt, PJ_TRUE); 
     66    d_afd = pjmedia_format_get_audio_format_detail(&d_port->info.fmt, PJ_TRUE); 
    6467 
    6568    /* Both ports MUST have equal clock rate */ 
    66     PJ_ASSERT_RETURN(u_port->info.clock_rate == d_port->info.clock_rate, 
     69    PJ_ASSERT_RETURN(u_afd->clock_rate == d_afd->clock_rate, 
    6770                     PJMEDIA_ENCCLOCKRATE); 
    6871 
    6972    /* Both ports MUST have equal samples per frame */ 
    70     PJ_ASSERT_RETURN(u_port->info.samples_per_frame== 
    71                      d_port->info.samples_per_frame, 
     73    PJ_ASSERT_RETURN(PJMEDIA_PIA_SPF(&u_port->info)== 
     74                        PJMEDIA_PIA_SPF(&d_port->info), 
    7275                     PJMEDIA_ENCSAMPLESPFRAME); 
    7376 
    7477    /* Both ports MUST have equal channel count */ 
    75     PJ_ASSERT_RETURN(u_port->info.channel_count == d_port->info.channel_count, 
     78    PJ_ASSERT_RETURN(u_afd->channel_count == d_afd->channel_count, 
    7679                     PJMEDIA_ENCCHANNEL); 
    7780 
    7881 
    7982    /* Get clock_rate and samples_per_frame from one of the port. */ 
    80     clock_rate = u_port->info.clock_rate; 
    81     samples_per_frame = u_port->info.samples_per_frame; 
    82     channel_count = u_port->info.channel_count; 
     83    clock_rate = u_afd->clock_rate; 
     84    samples_per_frame = PJMEDIA_PIA_SPF(&u_port->info); 
     85    channel_count = u_afd->channel_count; 
    8386 
    8487 
     
    8689     * buffer. We take the larger size of the two ports. 
    8790     */ 
    88     bytes_per_frame = u_port->info.bytes_per_frame; 
    89     if (d_port->info.bytes_per_frame > bytes_per_frame) 
    90         bytes_per_frame = d_port->info.bytes_per_frame; 
     91    bytes_per_frame = PJMEDIA_AFD_AVG_FSZ(u_afd); 
     92    if (PJMEDIA_AFD_AVG_FSZ(d_afd) > bytes_per_frame) 
     93        bytes_per_frame = PJMEDIA_AFD_AVG_FSZ(d_afd); 
    9194 
    9295 
     
    208211    PJ_ASSERT_RETURN(m && port, PJ_EINVAL); 
    209212 
     213    /* Only supports audio for now */ 
     214    PJ_ASSERT_RETURN(port->info.fmt.type==PJMEDIA_TYPE_AUDIO, PJ_ENOTSUP); 
     215 
    210216    /* If we have downstream port, make sure they have matching samples per 
    211217     * frame. 
     
    213219    if (m->d_port) { 
    214220        PJ_ASSERT_RETURN( 
    215             port->info.clock_rate/port->info.samples_per_frame== 
    216             m->d_port->info.clock_rate/m->d_port->info.samples_per_frame, 
     221            PJMEDIA_PIA_PTIME(&port->info) == 
     222                PJMEDIA_PIA_PTIME(&m->d_port->info), 
    217223            PJMEDIA_ENCSAMPLESPFRAME 
    218224        ); 
     
    246252{ 
    247253    PJ_ASSERT_RETURN(m && port, PJ_EINVAL); 
     254 
     255    /* Only supports audio for now */ 
     256    PJ_ASSERT_RETURN(port->info.fmt.type==PJMEDIA_TYPE_AUDIO, PJ_ENOTSUP); 
    248257 
    249258    /* If we have upstream port, make sure they have matching samples per 
     
    252261    if (m->u_port) { 
    253262        PJ_ASSERT_RETURN( 
    254             port->info.clock_rate/port->info.samples_per_frame== 
    255             m->u_port->info.clock_rate/m->u_port->info.samples_per_frame, 
     263            PJMEDIA_PIA_PTIME(&port->info) == 
     264                    PJMEDIA_PIA_PTIME(&m->u_port->info), 
    256265            PJMEDIA_ENCSAMPLESPFRAME 
    257266        ); 
Note: See TracChangeset for help on using the changeset viewer.