linphone開發中的一個問題記錄

來源:互聯網
上載者:User

    最近在做voip相關的項目,上位機直接使用linphone進行二次開發,下位機下位機使用的是利用osip、ffmpeg開發的sip用戶端。測試時ffmpeg解碼時列印出如下警告資訊:

    Too many slices (17 >= 16), increase MAX_SLICES and recompil    Too many slices (18 >= 16), increase MAX_SLICES and recompil    Too many slices (20 >= 16), increase MAX_SLICES and recompil    ...

    相關代碼在h264.c中

    ...    h0->last_slice_type = slice_type;    h->slice_num = ++h0->current_slice;    if(h->slice_num >= MAX_SLICES){        av_log(s->avctx, AV_LOG_ERROR, "Too many slices (%d >= %d), increase MAX_SLICES and recompile\n", h->slice_num, MAX_SLICES);    }    ...

    顯然slice數超過了定義的最大值,MAX_SLICES定義

/** * The maximum number of slices supported by the decoder. * must be a power of 2 */#define MAX_SLICES 16

    嘗試增加到32時,下位機解碼出錯了,沒找到原因,所以從上位機入手。在x264的編碼參數x264_param_t中有slice相關的幾個成員

    /* Slicing parameters */    int i_slice_max_size;    /* Max size per slice in bytes; includes estimated NAL overhead. */    int i_slice_max_mbs;     /* Max number of MBs per slice; overrides i_slice_count. */    int i_slice_count;       /* Number of slices per frame: forces rectangular slices. */

    這個i_slice_count就指定了分區數量,於是到msx264.c檔案的enc_preprocess函數中,將編碼參數中的i_slice_count設定為15。但是測試發現,這根本沒用。後來在x264源碼中,找到了問題所在

    //x264/encoder.c 函數x264_validate_parameters    ...          if( h->param.i_slice_max_mbs || h->param.i_slice_max_size )            h->param.i_slice_count = 0;    ...

    從上面的代碼片斷中可以看到,只要i_slice_max_mbs和i_slice_max_size兩個值,i_slice_count就會被清0。而msx264.c的enc_preprocess函數就有下面一條語句
    

params.i_slice_max_size=ms_get_payload_max_size()-100; /*-100 security margin*/  

 
    現在真相大白,直接注釋掉上面的語句,測試通過。    

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.