|
@@ -25,13 +25,18 @@ void ts_pes_free(struct ts_pes **ppes) {
|
25
|
25
|
}
|
26
|
26
|
}
|
27
|
27
|
|
28
|
|
-struct ts_pes *ts_pes_reset(struct ts_pes *pes) {
|
|
28
|
+void ts_pes_clear(struct ts_pes *pes) {
|
|
29
|
+ if (!pes)
|
|
30
|
+ return;
|
|
31
|
+ // save
|
29
|
32
|
uint8_t *pes_data = pes->pes_data;
|
30
|
33
|
uint32_t pes_data_size = pes->pes_data_size;
|
|
34
|
+ // clear
|
|
35
|
+ memset(pes_data, 0x33, pes_data_size);
|
31
|
36
|
memset(pes, 0, sizeof(struct ts_pes));
|
|
37
|
+ // restore
|
32
|
38
|
pes->pes_data = pes_data;
|
33
|
39
|
pes->pes_data_size = pes_data_size;
|
34
|
|
- return pes;
|
35
|
40
|
}
|
36
|
41
|
|
37
|
42
|
static void ts_pes_add_payload_to_pes_data(struct ts_pes *pes, uint8_t *payload, uint8_t payload_size) {
|
|
@@ -67,7 +72,7 @@ int ts_pes_is_finished(struct ts_pes *pes, uint8_t *ts_packet) {
|
67
|
72
|
// ts_LOGf("packet finished, len:%d\n", pes->real_pes_packet_len);
|
68
|
73
|
if (!ts_pes_parse(pes)) {
|
69
|
74
|
ts_LOGf("error parsing!\n");
|
70
|
|
- pes = ts_pes_reset(pes);
|
|
75
|
+ ts_pes_clear(pes);
|
71
|
76
|
return 0;
|
72
|
77
|
}
|
73
|
78
|
// ts_LOGf("parsed OK!\n");
|
|
@@ -249,7 +254,8 @@ OUT:
|
249
|
254
|
return pes;
|
250
|
255
|
|
251
|
256
|
ERROR:
|
252
|
|
- return ts_pes_reset(pes);
|
|
257
|
+ ts_pes_clear(pes);
|
|
258
|
+ return pes;
|
253
|
259
|
}
|
254
|
260
|
|
255
|
261
|
int ts_pes_parse(struct ts_pes *pes) {
|