Удалите элементы Video scheduler и Clock из hello_pi / hello_video / video.c, чтобы улучшить задержку - PullRequest
0 голосов
/ 02 апреля 2019

Я пишу потоковое приложение h264 с использованием Raspberry PI в качестве декодера. Я заметил, что на скорости 60 кадров в секунду у устройства была значительная задержка декодирования с использованием только кода по умолчанию, доступного по адресу hello_pi / hello_video / video.c. Я прочитал здесь: https://www.raspberrypi.org/forums/viewtopic.php?t=41584 и здесь https://www.raspberrypi.org/forums/viewtopic.php?f=67&t=235825, что одним из способов улучшить время ожидания было удаление из кода планировщика видео и компонентов часов. Я сделал все возможное, чтобы попытаться удалить эти элементы, но не могу обойти эту ошибку: «ошибка подтверждения: ilclient.c: 554: ilclient_disable_tunnel (): error == OMX_ErrorNone».

decoder->port_settings_changed = 0;
  decoder->first_packet          = 1;
  decoder->Buffer = NULL;
  memset(decoder->List,    0, sizeof(decoder->List));
  memset(decoder->Tunnel,  0, sizeof(decoder->Tunnel));
  memset(&decoder->Format, 0, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));

  bcm_host_init();

  decoder->Display = vc_dispmanx_display_open(0); //why is this zero? who knows...

  if (vc_dispmanx_display_get_info(decoder->Display, &decoder->Info)) {
    return;
  }

  decoder->Width  = decoder->Info.width;
  decoder->Height = decoder->Info.height;

  if((decoder->Client = ilclient_init()) == NULL) {
     return;
  }
  if (OMX_Init() != OMX_ErrorNone) {
     ilclient_destroy(decoder->Client);
     return;
  }
  if(ilclient_create_component(decoder->Client, &decoder->Video_Decode, "video_decode", ILCLIENT_CREATE_FLAGS_T(ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS)) != 0) {
    return;
  }
  decoder->List[0] = decoder->Video_Decode;

  if (ilclient_create_component(decoder->Client, &decoder->Video_Render, "video_render", ILCLIENT_DISABLE_ALL_PORTS) != 0) {
    return;
  }
  decoder->List[1] = decoder->Video_Render;

  set_tunnel(decoder->Tunnel,     decoder->Video_Decode,    131, decoder->Video_Render, 10);

  if (ilclient_setup_tunnel(decoder->Tunnel, 0, 0) != 0) {
    return;
  }
  ilclient_change_component_state(decoder->Video_Decode, OMX_StateExecuting);

  decoder->Format.nSize              = sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
  decoder->Format.nVersion.nVersion  = OMX_VERSION;
  decoder->Format.nPortIndex         = 130;
  decoder->Format.eCompressionFormat = OMX_VIDEO_CodingAVC;

  if (OMX_SetParameter(ILC_GET_HANDLE(decoder->Video_Decode), OMX_IndexParamVideoPortFormat, &decoder->Format) == OMX_ErrorNone &&
        ilclient_enable_port_buffers(decoder->Video_Decode, 130, NULL, NULL, NULL) == 0) {
     ilclient_change_component_state(decoder->Video_Decode, OMX_StateExecuting);
  }

Любая помощь будет принята с благодарностью!

...