type
stringclasses 5
values | content
stringlengths 9
163k
|
|---|---|
defines
|
#define APP_IPV4_HOST_ADDR "192.168.0.20"
|
defines
|
#define APP_IPV4_SUBNET_MASK "255.255.255.0"
|
defines
|
#define APP_IPV4_DEFAULT_GATEWAY "192.168.0.254"
|
defines
|
#define APP_IPV4_PRIMARY_DNS "8.8.8.8"
|
defines
|
#define APP_IPV4_SECONDARY_DNS "8.8.4.4"
|
defines
|
#define APP_USE_SLAAC ENABLED
|
defines
|
#define APP_IPV6_LINK_LOCAL_ADDR "fe80::407"
|
defines
|
#define APP_IPV6_PREFIX "2001:db8::"
|
defines
|
#define APP_IPV6_PREFIX_LENGTH 64
|
defines
|
#define APP_IPV6_GLOBAL_ADDR "2001:db8::407"
|
defines
|
#define APP_IPV6_ROUTER "fe80::1"
|
defines
|
#define APP_IPV6_PRIMARY_DNS "2001:4860:4860::8888"
|
defines
|
#define APP_IPV6_SECONDARY_DNS "2001:4860:4860::8844"
|
functions
|
void lcdSetCursor(uint_t line, uint_t column)
{
lcdLine = MIN(line, 10);
lcdColumn = MIN(column, 20);
}
|
functions
|
void lcdPutChar(char_t c)
{
if(c == '\r')
{
lcdColumn = 0;
}
|
functions
|
else if(c == '\n')
{
lcdColumn = 0;
lcdLine++;
}
|
functions
|
else if(lcdLine < 10 && lcdColumn < 20)
{
//Display current character
LCD_DisplayChar(lcdLine * 24, lcdColumn * 16, c);
//Advance the cursor position
if(++lcdColumn >= 20)
{
lcdColumn = 0;
lcdLine++;
}
|
functions
|
void ioInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//LED configuration
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_LEDInit(LED5);
STM_EVAL_LEDInit(LED6);
//Clear LEDs
STM_EVAL_LEDOff(LED3);
STM_EVAL_LEDOff(LED4);
STM_EVAL_LEDOff(LED5);
STM_EVAL_LEDOff(LED6);
//Initialize user button
STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);
//Enable GPIOE clock
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
//Configure PE2 (PHY_RST) pin as an output
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
//Reset PHY transceiver (hard reset)
GPIO_ResetBits(GPIOE, GPIO_Pin_2);
sleep(10);
GPIO_SetBits(GPIOE, GPIO_Pin_2);
sleep(10);
}
|
functions
|
error_t smtpClientTest(void)
{
error_t error;
//Authentication information
static SmtpAuthInfo authInfo =
{
NULL, //Network interface
"smtp.gmail.com", //SMTP server name
25, //SMTP server port
"username", //User name
"password", //Password
FALSE, //Use STARTTLS rather than implicit TLS
YARROW_PRNG_ALGO, //PRNG algorithm
&yarrowContext //PRNG context
}
|
functions
|
void userTask(void *param)
{
char_t buffer[40];
//Point to the network interface
NetInterface *interface = &netInterface[0];
//Initialize LCD display
lcdSetCursor(2, 0);
printf("IPv4 Addr\r\n");
lcdSetCursor(5, 0);
printf("Press user button\r\nto run test\r\n");
//Endless loop
while(1)
{
//Display IPv4 host address
lcdSetCursor(3, 0);
printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
//User button pressed?
if(STM_EVAL_PBGetState(BUTTON_USER))
{
//SMTP client test routine
smtpClientTest();
//Wait for the user button to be released
while(STM_EVAL_PBGetState(BUTTON_USER));
}
|
functions
|
void blinkTask(void *parameters)
{
//Endless loop
while(1)
{
STM_EVAL_LEDOn(LED4);
osDelayTask(100);
STM_EVAL_LEDOff(LED4);
osDelayTask(900);
}
|
functions
|
int_t main(void)
{
error_t error;
uint_t i;
uint32_t value;
NetInterface *interface;
OsTask *task;
MacAddr macAddr;
#if (APP_USE_DHCP == DISABLED)
Ipv4Addr ipv4Addr;
#endif
#if (APP_USE_SLAAC == DISABLED)
Ipv6Addr ipv6Addr;
#endif
//Initialize kernel
osInitKernel();
//Configure debug UART
debugInit(115200);
//Start-up message
TRACE_INFO("\r\n");
TRACE_INFO("***********************************\r\n");
TRACE_INFO("*** CycloneTCP SMTP Client Demo ***\r\n");
TRACE_INFO("***********************************\r\n");
TRACE_INFO("Copyright: 2010-2015 Oryx Embedded SARL\r\n");
TRACE_INFO("Compiled: %s %s\r\n", __DATE__, __TIME__);
TRACE_INFO("Target: STM32F407\r\n");
TRACE_INFO("\r\n");
//Configure I/Os
ioInit();
//Initialize LCD display
STM32f4_Discovery_LCD_Init();
LCD_SetBackColor(Blue);
LCD_SetTextColor(White);
LCD_SetFont(&Font16x24);
LCD_Clear(Blue);
//Welcome message
lcdSetCursor(0, 0);
printf("SMTP Client Demo\r\n");
//Enable RNG peripheral clock
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
//Enable RNG
RNG_Cmd(ENABLE);
//Generate a random seed
for(i = 0; i < 32; i += 4)
{
//Wait for the RNG to contain a valid data
while(RNG_GetFlagStatus(RNG_FLAG_DRDY) == RESET);
//Get 32-bit random value
value = RNG_GetRandomNumber();
//Copy random value
seed[i] = value & 0xFF;
seed[i + 1] = (value >> 8) & 0xFF;
seed[i + 2] = (value >> 16) & 0xFF;
seed[i + 3] = (value >> 24) & 0xFF;
}
|
includes
|
#include <assert.h>
|
includes
|
#include <SDL2/SDL.h>
|
includes
|
#include <SDL2/SDL_ttf.h>
|
includes
|
#include <video/gl.h>
|
includes
|
#include <xxhash.h>
|
includes
|
#include <memtrack.h>
|
includes
|
#include <core/application.h>
|
includes
|
#include <core/audio.h>
|
defines
|
#define SDL_INIT_FLAGS (SDL_INIT_VIDEO | SDL_INIT_TIMER)
|
defines
|
#define SDL_INIT_FLAGS (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)
|
functions
|
void
application_next_state(unsigned int state) {
if (state > states_num) {
LOG_ERROR("State(%d) out of range", state);
exit(EXIT_FAILURE);
}
|
functions
|
void
application_back_state(void) {
((APP_STATE*)pop_stack(states_stack))->on_cleanup();
frame_flush();
}
|
functions
|
void
application_cleanup(void) {
configs_cleanup();
asset_close();
audio_cleanup();
video_cleanup();
while (!is_stack_empty(states_stack))
application_back_state();
delete_stack(states_stack);
}
|
functions
|
int
application_exec(const char *title, APP_STATE *states, size_t states_n) {
allstates = states;
states_num = states_n;
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
LOG_ERROR("%s\n", SDL_GetError());
return EXIT_FAILURE;
}
|
functions
|
void
application_quit(void) {
running = 0;
}
|
includes
|
#include <stdlib.h>
|
defines
|
#define FILT_Q (0.70710681186548)
|
structs
|
struct MultibandFilter
{
LRFilter* LPA;
LRFilter* HPA;
LRFilter* LPB;
LRFilter* HPB;
RBJFilter* APF;
float lowCutoff;
float highCutoff;
float sampleRate;
};
|
structs
|
struct MultibandFilterD
{
LRFilterD* LPA;
LRFilterD* HPA;
LRFilterD* LPB;
LRFilterD* HPB;
RBJFilterD* APF;
double lowCutoff;
double highCutoff;
double sampleRate;
};
|
functions
|
Error_t
MultibandFilterFree(MultibandFilter* filter)
{
LRFilterFree(filter->LPA);
LRFilterFree(filter->LPB);
LRFilterFree(filter->HPA);
LRFilterFree(filter->HPB);
RBJFilterFree(filter->APF);
if (filter)
{
free(filter);
filter = NULL;
}
|
functions
|
Error_t
MultibandFilterFreeD(MultibandFilterD* filter)
{
LRFilterFreeD(filter->LPA);
LRFilterFreeD(filter->LPB);
LRFilterFreeD(filter->HPA);
LRFilterFreeD(filter->HPB);
RBJFilterFreeD(filter->APF);
if (filter)
{
free(filter);
filter = NULL;
}
|
functions
|
Error_t
MultibandFilterFlush(MultibandFilter* filter)
{
LRFilterFlush(filter->LPA);
LRFilterFlush(filter->LPB);
LRFilterFlush(filter->HPA);
LRFilterFlush(filter->HPB);
RBJFilterFlush(filter->APF);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterFlushD(MultibandFilterD* filter)
{
LRFilterFlushD(filter->LPA);
LRFilterFlushD(filter->LPB);
LRFilterFlushD(filter->HPA);
LRFilterFlushD(filter->HPB);
RBJFilterFlushD(filter->APF);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterSetLowCutoff(MultibandFilter* filter, float lowCutoff)
{
filter->lowCutoff = lowCutoff;
LRFilterSetParams(filter->LPA, LOWPASS, lowCutoff, FILT_Q);
LRFilterSetParams(filter->HPA, HIGHPASS, lowCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterSetLowCutoffD(MultibandFilterD* filter, double lowCutoff)
{
filter->lowCutoff = lowCutoff;
LRFilterSetParamsD(filter->LPA, LOWPASS, lowCutoff, FILT_Q);
LRFilterSetParamsD(filter->HPA, HIGHPASS, lowCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterSetHighCutoff(MultibandFilter* filter, float highCutoff)
{
filter->highCutoff = highCutoff;
LRFilterSetParams(filter->LPB, LOWPASS, highCutoff, FILT_Q);
LRFilterSetParams(filter->HPB, HIGHPASS, highCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterSetHighCutoffD(MultibandFilterD* filter, double highCutoff)
{
filter->highCutoff = highCutoff;
LRFilterSetParamsD(filter->LPB, LOWPASS, highCutoff, FILT_Q);
LRFilterSetParamsD(filter->HPB, HIGHPASS, highCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterUpdate(MultibandFilter* filter,
float lowCutoff,
float highCutoff)
{
filter->lowCutoff = lowCutoff;
filter->highCutoff = highCutoff;
LRFilterSetParams(filter->LPA, LOWPASS, lowCutoff, FILT_Q);
LRFilterSetParams(filter->HPA, HIGHPASS, lowCutoff, FILT_Q);
LRFilterSetParams(filter->LPB, LOWPASS, highCutoff, FILT_Q);
LRFilterSetParams(filter->HPB, HIGHPASS, highCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterUpdateD(MultibandFilterD* filter,
double lowCutoff,
double highCutoff)
{
filter->lowCutoff = lowCutoff;
filter->highCutoff = highCutoff;
LRFilterSetParamsD(filter->LPA, LOWPASS, lowCutoff, FILT_Q);
LRFilterSetParamsD(filter->HPA, HIGHPASS, lowCutoff, FILT_Q);
LRFilterSetParamsD(filter->LPB, LOWPASS, highCutoff, FILT_Q);
LRFilterSetParamsD(filter->HPB, HIGHPASS, highCutoff, FILT_Q);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterProcess(MultibandFilter* filter,
float* lowOut,
float* midOut,
float* highOut,
const float* inBuffer,
unsigned n_samples)
{
float tempLow[n_samples];
float tempHi[n_samples];
LRFilterProcess(filter->LPA, tempLow, inBuffer, n_samples);
LRFilterProcess(filter->HPA, tempHi, inBuffer, n_samples);
RBJFilterProcess(filter->APF, lowOut, tempLow, n_samples);
LRFilterProcess(filter->LPB, midOut, tempHi, n_samples);
LRFilterProcess(filter->HPB, highOut, tempHi, n_samples);
return NOERR;
}
|
functions
|
Error_t
MultibandFilterProcessD(MultibandFilterD* filter,
double* lowOut,
double* midOut,
double* highOut,
const double* inBuffer,
unsigned n_samples)
{
double tempLow[n_samples];
double tempHi[n_samples];
LRFilterProcessD(filter->LPA, tempLow, inBuffer, n_samples);
LRFilterProcessD(filter->HPA, tempHi, inBuffer, n_samples);
RBJFilterProcessD(filter->APF, lowOut, tempLow, n_samples);
LRFilterProcessD(filter->LPB, midOut, tempHi, n_samples);
LRFilterProcessD(filter->HPB, highOut, tempHi, n_samples);
return NOERR;
}
|
includes
|
#include<stdio.h>
|
includes
|
#include<unistd.h>
|
includes
|
#include<stdlib.h>
|
includes
|
#include<string.h>
|
main
|
int main(){
int pid1,pid2,pid3,pid4;
int p1[2],p2[2];
char bufr[30],rev[30];
int countL=0,countU=0,i=-1,j=0,countV=0,len;
pipe(p1);
pipe(p2);
if(pid1=fork()==0){
if(pid2=fork()==0){
read(p2[0],bufr,sizeof(bufr));
len=strlen(bufr);
for(i=len-1,j=0;j<len;i--,j++)
rev[j]=bufr[i];
rev[j]='\0';
printf("Proccess D---- Reverse = %s \n",rev);
exit(1);
}
|
includes
|
#include <unistd.h>
|
functions
|
int del_cur(t_read **root, t_read *cur, int continu)
{
t_read *tmp;
if (cur == *root)
*root = GNL_NXT;
else
{
tmp = *root;
while (tmp->nxt != cur)
tmp = tmp->nxt;
tmp->nxt = GNL_NXT;
}
|
functions
|
int line_from_lst(char **line, t_read **root, int const fd)
{
t_read *cur;
t_read *tmp;
size_t i;
cur = *root;
while (GNL_FD != fd)
cur = GNL_NXT;
i = 0;
while (cur && GNL_FD == fd)
{
while (GNL_IDX < GNL_SZE && GNL_BUF[GNL_IDX] != CHAR)
(*line)[i++] = GNL_BUF[GNL_IDX++];
if (GNL_BUF[GNL_IDX] == CHAR && ++GNL_IDX >= GNL_SZE)
return (del_cur(root, cur, 1));
if (GNL_IDX < GNL_SZE)
return (1);
tmp = GNL_NXT;
if (GNL_IDX >= GNL_SZE)
del_cur(root, cur, 1);
cur = tmp;
}
|
functions
|
int find_endl(char **line, t_read **root, t_read *cur, int continu)
{
t_read *tmp;
size_t len;
len = GNL_IDX;
while (len < GNL_SZE && (unsigned char)GNL_BUF[len] != (unsigned char)CHAR)
len++;
if (!continu || (unsigned char)GNL_BUF[len] == (unsigned char)CHAR)
{
len -= GNL_IDX;
tmp = *root;
while (tmp->fd != GNL_FD)
tmp = tmp->nxt;
while (tmp != cur && (len += tmp->sze))
tmp = tmp->nxt;
if (!continu && len == 0)
return (del_cur(root, cur, continu));
if (!(*line = (char*)ft_memalloc(sizeof(char) * (len + 1))))
return (-1);
return (line_from_lst(line, root, GNL_FD));
}
|
functions
|
int get_next_line(int const fd, char **line)
{
size_t ret;
static t_read *root = NULL;
t_read *cur;
if (!line || (*line = NULL))
return (-1);
cur = root;
while (cur && GNL_FD != fd)
cur = GNL_NXT;
if (cur && GNL_FD == fd && (ret = find_endl(line, &root, cur, 1)))
return (ret);
while (cur && GNL_FD == fd && GNL_NXT)
cur = GNL_NXT;
while (1)
{
if (root && !(cur = new_read(&cur, fd)))
return (-1);
if (!root && !(cur = new_read(&root, fd)))
return (-1);
if (!GNL_SZE)
return (find_endl(line, &root, cur, 0));
if ((ret = find_endl(line, &root, cur, 1)))
return (ret);
}
|
includes
|
#include <math.h>
|
includes
|
#include <stdio.h>
|
includes
|
#include <pthread.h>
|
includes
|
#include <stdlib.h>
|
defines
|
#define THREAD_COUNT 4
|
main
|
int main() {
pthread_t threads[THREAD_COUNT];
int arg_start = 0;
for (int i = 0; i < THREAD_COUNT; i++) {
range_t *curr_range = (range_t*)malloc(sizeof(range_t));
curr_range->start = arg_start;
curr_range->end = arg_start + 25000000;
int res = pthread_create(&threads[i], NULL, calculate_range, curr_range);
if (res != 0) {
perror("Could not spawn new thread");
exit(-1);
}
|
defines
|
#define CACHE_SIZE 1024
|
defines
|
#define INDEX(i) ((i) % CACHE_SIZE)
|
functions
|
void real_video_clean_frame(cf_session_t* session, frame_cache_t* c, cf_frame_t* frame)
{
int i;
if (frame->seg_number == 0)
return;
for (i = 0; i < frame->seg_number; ++i){
if (frame->segments[i] != NULL){
slab_free(session->mem, frame->segments[i]);
frame->segments[i] = NULL;
}
|
functions
|
void close_real_video_cache(cf_session_t* s, frame_cache_t* cache)
{
uint32_t i;
for (i = 0; i < cache->size; ++i)
real_video_clean_frame(s, cache, &cache->frames[i]);
free(cache->frames);
free(cache);
}
|
functions
|
void reset_real_video_cache(cf_session_t* s, frame_cache_t* cache)
{
uint32_t i;
for (i = 0; i < cache->size; ++i)
real_video_clean_frame(s, cache, &cache->frames[i]);
cache->min_fid = 0;
cache->max_fid = 0;
cache->play_ts = 0;
cache->frame_ts = 0;
cache->max_ts = 100;
cache->frame_timer = 100;
cache->state = buffer_waiting;
cache->wait_timer = SU_MAX(100, s->proc->rtt + 2 * s->proc->rtt_val);
cache->loss_flag = 0;
}
|
functions
|
void real_video_evict_frame(cf_session_t* s, frame_cache_t* c, uint32_t fid)
{
uint32_t pos, i;
for (pos = c->max_fid + 1; pos <= fid; pos++)
real_video_clean_frame(s, c, &c->frames[INDEX(pos)]);
if (fid < c->min_fid + c->size)
return;
for (pos = c->min_fid + 1; pos < c->max_fid; ++pos){
if (c->frames[INDEX(pos)].frame_type == 1)
break;
}
|
functions
|
int real_video_cache_put(cf_session_t* s, frame_cache_t* c, cf_seg_video_t* seg)
{
cf_frame_t* frame;
int ret = -1;
if (seg->index >= seg->total){
assert(0);
return ret;
}
|
functions
|
void real_video_cache_check_playing(cf_session_t* s, frame_cache_t* c)
{
uint64_t max_ts, min_ts;
if (c->max_fid > c->min_fid){
max_ts = c->frames[INDEX(c->max_fid)].ts;
min_ts = c->frames[INDEX(c->min_fid + 1)].ts;
if (min_ts > 0 && max_ts > min_ts + (c->wait_timer * 5 / 4) && c->max_fid >= c->min_fid + 1){
c->state = buffer_playing;
c->play_ts = GET_SYS_MS();
c->frame_ts = max_ts - (c->wait_timer * 5 / 4);
}
|
functions
|
void real_video_cache_check_waiting(cf_session_t* s, frame_cache_t* c)
{
if (c->max_fid <= c->min_fid){
c->state = buffer_waiting;
log_debug("buffer waiting ...........\n");
}
|
functions
|
int real_video_cache_check_frame_full(cf_session_t* s, cf_frame_t* frame)
{
int i;
for (i = 0; i < frame->seg_number; ++i)
if (frame->segments[i] == NULL)
return -1;
return 0;
}
|
functions
|
void real_video_cache_sync_timestamp(cf_session_t* s, frame_cache_t* c)
{
uint64_t cur_ts = GET_SYS_MS();
if (cur_ts > c->play_ts){
c->frame_ts = (uint32_t)(cur_ts - c->play_ts) + c->frame_ts;
c->play_ts = cur_ts;
}
|
functions
|
int real_video_cache_get(cf_session_t* s, frame_cache_t* c, uint8_t* data, size_t* sizep)
{
uint32_t pos;
size_t size;
int ret, i;
cf_frame_t* frame;
uint64_t max_ts;
if (c->state == buffer_waiting)
real_video_cache_check_playing(s, c);
else
real_video_cache_check_waiting(s, c);
if (c->state != buffer_playing){
size = 0;
ret = -1;
goto err;
}
|
functions
|
uint32_t real_video_cache_get_min_seq(cf_session_t* s, frame_cache_t* c)
{
int i;
cf_frame_t* frame;
cf_seg_video_t* seg;
frame = &c->frames[INDEX(c->min_fid)];
for (i = 0; i < frame->seg_number; ++i){
seg = frame->segments[i];
if (seg != NULL)
return seg->seq - seg->index - 1;
}
|
functions
|
void loss_free(skiplist_item_t key, skiplist_item_t val)
{
free(val.ptr);
}
|
functions
|
void destroy_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r)
{
if (r == NULL)
return;
assert(r->cache && r->loss);
skiplist_destroy(r->loss);
close_real_video_cache(s, r->cache);
free(r);
}
|
functions
|
void reset_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r)
{
reset_real_video_cache(s, r->cache);
skiplist_clear(r->loss);
r->base_uid = 0;
r->base_seq = 0;
r->actived = 0;
r->max_seq = 0;
r->ack_ts = GET_SYS_MS();
r->active_ts = r->ack_ts;
r->loss_count = 0;
}
|
functions
|
int active_video_real_buffer(cf_session_t* s, cf_video_real_buffer_t* r, uint32_t start_seq, uint16_t rate, uint32_t base_uid)
{
if (r->actived == 1)
return -1;
if (start_seq > 0){
r->base_seq = start_seq;
r->max_seq = r->base_seq;
}
|
functions
|
void video_real_buffer_update_loss(cf_session_t* s, cf_video_real_buffer_t* r, uint32_t seq)
{
uint32_t i;
skiplist_item_t key, val;
skiplist_iter_t* iter;
key.u32 = seq;
skiplist_remove(r->loss, key);
for (i = r->max_seq + 1; i < seq; ++i){
key.u32 = i;
iter = skiplist_search(r->loss, key);
if (iter == NULL){
wb_loss_t* l = calloc(1, sizeof(wb_loss_t));
l->ts = GET_SYS_MS() - s->proc->rtt;
l->count = 0;
val.ptr = l;
skiplist_insert(r->loss, key, val);
}
|
functions
|
void video_send_segment(cf_session_t* s, cf_segment_ack_t* ack)
{
cf_header_t header;
CF_INIT_HEADER(header, SEG_ACK, s->rid, s->uid);
cf_encode_msg(&s->sstrm, &header, ack);
processor_send(s, s->proc, &s->sstrm, &s->proc->server_node);
}
|
functions
|
void video_real_ack(cf_session_t* s, cf_video_real_buffer_t* r, int hb)
{
uint64_t cur_ts;
cf_segment_ack_t ack;
skiplist_iter_t* iter;
skiplist_item_t key;
wb_loss_t* l;
uint32_t min_seq, delay;
int max_count = 0;
cur_ts = GET_SYS_MS();
if (r->ack_ts + 10 < cur_ts){
min_seq = real_video_cache_get_min_seq(s, r->cache);
if (min_seq > r->base_seq){
for (key.u32 = r->base_seq + 1; key.u32 <= min_seq; ++key.u32)
skiplist_remove(r->loss, key);
r->base_seq = min_seq;
}
|
functions
|
int video_real_video_put(cf_session_t* s, cf_video_real_buffer_t* r, cf_seg_video_t* seg)
{
uint32_t seq;
cf_seg_video_t* tmp;
if (r->max_seq == 0 && seg->ftype == 0)
return -1;
seq = seg->seq;
if (r->actived == 0 || seg->seq <= r->base_seq || (r->max_seq > 0 && seq > r->max_seq + 2000)){
return -1;
}
|
functions
|
int video_real_video_get(cf_session_t* s, cf_video_real_buffer_t* r, uint8_t* data, size_t* sizep)
{
if (r->actived == 0)
return -1;
return real_video_cache_get(s, r->cache, data, sizep);
}
|
functions
|
void video_real_video_timer(cf_session_t* s, cf_video_real_buffer_t* r)
{
video_real_ack(s, r, 1);
if (r->cache_ts + SU_MAX(s->proc->rtt + s->proc->rtt_val, 1000) < GET_SYS_MS()){
if (r->loss_count == 0)
r->cache->wait_timer = SU_MAX(r->cache->wait_timer * 7 / 8, r->cache->frame_timer);
else if (r->cache->wait_timer > 2 * (s->proc->rtt + s->proc->rtt_val))
r->cache->wait_timer = SU_MAX(r->cache->wait_timer * 15 / 16, r->cache->frame_timer);
r->cache_ts = GET_SYS_MS();
r->loss_count = 0;
}
|
includes
|
#include <avro/platform.h>
|
includes
|
#include <stdlib.h>
|
includes
|
#include <string.h>
|
includes
|
#include <stdio.h>
|
defines
|
#define AVRO_RESOLVER_DEBUG 0
|
defines
|
#define AVRO_DEBUG(...) \
|
defines
|
#define AVRO_DEBUG(...) /* don't print messages */
|
defines
|
#define avro_resolved_reader_calculate_size(iface) \
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.