summaryrefslogtreecommitdiffstats
path: root/tinyDAV/include/tinydav/video/tdav_session_video.h
blob: a1cb7d402376eea5f08b7839ef2e8800f19a31d3 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*	
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*	
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*	
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/

/**@file tdav_session_video.h
 * @brief Video Session plugin.
 *
 * @author Mamadou Diop <diopmamadou(at)doubango.org>
 *

 */
#ifndef TINYDAV_SESSION_VIDEO_H
#define TINYDAV_SESSION_VIDEO_H

#include "tinydav_config.h"
#include "tinydav/tdav_session_av.h"

TDAV_BEGIN_DECLS

typedef enum tdav_session_video_pkt_loss_level_e
{
	tdav_session_video_pkt_loss_level_low,
	tdav_session_video_pkt_loss_level_medium,
	tdav_session_video_pkt_loss_level_high,
}
tdav_session_video_pkt_loss_level_t;

typedef struct tdav_session_video_s
{
	TDAV_DECLARE_SESSION_AV;

	struct tdav_video_jb_s* jb;
	tsk_bool_t jb_enabled;
	tsk_bool_t zero_artifacts;
	tsk_bool_t fps_changed;
	tsk_bool_t started;

	struct{
		const void* context;
		tmedia_session_rtcp_onevent_cb_f func;
	} cb_rtcpevent;

	struct{
		void* buffer;
		tsk_size_t buffer_size;

		int rotation;
        tsk_bool_t scale_rotated_frames;

		void* conv_buffer;
		tsk_size_t conv_buffer_size;

		tdav_session_video_pkt_loss_level_t pkt_loss_level;
		int32_t pkt_loss_fact;
		int32_t pkt_loss_prob_good;
		int32_t pkt_loss_prob_bad;

		uint64_t last_frame_time;

		uint8_t payload_type;
		struct tmedia_codec_s* codec;
		tsk_mutex_handle_t* h_mutex;
	} encoder;

	struct{
		void* buffer;
		tsk_size_t buffer_size;

		void* conv_buffer;
		tsk_size_t conv_buffer_size;

		// latest decoded RTP seqnum
		uint16_t last_seqnum;
		// stream is corrupted if packets are lost
		tsk_bool_t stream_corrupted;
		uint64_t stream_corrupted_since;
		uint32_t last_corrupted_timestamp;

		uint8_t codec_payload_type;
		struct tmedia_codec_s* codec;
		uint64_t codec_decoded_frames_count;
	} decoder;
	
	struct {
		tsk_size_t consumerLastWidth;
		tsk_size_t consumerLastHeight;
		struct tmedia_converter_video_s* fromYUV420;
		
		tsk_size_t producerWidth;
		tsk_size_t producerHeight;
		tsk_size_t xProducerSize;
		struct tmedia_converter_video_s* toYUV420;
	} conv;

	struct{
		tsk_list_t* packets;
		tsk_size_t count;
		tsk_size_t max;
		uint64_t last_fir_time;
		uint64_t last_pli_time;
	} avpf;
}
tdav_session_video_t;

#define TDAV_SESSION_VIDEO(self) ((tdav_session_video_t*)(self))

TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t;
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpvideo_plugin_def_t;

TDAV_END_DECLS

#endif /* TINYDAV_SESSION_VIDEO_H */
OpenPOWER on IntegriCloud