Revision e11386c0 chunker_player/player_core.h

View differences:

chunker_player/player_core.h
7 7

  
8 8
#include <stdio.h>
9 9
#include <unistd.h>
10
#include <sys/types.h>
11
#include <sys/socket.h>
12
#include <sys/select.h>
13
#include <arpa/inet.h>
14 10
#include <microhttpd.h>
15 11
#include "external_chunk_transcoding.h"
16 12
#include "frame.h"
......
22 18
// #include <SDL_image.h>
23 19
#include <SDL_video.h>
24 20

  
21
#define QUEUE_HISTORY_SIZE (STATISTICS_WINDOW_SIZE*MAX_FPS)
22

  
25 23
typedef struct threadVal {
26 24
	int width;
27 25
	int height;
28 26
} ThreadVal;
29 27

  
28
typedef struct SStats
29
{
30
	int Lossrate;
31
	int Skiprate;
32
	int PercLossrate;
33
	int PercSkiprate;
34
	int Bitrate; // Kbits/sec
35
	int LastIFrameDistance; // distance from the last received intra-frame
36
} SStats;
37

  
38
typedef struct SHistoryElement
39
{
40
	long int ID;
41
	struct timeval Time;
42
	short int Type;
43
	int Size; // size in bytes
44
	unsigned char Status; // 0 lost; 1 played; 2 skipped
45
	SStats Statistics;
46
} SHistoryElement;
47

  
48
typedef struct SHistory
49
{
50
	SHistoryElement History[QUEUE_HISTORY_SIZE];
51
	int Index; // the position where the next history element will be inserted in
52
	int LogIndex; // the position of the next element that will be logged to file
53
	int QoEIndex; // the position of the next element that will used to evaluate QoE
54
	long int LostCount;
55
	long int PlayedCount;
56
	long int SkipCount;
57
	SDL_mutex *Mutex;
58
} SHistory;
59

  
30 60
typedef struct PacketQueue {
31 61
	AVPacketList *first_pkt;
32 62
	AVPacketList *last_pkt;
......
37 67
	int last_frame_extracted; //HINT THIS SHOULD BE MORE THAN 4 BYTES
38 68
	//total frames lost, as seen from the queue, since last queue init
39 69
	int total_lost_frames;
40
	int loss_history[LOSS_HISTORY_MAX_SIZE];
41
	int loss_history_index;
42
	//how many frames we are loosing at the moment, calculated over a short sliding time window
43
	//i.e. half a second, expressed in lost_frames/sec
44
	double instant_lost_frames;
70
	
71
	SHistory PacketHistory;
72
	
45 73
	double density;
46
	//total number of skip events, as seen from the queue, since last queue init
47
	int total_skips;
48
	int last_skips; //the valued before updating it, for computing delta
49
	int skip_history[LOSS_HISTORY_MAX_SIZE];
50
	int skip_history_index;
51
	//how many skips we are observing, calculated over a short sliding time window
52
	//i.e. half a second, expressed in skips/sec
53
	double instant_skips;
54
	int instant_window_size; //averaging window size, self-correcting based on window_seconds
55
	int instant_window_size_target;
56
	int instant_window_seconds; //we want to compute number of events in a 1sec wide window
57
	int last_window_size_update;
58 74
	char stats_message[255];
59
	int last_stats_display;
60 75
} PacketQueue;
61 76

  
62 77
AVCodecContext  *aCodecCtx;
63 78
SDL_Thread *video_thread;
79
SDL_Thread *stats_thread;
64 80
uint8_t *outbuf_audio;
65 81
// short int QueueFillingMode=1;
66 82
short int QueueStopped;
......
71 87
PacketQueue videoq;
72 88
AVPacket AudioPkt, VideoPkt;
73 89
int AVPlaying;
90
int CurrentAudioFreq;
91
int CurrentAudioSamples;
74 92

  
75 93
SDL_Rect *InitRect;
76 94
SDL_AudioSpec AudioSpecification;
......
88 106
int SaveYUV;
89 107
char YUVFileName[256];
90 108
int SaveLoss;
91
char LossTracesFilename[256];
109

  
110
char VideoTraceFilename[1024];
111
char AudioTraceFilename[1024];
112
char QoETraceFileName[1024];
113

  
114
char VideoFrameLossRateLogFilename[256];
115
char VideoFrameSkipRateLogFilename[256];
116

  
117
long int decoded_vframes;
118
long int LastSavedVFrame;
119
unsigned char LastSourceIFrameDistance;
92 120

  
93 121
int ChunkerPlayerCore_InitCodecs(int width, int height, int sample_rate, short audio_channels);
94 122
int ChunkerPlayerCore_AudioEnded();

Also available in: Unified diff