Browse Source

TT#37157 make payload mismatches in lossy codecs non-fatal

required to accomodate different versions of encoders

Change-Id: I47c574f1a8761b0ba042532145548e87d4398b75
changes/23/21523/1
Richard Fuchs 8 years ago
parent
commit
f0b4f1d9a9
1 changed files with 16 additions and 17 deletions
  1. +16
    -17
      t/transcode-test.c

+ 16
- 17
t/transcode-test.c View File

@ -81,7 +81,7 @@ static void queue_dump(GString *s, GQueue *q) {
g_string_free(s, TRUE); \
}
#define packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, ts_exp) { \
#define packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, ts_exp, fatal) { \
printf("running test %s:%i\n", __FILE__, __LINE__); \
struct codec_handler *h = codec_handler_get(media_ ## side, pt_in); \
str pl = STR_CONST_INIT(pload); \
@ -162,7 +162,7 @@ static void queue_dump(GString *s, GQueue *q) {
abort(); \
if (pl_exp.len != cp->s.len) \
abort(); \
if (memcmp(pl_exp.s, cp->s.s, pl_exp.len)) \
if (fatal && memcmp(pl_exp.s, cp->s.s, pl_exp.len)) \
abort(); \
} \
printf("test ok: %s:%i\n", __FILE__, __LINE__); \
@ -173,17 +173,16 @@ static void queue_dump(GString *s, GQueue *q) {
packet_seq(side, pt_in, pload, 0, 0, pt_out, pload_exp)
#define packet_seq(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp) \
packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, -1)
packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, -1, 1)
#define packet_seq_nf(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp) \
packet_seq_ts(side, pt_in, pload, rtp_ts, rtp_seq, pt_out, pload_exp, -1, 0)
#define end() } /* free/cleanup should go here */
#define PCMU_payload "\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00"
#define PCMU_payload_AMR "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7e\xff\x7e\xf6\xf3\xf5\xf5\xf5\xf6\xf7\xf7\xf8\xf9\xf9\xfa\xfb\xfb\xfc\xfc\xfd\xfd\xfe\xfe\xff\xff\x7e\xff\x7d\xff\x7b\xfc\xf6\xf5\xf6\xe3\x6e\x42\x3d\x3d\x3e\x3f\x41\x3f\x3d\x3f\x41\x44\x46\x49\x4b\x4d\x50\x54\x58\x5b\x60\x67\x6f\x74\xec\x6c\x46\x41\x42\x45\x48\x4a\x4d\x4f\x60\xff\xdb\xd2\xce\xc6\xc6\xc5\xc4\xc6\xbf\xbe\xba\xba\xba\xb8\xb6\xb4\xb3\xb2\xb0\xb0\xaf\xaf\xae\xae\xaf\xae\xae\xae\xaf\xb1\xb1\xb2\xb2\xb4\xb6\xb6\xb7\xb7\xb8\xb8\xb8\xb9\xb9\xba\xb8\xb9\xb9\xba\xba\xbb\xbb\xbd\xbc\xbd\xbf\xbf\xc0\xc2\xc5\xc8\xca\xcd\xce\xd0\xdc\xdc\xe5\xe7\xf0\xf8\x7c\x6f\x70\x65\x6e\x62\x60" // after AMR decode
#define PCMA_payload "\x2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\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b\x2a\x2b" // after G722 decode
#define PCMA_payload_G722_2 "\x2a\x2b\x2a\x28\x2a\x2d\x2f\x2d\x38\x2d\x0c\x29\x2b\x2b\x2b\x28\x2a\x29\x2a\x2d\x2b\x24\x2f\x3f\x23\x33\x20\x3f\x20\x3a\x22\x27\x2d\x26\x2c\x21\x2c\x26\x2c\x26\x2d\x26\x2d\x26\x2c\x21\x2c\x20\x2f\x20\x2f\x20\x2f\x21\x2f\x21\x2f\x21\x2f\x21\x2f\x21\x2c\x21\x2c\x26\x2c\x26\x2c\x26\x2c\x26\x2c\x26\x2c\x21\x2c\x21\x2c\x20\x2f\x20\x2f\x23\x2f\x23\x2f\x22\x2f\x22\x2e\x2d\x2e\x2d\x2e\x2d\x2e\x2d\x29\x2c\x29\x2c\x29\x2c\x29\x2c\x29\x2c\x29\x2f\x29\x2f\x29\x2f\x28\x2f\x28\x2e\x28\x2e\x28\x2e\x28\x2e\x28\x2e\x28\x2e\x28\x29\x28\x29\x28\x29\x28\x29\x2b\x29\x2b\x29\x2b\x29\x2b\x28\x2b\x28\x2b\x28\x2b\x28\x2b\x28\x2b\x28\x2b\x28\x2b\x28\x2b\x28" // after G722 decode #2
#define G722_payload "\x23\x84\x20\x84\x20\x84\x04\x84\x04\x04\x84\x04\x84\x04\x84\x05\x85\x46\x87\x48\xc8\x48\x88\x48\xc8\x49\x8a\x4b\xcc\x4c\x8c\x4c\xcc\x4c\x8c\x4d\xce\x50\xcf\x51\x90\x50\xcf\x12\xd1\x52\xd2\x54\x91\x52\xd2\x54\x92\x54\xd3\x56\x93\xd6\x94\xd4\x93\xd7\xd5\x55\x94\x55\xd5\x55\xd4\x56\xd5\x17\xd7\x5a\x95\xd7\x97\xd9\xd4\x16\x58\x57\x98\xd5\xd7\x5b\x96\xda\xd6\x1b\x57\x5a\xd6\x1a\x57\x5b\x98\xd6\xd8\x56\x98\xd7\xd9\x5a\x95\xdb\xd6\x1c\x52\x5e\xd7\x5c\x93\xdf\x99\xd5\xd7\x5f\xd9\x14\x56\x7f\x92\xda\xd9\x5c\x92\xdd\xd7\x5d\x92\xff\xd6\x5a\x96\xdc\xd5\x18\x56\x7e\xd2\x5e\x96\xde\x94\xd8\xd8\x58\xd3\x79\x93\xfb\x90\xdc\xd6\x5b\xdd\x58\x96\xff"
#define G722_payload_2 "\x92\xdf\xd5\x7f\xd4\x5a\x9b\xdd\xd1\x5f\x9b\xff\xd0\x5e\xd9\x59\x92\xf6\x95\xdb\x58\x5f\x96\xdb\x9e\xfc\x51\x7c\x96\xfd\xd0\xfc\x9e\xdb\xd6\xfb\x92\xfd\x54\x79\x96\xfe\x56\x7f\xd4\x5c\x99\xba\x94\xfe\xd4\xff\xd3\x72\xd5\x7d\xd8\x5c\xd4\x9d\x99\xf5\xd3\x74\x94\xd9\x55\xfb\x98\xfe\xd5\x78\xd3\x7f\x52\x75\x98\xda\xdb\xfa\x90\xda\x9a\xf3\x4f\x76\x99\xda\xd6\x5f\xbb\x98\x91\xf1\xd2\xfd\xd3\x74\x9e\xd5\xdc\xfe\xd1\x7d\x96\xf3\x91\xdc\x5b\x7e\xd3\x7b\xda\x7f\x93\xfa\x97\x9d\x95\xfd\x5b\x5f\x95\xff\xd1\xff\xd4\x5e\xd9\x5e\x94\xde\xd2\x78\xd3\xf8\x97\xde\xd5\x5b\x98\x5c\xd1\xf6\x92\xfd\xd3\xfa\x95\xd7\xbe\xde\xd2\x7b\x90\xfd\xd3\x79\x99\xd8"
#define AMR_WB_payload "\xf0\x1c\xf3\x06\x08\x10\x77\x32\x23\x20\xd3\x50\x62\x12\xc7\x7c\xe2\xea\x84\x0e\x6e\xf4\x4d\xe4\x7f\xc9\x4c\xcc\x58\x5d\xed\xcc\x5d\x7c\x6c\x14\x7d\xc0" // octet aligned
#define AMR_WB_payload_noe "\xf1\xfc\xc1\x82\x04\x1d\xcc\x88\xc8\x34\xd4\x18\x84\xb1\xdf\x38\xba\xa1\x03\x9b\xbd\x13\x79\x1f\xf2\x53\x33\x16\x17\x7b\x73\x17\x5f\x1b\x05\x1f\x70" // bandwidth efficient
@ -338,9 +337,9 @@ int main() {
expect(B, recv, "0/PCMU/8000 96/AMR-WB/16000/octet-align=1");
expect(B, send, "96/AMR-WB/16000/octet-align=1");
packet_seq(A, 0, PCMU_payload, 0, 0, -1, ""); // nothing due to resampling buffer
packet_seq(A, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload);
packet_seq_nf(A, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload);
packet_seq(B, 96, AMR_WB_payload, 0, 0, -1, ""); // nothing due to resampling/decoding buffer
packet_seq(B, 96, AMR_WB_payload, 320, 1, 0, PCMU_payload_AMR);
packet_seq_nf(B, 96, AMR_WB_payload, 320, 1, 0, PCMU_payload);
end();
// reverse AMR-WB (octet aligned)
@ -359,9 +358,9 @@ int main() {
expect(B, recv, "96/AMR-WB/16000/octet-align=1 0/PCMU/8000");
expect(B, send, "0/PCMU/8000");
packet_seq(B, 0, PCMU_payload, 0, 0, -1, ""); // nothing due to resampling buffer
packet_seq(B, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload);
packet_seq_nf(B, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload);
packet_seq(A, 96, AMR_WB_payload, 0, 0, -1, ""); // nothing due to resampling/decoding buffer
packet_seq(A, 96, AMR_WB_payload, 320, 1, 0, PCMU_payload_AMR);
packet_seq_nf(A, 96, AMR_WB_payload, 320, 1, 0, PCMU_payload);
end();
// reverse AMR-WB (bandwidth efficient)
@ -380,9 +379,9 @@ int main() {
expect(B, recv, "96/AMR-WB/16000 0/PCMU/8000");
expect(B, send, "0/PCMU/8000");
packet_seq(B, 0, PCMU_payload, 0, 0, -1, ""); // nothing due to resampling buffer
packet_seq(B, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload_noe);
packet_seq_nf(B, 0, PCMU_payload, 160, 1, 96, AMR_WB_payload_noe);
packet_seq(A, 96, AMR_WB_payload_noe, 0, 0, -1, ""); // nothing due to resampling/decoding buffer
packet_seq(A, 96, AMR_WB_payload_noe, 320, 1, 0, PCMU_payload_AMR);
packet_seq_nf(A, 96, AMR_WB_payload_noe, 320, 1, 0, PCMU_payload);
end();
}
}
@ -403,11 +402,11 @@ int main() {
expect(B, recv, "8/PCMA/8000 9/G722/8000");
expect(B, send, "9/G722/8000");
packet_seq(A, 8, PCMA_payload, 0, 0, -1, ""); // nothing due to resampling
packet_seq(A, 8, PCMA_payload, 160, 1, 9, G722_payload);
packet_seq_ts(A, 8, PCMA_payload, 320, 2, 9, G722_payload_2, 160);
packet_seq_nf(A, 8, PCMA_payload, 160, 1, 9, G722_payload);
packet_seq_ts(A, 8, PCMA_payload, 320, 2, 9, G722_payload, 160, 0);
packet_seq(B, 9, G722_payload, 0, 0, -1, ""); // nothing due to resampling
packet_seq(B, 9, G722_payload, 160, 1, 8, PCMA_payload_G722);
packet_seq_ts(B, 9, G722_payload_2, 320, 2, 8, PCMA_payload_G722_2, 160);
packet_seq_nf(B, 9, G722_payload, 160, 1, 8, PCMA_payload);
packet_seq_ts(B, 9, G722_payload, 320, 2, 8, PCMA_payload, 160, 0);
end();
return 0;


Loading…
Cancel
Save