  
        OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
  
        while (true) {
          OMX_BUFFERHEADERTYPE *out_buf = (OMX_BUFFERHEADERTYPE *)queue_pop(&this->done_out);
  
          handle_out_buf(this, out_buf);
  
          if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
            break;
 
</s> remove     OMX_BUFFERHEADERTYPE *out_buf = (OMX_BUFFERHEADERTYPE *)queue_try_pop(&this->done_out);
    if (!out_buf) {
 </s> add     OMX_BUFFERHEADERTYPE *out_buf;
    if (!this->done_out.try_pop(out_buf)) { </s> remove   while (queue_try_pop(&this->free_in)); 
  while (queue_try_pop(&this->done_out)); 
 </s> add   OMX_BUFFERHEADERTYPE *out_buf;
  while (this->free_in.try_pop(out_buf)); 
  while (this->done_out.try_pop(out_buf));  </s> remove       OMX_BUFFERHEADERTYPE* in_buf = (OMX_BUFFERHEADERTYPE *)queue_pop(&this->free_in);
 </s> add       OMX_BUFFERHEADERTYPE* in_buf = this->free_in.pop(); </s> remove   OMX_BUFFERHEADERTYPE* in_buf = (OMX_BUFFERHEADERTYPE *)queue_pop(&this->free_in);
 </s> add   OMX_BUFFERHEADERTYPE* in_buf = nullptr;
  while (!this->free_in.try_pop(in_buf, 20)) {
    if (do_exit) {
      pthread_mutex_unlock(&this->lock);
      return -1;
    }
  }
 </s> remove   queue_push(&e->free_in, (void*)buffer);
 </s> add   e->free_in.push(buffer);
        OMX_BUFFERHEADERTYPE *out_buf = this->done_out.pop();
  
        OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
  
        while (true) {
        OMX_BUFFERHEADERTYPE *out_buf = this->done_out.pop();
  
          handle_out_buf(this, out_buf);
  
          if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
            break;
keep keep keep keep replace keep keep keep keep keep
 remove cqueue, use class SafeQueue (#19774)

* class SafeQueue

* cleanup includes

* space

* add timeout

use try_poll

* add function empty() & size()

* class SafeQueue

* add timeout

use try_poll

* add function empty() & size()

* rebase master

* rebase master

* for loop

* fix bug 
selfdrive/loggerd/omx_encoder.cc