mpegts: fix processing errors when <188 bytes is received
Also fix raw streaming where data is not %188, previously the code would have sent duplicate bytes which would have caused (unecessary) errors downstream.
This commit is contained in:
parent
a88c9dc425
commit
7d116966c8
1 changed files with 13 additions and 12 deletions
|
@ -339,22 +339,11 @@ mpegts_input_recv_packets
|
|||
name, tsb, (int)len, pcr, pcr_pid);
|
||||
|
||||
/* Not enough data */
|
||||
if (len < 188) return 0;
|
||||
if (len < 188) return len;
|
||||
|
||||
/* Streaming - lock mutex */
|
||||
pthread_mutex_lock(&mi->mi_delivery_mutex);
|
||||
|
||||
/* Raw stream */
|
||||
if (LIST_FIRST(&mmi->mmi_streaming_pad.sp_targets) != NULL) {
|
||||
streaming_message_t sm;
|
||||
pktbuf_t *pb = pktbuf_alloc(tsb, len);
|
||||
memset(&sm, 0, sizeof(sm));
|
||||
sm.sm_type = SMT_MPEGTS;
|
||||
sm.sm_data = pb;
|
||||
streaming_pad_deliver(&mmi->mmi_streaming_pad, &sm);
|
||||
pktbuf_ref_dec(pb);
|
||||
}
|
||||
|
||||
/* Process */
|
||||
while ( len >= 188 ) {
|
||||
|
||||
|
@ -410,6 +399,18 @@ mpegts_input_recv_packets
|
|||
|
||||
}
|
||||
|
||||
/* Raw stream */
|
||||
// Note: this will include unsynced data if that's what is received
|
||||
if (i > 0 && LIST_FIRST(&mmi->mmi_streaming_pad.sp_targets) != NULL) {
|
||||
streaming_message_t sm;
|
||||
pktbuf_t *pb = pktbuf_alloc(tsb, i);
|
||||
memset(&sm, 0, sizeof(sm));
|
||||
sm.sm_type = SMT_MPEGTS;
|
||||
sm.sm_data = pb;
|
||||
streaming_pad_deliver(&mmi->mmi_streaming_pad, &sm);
|
||||
pktbuf_ref_dec(pb);
|
||||
}
|
||||
|
||||
/* Wake table */
|
||||
if (table_wakeup)
|
||||
pthread_cond_signal(&mi->mi_table_feed_cond);
|
||||
|
|
Loading…
Add table
Reference in a new issue