-
Notifications
You must be signed in to change notification settings - Fork 3
/
peerthread.h
88 lines (75 loc) · 1.78 KB
/
peerthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef PEERTHREAD_H
#define PEERTHREAD_H
#include <QCoreApplication>
#include <QObject>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QTime>
#include <peer.h>
#include <globalheader.h>
#include <rundialogstorage.h>
#include <logger.h>
using namespace std;
//class Logger;
class PeerThread : public QThread
{
Q_OBJECT
private:
bool stop1=true;
QMutex mutex;
QWaitCondition condition;
p2psp::peer *peerobj;
// Logger *logger;
//SimplePlayer *simpleplayerobj;
runDialogStorage runtimeParameters;
/*Run Method Variables*/
uint16_t player_port;
string splitter_addr;
uint16_t splitter_port;
#if not defined __IMS__
int max_chunk_debt;
uint16_t team_port;
#endif
#if defined __NTS__ && not defined __monitor__
int source_port_step;
#endif
//local Variables used in Algorithm Run Method
int kbps_recvfrom;
int kbps_sendto;
int last_sendto_counter;
int last_recvfrom_counter;
#ifndef __IMS__
int last_chunk_number;
int kbps_expected_recv;
float team_ratio;
int kbps_expected_sent;
int counter;
#endif
//Used in Algorithm Run Method
void usingHeaders();
void setParameters();
void peerInitialization();
void calcBufferingTime();
void setLocalVariables();
void printCurrentTime();
void process();
void delay(int msecs);
protected:
void run();
void msleep(int ms);
public:
explicit PeerThread(QObject *parent = 0);
~PeerThread();
//Stop the video
void Stop();
//check if the player has been stopped
bool isStopped() const;
// QString filename;
signals:
void stats(int download,int upload,int totalPeers);
private slots:
//Play the Stream
void Play(runDialogStorage runParameters);
};
#endif // PEERTHREAD_H