Skip to content

Commit 8c84c3b

Browse files
committed
-
1 parent 0658496 commit 8c84c3b

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

libmpeg/source/mpeg-system-header.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ int system_header_read(struct ps_system_header_t* h, struct mpeg_bits_t* reader)
2727
h->CSPS_flag = (v8 >> 0) & 0x01;
2828

2929
v8 = mpeg_bits_read8(reader);
30-
assert((0x20 & v8) == 0x20); // 'xx1xxxxx'
30+
//assert((0x20 & v8) == 0x20); // 'xx1xxxxx'
3131
h->system_audio_lock_flag = (v8 >> 7) & 0x01;
3232
h->system_video_lock_flag = (v8 >> 6) & 0x01;
3333
h->video_bound = v8 & 0x1F;
3434

35-
// assert((0x7F & data[11]) == 0x00); // 'x0000000'
35+
//assert((0x7F & data[11]) == 0x00); // 'x0000000'
3636
h->packet_rate_restriction_flag = (mpeg_bits_read8(reader) >> 7) & 0x01;
3737

3838
for (i = 0; 0 == mpeg_bits_error(reader) && mpeg_bits_tell(reader) + 1 < end && i < sizeof(h->streams) / sizeof(h->streams[0]); i++)
@@ -50,7 +50,7 @@ int system_header_read(struct ps_system_header_t* h, struct mpeg_bits_t* reader)
5050
}
5151

5252
v16 = mpeg_bits_read16(reader);
53-
assert((v16 & 0xC000) == 0xC000); // '11xxxxxx'
53+
//assert((v16 & 0xC000) == 0xC000); // '11xxxxxx'
5454
h->streams[i].buffer_bound_scale = (v16 >> 13) & 0x01;
5555
h->streams[i].buffer_size_bound = v16 & 0x1FFF;
5656
}
@@ -69,28 +69,28 @@ size_t system_header_read(struct ps_system_header_t *h, const uint8_t* data, siz
6969

7070
if (bytes < 12) return 0;
7171

72-
assert(0x00 == data[0] && 0x00 == data[1] && 0x01 == data[2] && PES_SID_SYS == data[3]);
72+
//assert(0x00 == data[0] && 0x00 == data[1] && 0x01 == data[2] && PES_SID_SYS == data[3]);
7373
len = (data[4] << 8) | data[5];
7474
if(len + 6 > bytes)
7575
{
7676
assert(0);
7777
return 0;
7878
}
7979

80-
assert((0x80 & data[6]) == 0x80); // '1xxxxxxx'
81-
assert((0x01 & data[8]) == 0x01); // 'xxxxxxx1'
80+
//assert((0x80 & data[6]) == 0x80); // '1xxxxxxx'
81+
//assert((0x01 & data[8]) == 0x01); // 'xxxxxxx1'
8282
h->rate_bound = ((data[6] & 0x7F) << 15) | (data[7] << 7) | ((data[8] >> 1) & 0x7F);
8383

8484
h->audio_bound = (data[9] >> 2) & 0x3F;
8585
h->fixed_flag = (data[9] >> 1) & 0x01;
8686
h->CSPS_flag = (data[9] >> 0) & 0x01;
8787

88-
assert((0x20 & data[10]) == 0x20); // 'xx1xxxxx'
88+
//assert((0x20 & data[10]) == 0x20); // 'xx1xxxxx'
8989
h->system_audio_lock_flag = (data[10] >> 7) & 0x01;
9090
h->system_video_lock_flag = (data[10] >> 6) & 0x01;
9191
h->video_bound = data[10] & 0x1F;
9292

93-
// assert((0x7F & data[11]) == 0x00); // 'x0000000'
93+
//assert((0x7F & data[11]) == 0x00); // 'x0000000'
9494
h->packet_rate_restriction_flag = (data[11] >> 7) & 0x01;
9595

9696
i = 12;
@@ -106,7 +106,7 @@ size_t system_header_read(struct ps_system_header_t *h, const uint8_t* data, siz
106106
i += 3;
107107
}
108108

109-
assert((data[i] & 0xC0) == 0xC0); // '11xxxxxx'
109+
//assert((data[i] & 0xC0) == 0xC0); // '11xxxxxx'
110110
h->streams[j].buffer_bound_scale = (data[i] >> 5) & 0x01;
111111
h->streams[j].buffer_size_bound = (data[i] & 0x1F) | data[i + 1];
112112
i += 2;

librtp/source/rtcp-app.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ int rtcp_app_pack(struct rtp_context *ctx, uint8_t* ptr, int bytes, const char n
4444
nbo_w32(ptr+4, ctx->self->ssrc);
4545
memcpy(ptr+8, name, 4);
4646

47-
if(len > 0)
48-
memcpy(ptr+12, app, len);
47+
if (len > 0)
48+
{
49+
memcpy(ptr + 12, app, len);
50+
if(0 != len % 4)
51+
memset(ptr + 12 + len, 0, 4 - (len % 4));
52+
}
4953
}
5054

5155
return 12 + (len+3)/4*4;

librtp/source/rtcp-rtpfb.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ static int rtcp_rtpfb_tcc01_unpack(struct rtp_context* ctx, const rtcp_header_t*
671671
r = -1;
672672
break;
673673
}
674-
ccfb[i].ato = ((int16_t)nbo_r16(ptr)) >> 2; // 250us -> 1/1024(s)
674+
ccfb[i].ato = ((int16_t)nbo_r16(ptr)) >> 2; // 250us -> 1/1024(ms)
675675
bytes -= 2;
676676
ptr += 2;
677677
}
@@ -708,14 +708,14 @@ static int rtcp_rtpfb_tcc01_pack(uint16_t begin, const rtcp_ccfb_t* ccfb, int co
708708

709709
for (i = 0; i < count && bytes >= 2; i += k)
710710
{
711-
ato = ccfb[i].ato << 2; // 1/1024(s) -> 250us
711+
ato = ccfb[i].ato << 2; // 1/1024(ms) -> 250us
712712
two = (ccfb[i].received && (uint16_t)ato > 0xFF) ? 2 : 1;
713713
received = ccfb[i].received;
714714

715715
// try Run Length Chunk
716716
for (k = 1; i + k < count && ccfb[i + k].received == ccfb[i].received; k++)
717717
{
718-
ato = ccfb[i + k].ato << 2; // 1/1024(s) -> 250us
718+
ato = ccfb[i + k].ato << 2; // 1/1024(ms) -> 250us
719719
two = (ccfb[i + k].received && (uint16_t)ato > 0xFF) ? 2 : two;
720720
received |= ccfb[i + k].received;
721721
}
@@ -766,7 +766,7 @@ static int rtcp_rtpfb_tcc01_pack(uint16_t begin, const rtcp_ccfb_t* ccfb, int co
766766
if (seq + k != ccfb[i].seq)
767767
continue;
768768

769-
ato = ccfb[i].ato << 2; // 1/1024(s) -> 250us
769+
ato = ccfb[i].ato << 2; // 1/1024(ms) -> 250us
770770
if (chunk & 0x4000)
771771
{
772772
if (bytes < 2)
@@ -800,7 +800,7 @@ static int rtcp_rtpfb_tcc01_pack(uint16_t begin, const rtcp_ccfb_t* ccfb, int co
800800
if (!ccfb[i].received)
801801
continue;
802802

803-
ato = ccfb[i].ato << 2; // 1/1024(s) -> 250us
803+
ato = ccfb[i].ato << 2; // 1/1024(ms) -> 250us
804804
two = (chunk >> (2 * (6 - k))) & 0x03;
805805
if (two == 1)
806806
{
@@ -826,7 +826,7 @@ static int rtcp_rtpfb_tcc01_pack(uint16_t begin, const rtcp_ccfb_t* ccfb, int co
826826
if (!ccfb[i].received)
827827
continue;
828828

829-
ato = ccfb[i].ato << 2; // 1/1024(s) -> 250us
829+
ato = ccfb[i].ato << 2; // 1/1024(ms) -> 250us
830830
ptr[0] = (uint8_t)ato;
831831
bytes -= 1;
832832
ptr += 1;

0 commit comments

Comments
 (0)