summaryrefslogtreecommitdiffstats
path: root/tinyRTP/test/test_manager.h
blob: 29c2dcc7955a8a6f96ffe9b992dc31bbf9f0cb7e (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
/*
* Copyright (C) 2009 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 Lesser General Public License for more details.
*	
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef _TEST_MANAGER_H_
#define _TEST_MANAGER_H_

void test_manager()
{
	tsk_size_t i;
	trtp_manager_t* manager;

	if(!(manager = trtp_manager_create(tsk_true, "192.168.0.12", tsk_false))){
		goto bail;
	}

	trtp_manager_set_payload_type(manager, 8);

	/* Prepare: this will allow you to generate local port and ip */
	if(trtp_manager_prepare(manager)){
		goto bail;
	}

	/* set remote parameters (rtcp ip:port not mandator, could be retrieved from rtp values) */
	if(trtp_manager_set_rtp_remote(manager, "192.168.0.13", 5081)){
		goto bail;
	}
	if(trtp_manager_set_rtcp_remote(manager, "192.168.0.13", 2861)){
		goto bail;
	}

	/* start */
	if(trtp_manager_start(manager)){
		goto bail;
	}
	
	/* send data */
	for(i=0;i<2; i++){
		if(trtp_manager_send_rtp(manager, "test", tsk_strlen("test"), 160, tsk_true)){
			goto bail;
		}
	}
	
	getchar();

bail:
	/* stop and destroy */
	TSK_OBJECT_SAFE_FREE(manager);
}

#endif /* _TEST_MANAGER_H_ */

OpenPOWER on IntegriCloud