Revision 0cd6b05d chunker_player/player_core.c

View differences:

chunker_player/player_core.c
23 23
//int lastCheckedVideoFrame = -1;
24 24
long int last_video_frame_extracted = -1;
25 25

  
26
int timeval_subtract(struct timeval* x, struct timeval* y, struct timeval* result)
27
{
28
  // Perform the carry for the later subtraction by updating y.
29
  if (x->tv_usec < y->tv_usec)
30
  {
31
    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
32
    y->tv_usec -= 1000000 * nsec;
33
    y->tv_sec += nsec;
34
  }
35
  if (x->tv_usec - y->tv_usec > 1000000)
36
  {
37
    int nsec = (x->tv_usec - y->tv_usec) / 1000000;
38
    y->tv_usec += 1000000 * nsec;
39
    y->tv_sec -= nsec;
40
  }
41

  
42
  // Compute the time remaining to wait. tv_usec is certainly positive.
43
  result->tv_sec = x->tv_sec - y->tv_sec;
44
  result->tv_usec = x->tv_usec - y->tv_usec;
45

  
46
  // Return 1 if result is negative.
47
  return x->tv_sec < y->tv_sec;
48
}
49

  
50

  
26 51
void PacketQueueInit(PacketQueue *q, short int Type)
27 52
{
28 53
#ifdef DEBUG_QUEUE
......
1420 1445
				ChunkerPlayerStats_PrintHistoryTrace(&(audioq.PacketHistory), AudioTraceFilename);
1421 1446
				ChunkerPlayerStats_PrintHistoryTrace(&(videoq.PacketHistory), VideoTraceFilename);
1422 1447
				
1423
//				if(SilentMode != 1 && SilentMode != 2)
1448
				//if(SilentMode != 1 && SilentMode != 2)
1424 1449
					ChunkerPlayerStats_PrintContextFile();
1425 1450
			}
1426 1451

  
......
1437 1462
				char est_psnr_string[255];
1438 1463
				sprintf(est_psnr_string, "");
1439 1464
				if(qoe)
1465
				{
1440 1466
					sprintf(est_psnr_string, " - Est. Mean PSNR: %.1f db", (float)qoe);
1467
					// Publish measure into repository
1468
					MeasurementRecord r;
1469
	                strcpy(r.originator,NetworkID);
1470
	                strcpy(r.targetA,NetworkID);
1471
	                strcpy(r.targetB,"");
1472
	                strcpy(r.published_name,"PSNR");
1473
	                r.value = qoe;
1474
	                r.string_value = NULL;
1475
	                strcpy(r.channel,Channels[SelectedChannel].Title);
1476
	                gettimeofday(&(r.timestamp), NULL);
1477
	                // One update every REPO_UPDATE_INTERVALL seconds
1478
	                struct timeval ElapsedTime;
1479
	                timeval_subtract(&(r.timestamp),&LastTimeRepoPublish,&ElapsedTime);
1480
                    if(ElapsedTime.tv_sec>=REPO_UPDATE_INTERVALL)
1481
                    {
1482
                        LastTimeRepoPublish=r.timestamp;
1483
                        if(repPublish(repoclient,NULL,NULL,&r)!=NULL)
1484
                            printf("VALORE PUBBLICATO: %s  %e  %s\n",r.originator,qoe,r.channel);
1485
                    }
1486
				}
1441 1487

  
1442 1488
				sprintf(video_stats_text, "[VIDEO] qdensity: %d\%% - losses: %d/sec (%ld tot) - skips: %d/sec (%ld tot)%s", (int)video_qdensity, video_statistics.Lossrate, videoq.PacketHistory.LostCount, video_statistics.Skiprate, videoq.PacketHistory.SkipCount, est_psnr_string);
1443 1489
			}

Also available in: Unified diff