aboutsummaryrefslogtreecommitdiffstats
path: root/Adaptation/IAdaptationLogic.h
blob: 081366dd11b0c9caa6cd6ba89d4ab590d9a013b7 (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * IAdaptationLogic.h
 *****************************************************************************
 * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
 *
 * Email: libdash-dev@vicky.bitmovin.net
 *
 * This source code and its use and distribution, is subject to the terms
 * and conditions of the applicable license agreement.
 *****************************************************************************/

#ifndef LIBDASH_FRAMEWORK_ADAPTATION_IADAPTATIONLOGIC_H_
#define LIBDASH_FRAMEWORK_ADAPTATION_IADAPTATIONLOGIC_H_
#include "../Input/MediaObject.h"
#include "../Input/DASHReceiver.h"
#include "IRepresentation.h"
#include "../Managers/IMultimediaManagerBase.h"

namespace libdash
{
namespace framework
{
namespace input
{
class DASHReceiver;
}
namespace adaptation
{
//#define START __LINE__
//ADAPTATIONLOGIC Count is an hack to have the number of adaptation logic that we can use
#define FOREACH_ADAPTATIONLOGIC(ADAPTATIONLOGIC) \
    ADAPTATIONLOGIC(AlwaysLowest)  \
    ADAPTATIONLOGIC(RateBased)  \
    ADAPTATIONLOGIC(BufferBased)  \
    ADAPTATIONLOGIC(BufferRateBased)  \
    ADAPTATIONLOGIC(BufferBasedThreeThreshold)  \
    ADAPTATIONLOGIC(Panda) \
    ADAPTATIONLOGIC(Bola)  \
    ADAPTATIONLOGIC(Count)  \


#define GENERATE_ENUM(ENUM) ENUM,
#define GENERATE_STRING(STRING) #STRING,

enum LogicType {
    FOREACH_ADAPTATIONLOGIC(GENERATE_ENUM)
};

static const char *LogicType_string[] = {
    FOREACH_ADAPTATIONLOGIC(GENERATE_STRING)
};

class IAdaptationLogic
{
public:
    virtual ~IAdaptationLogic() {}

    virtual uint32_t getPosition() = 0;
    virtual void setPosition(uint32_t segmentNumber) = 0;
    virtual dash::mpd::IRepresentation* getRepresentation() = 0;
//    virtual void setRepresentation(dash::mpd::IPeriod *period,
//                                                             dash::mpd::IAdaptationSet *adaptationSet,
//                                                             dash::mpd::IRepresentation *representation)= 0;
    virtual LogicType getType() = 0;
    virtual bool isUserDependent()= 0;
    virtual void bitrateUpdate(uint64_t bps, uint32_t segNum) = 0;
    virtual void dLTimeUpdate(double time) = 0;
    virtual void bufferUpdate(uint32_t bufferfillstate, int maxC) = 0;
    virtual bool isRateBased() = 0;
    virtual bool isBufferBased() = 0;
    virtual void setMultimediaManager(viper::managers::IMultimediaManagerBase *mmManager)= 0;
    virtual void onEOS(bool value) = 0;
    virtual void checkedByDASHReceiver() = 0;
//    virtual void updateMPD(dash::mpd::IMPD* mpd) = 0;
};

struct AdaptationParameters
{
    int segmentBufferSize;
    double segmentDuration;

    //RATE BASED
    double	Rate_Alpha;

    //BUFFER BASED
    int	BufferBased_reservoirThreshold;
    int	BufferBased_maxThreshold;

    //BOLA
    double	Bola_Alpha;
    double	Bola_bufferTargetSeconds;

    //ADAPTECH
    double	Adaptech_Alpha;
    int	Adaptech_FirstThreshold;
    int	Adaptech_SecondThreshold;
    int	Adaptech_SwitchUpThreshold;
    double 	Adaptech_SlackParameter;

    //BUFFER  THREE THRESHOLDS
    int	BufferThreeThreshold_FirstThreshold;
    int	BufferThreeThreshold_SecondThreshold;
    int	BufferThreeThreshold_ThirdThreshold;
    double 	BufferThreeThreshold_slackParameter;
    //PANDA
    double	Panda_Alpha;
    double	Panda_Beta;
    double	Panda_Bmin;
    double	Panda_K;
    double	Panda_W;
    double	Panda_Epsilon;
};
}
}
}
#endif /* LIBDASH_FRAMEWORK_ADAPTATION_IADAPTATIONLOGIC_H_ */