Changeset 440 in flair-src


Ignore:
Timestamp:
Aug 25, 2021, 4:41:21 PM (3 years ago)
Author:
Sanahuja Guillaume
Message:

up

Location:
trunk/lib/FlairCore/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/ui_com.cpp

    r439 r440  
    319319      }
    320320
     321      //test to push datas
     322      for (size_t i = 0; i < data_to_send.size(); i++) {
     323        if (data_to_send.at(i)->SendPeriod() == resume_period && data_to_send.at(i)->IsEnabled() == true) {
     324          PushDatasToSend(data_to_send.at(i));
     325        }
     326      }
     327      //end test
     328     
    321329      // on planifie la prochaine execution
    322330      for (size_t i = 0; i < data_to_send.size(); i++) {
     
    344352  }
    345353}
     354
     355
     356//called with send_mutex locked
     357//in nrt
     358//TODO: RT part has to put datas in pipe, then useer thread call this
     359void ui_com::PushDatasToSend(const SendData *data_to_send) {
     360  PushedData_t* ptr=NULL;
     361  //check if we already have one buffer for this couple period/nb_buffering
     362  for (size_t i = 0; i < PushedDatas.size(); i++) {
     363      if (PushedDatas.at(i).period==data_to_send->SendPeriod() && PushedDatas.at(i).nb_buffering==data_to_send->NbBuffering()) {
     364          Printf("match item %i, period %i nb buff %i\n",i,data_to_send->SendPeriod(),data_to_send->NbBuffering());
     365          ptr=&PushedDatas.at(i);
     366        }
     367  }
     368  //otherwire create new one
     369  if(ptr==NULL) {
     370    printf("no match\n");
     371    PushedData_t tmp;
     372    tmp.period=data_to_send->SendPeriod();
     373    tmp.nb_buffering=data_to_send->NbBuffering();
     374    tmp.size=0;
     375    tmp.buf=NULL;
     376    PushedDatas.push_back(tmp);
     377    ptr=&PushedDatas.back();
     378  }
     379   
     380  ptr->buf=(char*)realloc(ptr->buf,ptr->size+data_to_send->SendSize());
     381 
     382  data_to_send->CopyDatas(ptr->buf+ptr->size);
     383  ptr->size+=data_to_send->SendSize();
     384  Printf("nb buffered %i\n",ptr->size);
     385//TODO: savoir quand a fait tous les nb buffers
     386  Printf("pushed size %i period %i nb buffering %i\n",data_to_send->SendSize(),data_to_send->SendPeriod(),data_to_send->NbBuffering());
     387}
     388
     389
    346390#ifdef __XENO__
    347391void *ui_com::user_thread(void *arg) {
  • trunk/lib/FlairCore/src/unexported/ui_com.h

    r439 r440  
    6262  //private part, called to effectively send to udt
    6363  void SendNRT(char *buf, ssize_t size,int ttl);
     64  void PushDatasToSend(const flair::gui::SendData *data_to_send);
     65  typedef struct {
     66    char* buf;
     67    ssize_t size;
     68    uint16_t period;
     69    uint16_t nb_buffering;
     70  } PushedData_t;
     71  std::vector<PushedData_t> PushedDatas;
    6472
    6573  static int compressBuffer(char *in, ssize_t in_size, char **out,
Note: See TracChangeset for help on using the changeset viewer.