test_manager.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef _TEST_MANAGER_H_
  23. #define _TEST_MANAGER_H_
  24. void test_manager()
  25. {
  26. tsk_size_t i;
  27. trtp_manager_t* manager;
  28. if(!(manager = trtp_manager_create(tsk_true, "192.168.0.12", tsk_false))) {
  29. goto bail;
  30. }
  31. trtp_manager_set_payload_type(manager, 8);
  32. /* Prepare: this will allow you to generate local port and ip */
  33. if(trtp_manager_prepare(manager)) {
  34. goto bail;
  35. }
  36. /* set remote parameters (rtcp ip:port not mandator, could be retrieved from rtp values) */
  37. if(trtp_manager_set_rtp_remote(manager, "192.168.0.13", 5081)) {
  38. goto bail;
  39. }
  40. if(trtp_manager_set_rtcp_remote(manager, "192.168.0.13", 2861)) {
  41. goto bail;
  42. }
  43. /* start */
  44. if(trtp_manager_start(manager)) {
  45. goto bail;
  46. }
  47. /* send data */
  48. for(i=0; i<2; i++) {
  49. if(trtp_manager_send_rtp(manager, "test", tsk_strlen("test"), 160, tsk_true)) {
  50. goto bail;
  51. }
  52. }
  53. getchar();
  54. bail:
  55. /* stop and destroy */
  56. TSK_OBJECT_SAFE_FREE(manager);
  57. }
  58. #endif /* _TEST_MANAGER_H_ */