Skip to content

Commit 31d18ef

Browse files
committed
tests: Some SAP parsing tests
1 parent a94b53f commit 31d18ef

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

test/run_tests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "test_rtp.h"
5959
#include "test_video_capture.h"
6060
#include "test_video_display.h"
61+
#include "test_sdp_parser.h"
6162

6263
#define TEST_AV_HW 1
6364

@@ -131,6 +132,7 @@ struct {
131132
DEFINE_TEST(misc_test_replace_all),
132133
DEFINE_TEST(misc_test_unit_evaluate),
133134
DEFINE_TEST(misc_test_video_desc_io_op_symmetry),
135+
DEFINE_TEST(test_sdp_parser),
134136
};
135137

136138
static bool test_helper(const char *name, int (*func)(), bool quiet) {

test/test_sdp_parser.cpp

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#include "config.h"
2+
#include "config_unix.h"
3+
#include "config_win32.h"
4+
#include "debug.h"
5+
#include "memory.h"
6+
#include "utils/sdp_parser.hpp"
7+
#include "unit_common.h"
8+
extern "C" {
9+
#include "test_sdp_parser.h"
10+
}
11+
12+
13+
unsigned char sap_packet_data[] = {0x20, 0x0, 0xc4, 0xf1, 0xa9, 0xfe, 0xbd, 0xb8, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x64, 0x70, 0x0, 0x76, 0x3d, 0x30, 0xd, 0xa, 0x6f, 0x3d, 0x2d, 0x20, 0x33, 0x36, 0x31, 0x38, 0x39, 0x37, 0x30, 0x20, 0x33, 0x36, 0x31, 0x38, 0x39, 0x37, 0x39, 0x20, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x31, 0x36, 0x39, 0x2e, 0x32, 0x35, 0x34, 0x2e, 0x31, 0x38, 0x39, 0x2e, 0x31, 0x38, 0x34, 0xd, 0xa, 0x73, 0x3d, 0x41, 0x56, 0x49, 0x4f, 0x55, 0x53, 0x42, 0x2d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x20, 0x3a, 0x20, 0x32, 0xd, 0xa, 0x69, 0x3d, 0x31, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x3a, 0x20, 0x4c, 0x65, 0x66, 0x74, 0xd, 0xa, 0x63, 0x3d, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x32, 0x36, 0x2f, 0x33, 0x32, 0xd, 0xa, 0x74, 0x3d, 0x30, 0x20, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6b, 0x65, 0x79, 0x77, 0x64, 0x73, 0x3a, 0x44, 0x61, 0x6e, 0x74, 0x65, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x65, 0x63, 0x76, 0x6f, 0x6e, 0x6c, 0x79, 0xd, 0xa, 0x6d, 0x3d, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x35, 0x30, 0x30, 0x34, 0x20, 0x52, 0x54, 0x50, 0x2f, 0x41, 0x56, 0x50, 0x20, 0x39, 0x36, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x74, 0x70, 0x6d, 0x61, 0x70, 0x3a, 0x39, 0x36, 0x20, 0x4c, 0x32, 0x34, 0x2f, 0x34, 0x38, 0x30, 0x30, 0x30, 0x2f, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x66, 0x63, 0x6c, 0x6b, 0x3a, 0x70, 0x74, 0x70, 0x3d, 0x49, 0x45, 0x45, 0x45, 0x31, 0x35, 0x38, 0x38, 0x2d, 0x32, 0x30, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x44, 0x2d, 0x43, 0x31, 0x2d, 0x46, 0x46, 0x2d, 0x46, 0x45, 0x2d, 0x41, 0x31, 0x2d, 0x42, 0x38, 0x2d, 0x42, 0x43, 0x3a, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x63, 0x6c, 0x6b, 0x3a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x3d, 0x30, 0xd, 0xa};
14+
15+
unsigned char sap_packet_with_auth_data[] = {0x20, 0x3, 0x1, 0x2, 0x3, 0xc4, 0xf1, 0xa9, 0xfe, 0xbd, 0xb8, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x64, 0x70, 0x0, 0x76, 0x3d, 0x30, 0xd, 0xa, 0x6f, 0x3d, 0x2d, 0x20, 0x33, 0x36, 0x31, 0x38, 0x39, 0x37, 0x30, 0x20, 0x33, 0x36, 0x31, 0x38, 0x39, 0x37, 0x39, 0x20, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x31, 0x36, 0x39, 0x2e, 0x32, 0x35, 0x34, 0x2e, 0x31, 0x38, 0x39, 0x2e, 0x31, 0x38, 0x34, 0xd, 0xa, 0x73, 0x3d, 0x41, 0x56, 0x49, 0x4f, 0x55, 0x53, 0x42, 0x2d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x20, 0x3a, 0x20, 0x32, 0xd, 0xa, 0x69, 0x3d, 0x31, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x3a, 0x20, 0x4c, 0x65, 0x66, 0x74, 0xd, 0xa, 0x63, 0x3d, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x32, 0x36, 0x2f, 0x33, 0x32, 0xd, 0xa, 0x74, 0x3d, 0x30, 0x20, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6b, 0x65, 0x79, 0x77, 0x64, 0x73, 0x3a, 0x44, 0x61, 0x6e, 0x74, 0x65, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x65, 0x63, 0x76, 0x6f, 0x6e, 0x6c, 0x79, 0xd, 0xa, 0x6d, 0x3d, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x35, 0x30, 0x30, 0x34, 0x20, 0x52, 0x54, 0x50, 0x2f, 0x41, 0x56, 0x50, 0x20, 0x39, 0x36, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x74, 0x70, 0x6d, 0x61, 0x70, 0x3a, 0x39, 0x36, 0x20, 0x4c, 0x32, 0x34, 0x2f, 0x34, 0x38, 0x30, 0x30, 0x30, 0x2f, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x66, 0x63, 0x6c, 0x6b, 0x3a, 0x70, 0x74, 0x70, 0x3d, 0x49, 0x45, 0x45, 0x45, 0x31, 0x35, 0x38, 0x38, 0x2d, 0x32, 0x30, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x44, 0x2d, 0x43, 0x31, 0x2d, 0x46, 0x46, 0x2d, 0x46, 0x45, 0x2d, 0x41, 0x31, 0x2d, 0x42, 0x38, 0x2d, 0x42, 0x43, 0x3a, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x63, 0x6c, 0x6b, 0x3a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x3d, 0x30, 0xd, 0xa};
16+
17+
unsigned char sap_packet_2channels_data[] = {0x20, 0x0, 0x17, 0xcd, 0xa9, 0xfe, 0xbd, 0xb8, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x64, 0x70, 0x0, 0x76, 0x3d, 0x30, 0xd, 0xa, 0x6f, 0x3d, 0x2d, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x31, 0x36, 0x39, 0x2e, 0x32, 0x35, 0x34, 0x2e, 0x31, 0x38, 0x39, 0x2e, 0x31, 0x38, 0x34, 0xd, 0xa, 0x73, 0x3d, 0x41, 0x56, 0x49, 0x4f, 0x55, 0x53, 0x42, 0x2d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x20, 0x3a, 0x20, 0x32, 0xd, 0xa, 0x69, 0x3d, 0x32, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x3a, 0x20, 0x4c, 0x65, 0x66, 0x74, 0x2c, 0x20, 0x52, 0x69, 0x67, 0x68, 0x74, 0xd, 0xa, 0x63, 0x3d, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x32, 0x34, 0x37, 0x2e, 0x32, 0x35, 0x31, 0x2f, 0x33, 0x32, 0xd, 0xa, 0x74, 0x3d, 0x30, 0x20, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6b, 0x65, 0x79, 0x77, 0x64, 0x73, 0x3a, 0x44, 0x61, 0x6e, 0x74, 0x65, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x65, 0x63, 0x76, 0x6f, 0x6e, 0x6c, 0x79, 0xd, 0xa, 0x6d, 0x3d, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x35, 0x30, 0x30, 0x34, 0x20, 0x52, 0x54, 0x50, 0x2f, 0x41, 0x56, 0x50, 0x20, 0x39, 0x37, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x74, 0x70, 0x6d, 0x61, 0x70, 0x3a, 0x39, 0x37, 0x20, 0x4c, 0x32, 0x34, 0x2f, 0x34, 0x38, 0x30, 0x30, 0x30, 0x2f, 0x32, 0xd, 0xa, 0x61, 0x3d, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x66, 0x63, 0x6c, 0x6b, 0x3a, 0x70, 0x74, 0x70, 0x3d, 0x49, 0x45, 0x45, 0x45, 0x31, 0x35, 0x38, 0x38, 0x2d, 0x32, 0x30, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x44, 0x2d, 0x43, 0x31, 0x2d, 0x46, 0x46, 0x2d, 0x46, 0x45, 0x2d, 0x41, 0x31, 0x2d, 0x42, 0x38, 0x2d, 0x42, 0x43, 0x3a, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x63, 0x6c, 0x6b, 0x3a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x3d, 0x30, 0xd, 0xa};
18+
19+
unsigned char sap_packet_no_payload_type[] = {0x20, 0x0, 0x17, 0xcd, 0xa9, 0xfe, 0xbd, 0xb8, 0x76, 0x3d, 0x30, 0xd, 0xa, 0x6f, 0x3d, 0x2d, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x31, 0x36, 0x39, 0x2e, 0x32, 0x35, 0x34, 0x2e, 0x31, 0x38, 0x39, 0x2e, 0x31, 0x38, 0x34, 0xd, 0xa, 0x73, 0x3d, 0x41, 0x56, 0x49, 0x4f, 0x55, 0x53, 0x42, 0x2d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x20, 0x3a, 0x20, 0x32, 0xd, 0xa, 0x69, 0x3d, 0x32, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x3a, 0x20, 0x4c, 0x65, 0x66, 0x74, 0x2c, 0x20, 0x52, 0x69, 0x67, 0x68, 0x74, 0xd, 0xa, 0x63, 0x3d, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x32, 0x34, 0x37, 0x2e, 0x32, 0x35, 0x31, 0x2f, 0x33, 0x32, 0xd, 0xa, 0x74, 0x3d, 0x30, 0x20, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6b, 0x65, 0x79, 0x77, 0x64, 0x73, 0x3a, 0x44, 0x61, 0x6e, 0x74, 0x65, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x65, 0x63, 0x76, 0x6f, 0x6e, 0x6c, 0x79, 0xd, 0xa, 0x6d, 0x3d, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x35, 0x30, 0x30, 0x34, 0x20, 0x52, 0x54, 0x50, 0x2f, 0x41, 0x56, 0x50, 0x20, 0x39, 0x37, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x74, 0x70, 0x6d, 0x61, 0x70, 0x3a, 0x39, 0x37, 0x20, 0x4c, 0x32, 0x34, 0x2f, 0x34, 0x38, 0x30, 0x30, 0x30, 0x2f, 0x32, 0xd, 0xa, 0x61, 0x3d, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x66, 0x63, 0x6c, 0x6b, 0x3a, 0x70, 0x74, 0x70, 0x3d, 0x49, 0x45, 0x45, 0x45, 0x31, 0x35, 0x38, 0x38, 0x2d, 0x32, 0x30, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x44, 0x2d, 0x43, 0x31, 0x2d, 0x46, 0x46, 0x2d, 0x46, 0x45, 0x2d, 0x41, 0x31, 0x2d, 0x42, 0x38, 0x2d, 0x42, 0x43, 0x3a, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x63, 0x6c, 0x6b, 0x3a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x3d, 0x30, 0xd, 0xa};
20+
21+
unsigned char sap_packet_2channels_deletion_data[] = {0x24, 0x0, 0x17, 0xcd, 0xa9, 0xfe, 0xbd, 0xb8, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x64, 0x70, 0x0, 0x76, 0x3d, 0x30, 0xd, 0xa, 0x6f, 0x3d, 0x2d, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x35, 0x31, 0x37, 0x33, 0x32, 0x32, 0x20, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x31, 0x36, 0x39, 0x2e, 0x32, 0x35, 0x34, 0x2e, 0x31, 0x38, 0x39, 0x2e, 0x31, 0x38, 0x34, 0xd, 0xa, 0x73, 0x3d, 0x41, 0x56, 0x49, 0x4f, 0x55, 0x53, 0x42, 0x2d, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x20, 0x3a, 0x20, 0x32, 0xd, 0xa, 0x69, 0x3d, 0x32, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x3a, 0x20, 0x4c, 0x65, 0x66, 0x74, 0x2c, 0x20, 0x52, 0x69, 0x67, 0x68, 0x74, 0xd, 0xa, 0x63, 0x3d, 0x49, 0x4e, 0x20, 0x49, 0x50, 0x34, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x36, 0x39, 0x2e, 0x32, 0x34, 0x37, 0x2e, 0x32, 0x35, 0x31, 0x2f, 0x33, 0x32, 0xd, 0xa, 0x74, 0x3d, 0x30, 0x20, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6b, 0x65, 0x79, 0x77, 0x64, 0x73, 0x3a, 0x44, 0x61, 0x6e, 0x74, 0x65, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x65, 0x63, 0x76, 0x6f, 0x6e, 0x6c, 0x79, 0xd, 0xa, 0x6d, 0x3d, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x35, 0x30, 0x30, 0x34, 0x20, 0x52, 0x54, 0x50, 0x2f, 0x41, 0x56, 0x50, 0x20, 0x39, 0x37, 0xd, 0xa, 0x61, 0x3d, 0x72, 0x74, 0x70, 0x6d, 0x61, 0x70, 0x3a, 0x39, 0x37, 0x20, 0x4c, 0x32, 0x34, 0x2f, 0x34, 0x38, 0x30, 0x30, 0x30, 0x2f, 0x32, 0xd, 0xa, 0x61, 0x3d, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x31, 0xd, 0xa, 0x61, 0x3d, 0x74, 0x73, 0x2d, 0x72, 0x65, 0x66, 0x63, 0x6c, 0x6b, 0x3a, 0x70, 0x74, 0x70, 0x3d, 0x49, 0x45, 0x45, 0x45, 0x31, 0x35, 0x38, 0x38, 0x2d, 0x32, 0x30, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x2d, 0x31, 0x44, 0x2d, 0x43, 0x31, 0x2d, 0x46, 0x46, 0x2d, 0x46, 0x45, 0x2d, 0x41, 0x31, 0x2d, 0x42, 0x38, 0x2d, 0x42, 0x43, 0x3a, 0x30, 0xd, 0xa, 0x61, 0x3d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x63, 0x6c, 0x6b, 0x3a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x3d, 0x30, 0xd, 0xa};
22+
23+
#define TEST_CASE(fun)\
24+
do { \
25+
int ret = fun(); \
26+
if(ret){ \
27+
printf(#fun " failed\n"); \
28+
return ret; \
29+
} \
30+
} while(0)
31+
32+
33+
static int test_sap(){
34+
Sap_packet_view sap = Sap_packet_view::from_buffer(sap_packet_data, sizeof(sap_packet_data));
35+
36+
ASSERT(sap.isValid());
37+
ASSERT(!sap.isCompressed());
38+
ASSERT(!sap.isEncrypted());
39+
ASSERT(!sap.isIpv6());
40+
ASSERT(!sap.isDeletion());
41+
ASSERT_EQUAL("application/sdp", sap.payload_type);
42+
ASSERT_EQUAL(291, sap.payload.size());
43+
44+
return 0;
45+
}
46+
47+
static int test_sap_with_auth_header(){
48+
Sap_packet_view sap = Sap_packet_view::from_buffer(sap_packet_with_auth_data, sizeof(sap_packet_with_auth_data));
49+
50+
ASSERT(sap.isValid());
51+
ASSERT(!sap.isCompressed());
52+
ASSERT(!sap.isEncrypted());
53+
ASSERT(!sap.isIpv6());
54+
ASSERT(!sap.isDeletion());
55+
ASSERT_EQUAL("application/sdp", sap.payload_type);
56+
ASSERT_EQUAL(291, sap.payload.size());
57+
58+
return 0;
59+
}
60+
61+
static int test_sap_empty(){
62+
Sap_packet_view sap = Sap_packet_view::from_buffer("", 0);
63+
64+
ASSERT(!sap.isValid());
65+
66+
return 0;
67+
}
68+
69+
static int test_sap_deletion_flag(){
70+
Sap_packet_view sap = Sap_packet_view::from_buffer(sap_packet_2channels_deletion_data, sizeof(sap_packet_2channels_deletion_data));
71+
72+
ASSERT(sap.isValid());
73+
ASSERT(sap.isDeletion());
74+
ASSERT_EQUAL(298, sap.payload.size());
75+
76+
return 0;
77+
}
78+
79+
static int test_sap_no_payload_type(){
80+
Sap_packet_view sap = Sap_packet_view::from_buffer(sap_packet_no_payload_type, sizeof(sap_packet_no_payload_type));
81+
82+
ASSERT(sap.isValid());
83+
ASSERT_EQUAL("application/sdp", sap.payload_type);
84+
ASSERT_EQUAL(298, sap.payload.size());
85+
86+
return 0;
87+
}
88+
89+
90+
static int test_sdp_empty(){
91+
Sdp_view sdp = Sdp_view::from_buffer("", 0);
92+
93+
ASSERT(!sdp.isValid());
94+
95+
return 0;
96+
}
97+
98+
static int test_sdp_basic(){
99+
Sap_packet_view sap = Sap_packet_view::from_buffer(sap_packet_no_payload_type, sizeof(sap_packet_no_payload_type));
100+
Sdp_view sdp = Sdp_view::from_buffer(sap.payload.data(), sap.payload.size());
101+
102+
ASSERT(sdp.isValid());
103+
ASSERT_EQUAL("- 517322 517322 IN IP4 169.254.189.184", sdp.origin);
104+
ASSERT_EQUAL("AVIOUSB-xxxxxx : 2", sdp.session_name);
105+
ASSERT_EQUAL(1, sdp.media.size());
106+
ASSERT_EQUAL("", sdp.media[0].connection);
107+
ASSERT_EQUAL("IN IP4 239.69.247.251/32", sdp.connection);
108+
ASSERT_EQUAL("audio 5004 RTP/AVP 97", sdp.media[0].media_desc);
109+
ASSERT_EQUAL(4, sdp.media[0].attributes.size());
110+
ASSERT_EQUAL("rtpmap", sdp.media[0].attributes[0].key);
111+
ASSERT_EQUAL("97 L24/48000/2", sdp.media[0].attributes[0].val);
112+
113+
return 0;
114+
}
115+
116+
int test_sdp_parser(void){
117+
TEST_CASE(test_sap);
118+
TEST_CASE(test_sap_empty);
119+
TEST_CASE(test_sap_deletion_flag);
120+
TEST_CASE(test_sap_with_auth_header);
121+
TEST_CASE(test_sap_no_payload_type);
122+
123+
TEST_CASE(test_sdp_empty);
124+
TEST_CASE(test_sdp_basic);
125+
126+
return 0;
127+
}

test/test_sdp_parser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int test_sdp_parser(void);

0 commit comments

Comments
 (0)