Changeset 2565


Ignore:
Timestamp:
Apr 2, 2009 10:41:22 AM (10 years ago)
Author:
nanang
Message:

Ticket #774: Fixed generation of G722.1 modes list in enum_codec().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/g7221.c

    r2563 r2565  
    501501                                pjmedia_codec_info codecs[]) 
    502502{ 
    503     unsigned i; 
     503    unsigned i, max_cnt; 
    504504 
    505505    PJ_ASSERT_RETURN(factory==&codec_factory.base, PJ_EINVAL); 
    506506    PJ_ASSERT_RETURN(codecs && *count > 0, PJ_EINVAL); 
    507507 
    508     *count = PJ_MIN(*count, codec_factory.mode_count); 
     508    max_cnt = *count; 
     509    *count = 0; 
    509510     
    510     for (i=0; i<*count; ++i) { 
     511    for (i=0; (i < codec_factory.mode_count) && (*count < max_cnt); ++i) 
     512    { 
    511513        if (!codec_factory.modes[i].enabled) 
    512514            continue; 
    513515 
    514         pj_bzero(&codecs[i], sizeof(pjmedia_codec_info)); 
    515         codecs[i].encoding_name = pj_str((char*)CODEC_TAG); 
    516         codecs[i].pt = codec_factory.modes[i].pt; 
    517         codecs[i].type = PJMEDIA_TYPE_AUDIO; 
    518         codecs[i].clock_rate = codec_factory.modes[i].sample_rate; 
    519         codecs[i].channel_cnt = 1; 
     516        pj_bzero(&codecs[*count], sizeof(pjmedia_codec_info)); 
     517        codecs[*count].encoding_name = pj_str((char*)CODEC_TAG); 
     518        codecs[*count].pt = codec_factory.modes[i].pt; 
     519        codecs[*count].type = PJMEDIA_TYPE_AUDIO; 
     520        codecs[*count].clock_rate = codec_factory.modes[i].sample_rate; 
     521        codecs[*count].channel_cnt = 1; 
     522 
     523        ++ *count; 
    520524    } 
    521525 
Note: See TracChangeset for help on using the changeset viewer.