      if (encoders.empty()) {
        VisionBuf buf_info = vipc_client.buffers[0];
        LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height);
  
        for (const auto &encoder_info : cam_info.encoder_infos) {
          encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height));
        }
      }
  
 
</s> remove   std::vector<std::thread> encoder_threads;
  for (const auto &cam : cameras_logged) {
    encoder_threads.push_back(std::thread(encoder_thread, &s, cam));
    s.max_waiting++;
 </s> add   std::set<VisionStreamType> streams;
  while (!do_exit) {
    streams = VisionIpcClient::getAvailableStreams("camerad", false);
    if (!streams.empty()) {
      break;
    }
    util::sleep_for(100);
  }

  if (!streams.empty()) {
    std::vector<std::thread> encoder_threads;
    for (auto stream : streams) {
      auto it = std::find_if(std::begin(cameras_logged), std::end(cameras_logged),
                             [stream](auto &cam) { return cam.stream_type == stream; });
      assert(it != std::end(cameras_logged));
      ++s.max_waiting;
      encoder_threads.push_back(std::thread(encoder_thread, &s, *it));
    }

    for (auto &t : encoder_threads) t.join(); </s> remove       if (buf_info.width > 0 && buf_info.height > 0) {
        for (const auto &encoder_info: cam_info.encoder_infos){
          encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height));
        }
      } else {
        LOGE("not initting empty encoder");
        s->max_waiting--;
        break;
 </s> add       for (const auto &encoder_info : cam_info.encoder_infos) {
        encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height)); </s> remove   for (auto &t : encoder_threads) t.join();
 </s> add 
      assert(buf_info.width > 0 && buf_info.height > 0);
      if (encoders.empty()) {
        VisionBuf buf_info = vipc_client.buffers[0];
        LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height);
      assert(buf_info.width > 0 && buf_info.height > 0);
  
        for (const auto &encoder_info : cam_info.encoder_infos) {
          encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height));
        }
      }
  
keep keep add keep keep keep keep keep keep
 encoderd: get avaiable streams from vipc server (#28935)

* get avaiable streams

* use std::thread

* assert buf size

* Update system/loggerd/encoderd.cc

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
system/loggerd/encoderd.cc