[x264-devel] nalu_process callback does not work when b_sliced_threads=0

Duc Nguyen nvduc712 at gmail.com
Sat Feb 23 09:33:45 CET 2019


Dear developers,

I am trying to use the nalu_process callback to send out NAL units as soon
as they are encoded for low-latency streaming applications. My
implementation is as follows.
void nalu_process(x264_t *h, x264_nal_t* nal, void* opaque){
  int first_mb, last_mb;
  unsigned char* dst = (unsigned char*) malloc(nal->i_payload*3/2 + 5 + 64);
  x264_nal_encode(h, dst, nal);
  if(nal->i_type == 6 || nal->i_type == 7 || nal->i_type == 8){
    first_mb = 0;
    last_mb = 0;
  }else{
    first_mb = nal->i_first_mb;
    last_mb = nal->i_last_mb;
  }
  send_packet_to_receiver(sock_send, sock_send_si_other, nal->p_payload,
nal->i_payload, fof, first_mb, last_mb);
  if(fof == 1)
    fof = 0;
}

The callback is called four times and I can get 4 NAL units consequentially
with the following settings. I guess it is 4 because my PC's CPU has 4
cores.
x264_param_default_preset(param, "ultralow", "zerolatency");
x264_param_apply_profile(param, "main");
param->b_sliced_threads=1;

However, I do not want to use sliced-based threading in my app. So, I
change the settings to:
x264_param_default_preset(param, "ultralow", "zerolatency");
x264_param_apply_profile(param, "main");
param->b_sliced_threads=0;
param->i_sliced_count = 2;

In this case, the callback is not called at all. How should I change the
settings to get the callback called if I still want b_sliced_threads = 0.

Best regards,
-- 
Duc V. Nguyen
2nd year PhD student, Computer Communications Lab., The University of Aizu,
Japan.
Email: d8182101 at u-aizu.ac.jp, nvduc712 at u-aizu.ac.jp
Homepage: https://ducnguyen712.blogspot.jp/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20190223/cb4671e8/attachment.html>


More information about the x264-devel mailing list