Browse Source

TT#14008 fix possible NULL pointer dereference

Change-Id: I601676f2cb1722d936e055ab7270b6668150b4ba
Warned-by: coverity
pull/1439/head
Richard Fuchs 4 years ago
parent
commit
28e3ca3dce
1 changed files with 15 additions and 11 deletions
  1. +15
    -11
      daemon/codec.c

+ 15
- 11
daemon/codec.c View File

@ -1628,19 +1628,23 @@ static int __handler_func_sequencer(struct media_packet *mp, struct transcode_pa
break; break;
} }
uint32_t ts_diff = ch->last_ts - packet->ts;
if (ts_diff < 0x80000000) { // ch->last_ts >= packet->ts
// multiple consecutive packets with same TS: this could be a compound packet, e.g. a large video frame, or
// it could be a supplemental audio codec with static timestamps, in which case we adjust the TS forward
// by one frame length. This is needed so that the next real audio packet (with real TS) is not mistakenly
// seen as overdue
if (h->source_pt.codec_def && h->source_pt.codec_def->supplemental)
ch->last_ts += h->source_pt.clock_rate * (ch->ptime ?: 20) / 1000;
if (ch) {
uint32_t ts_diff = ch->last_ts - packet->ts;
if (ts_diff < 0x80000000) { // ch->last_ts >= packet->ts
// multiple consecutive packets with same TS: this could be a compound packet, e.g. a large video frame, or
// it could be a supplemental audio codec with static timestamps, in which case we adjust the TS forward
// by one frame length. This is needed so that the next real audio packet (with real TS) is not mistakenly
// seen as overdue
if (h->source_pt.codec_def && h->source_pt.codec_def->supplemental)
ch->last_ts += h->source_pt.clock_rate * (ch->ptime ?: 20) / 1000;
}
else
ch->last_ts = packet->ts;
if (input_ch)
input_ch->last_ts = ch->last_ts;
} }
else
ch->last_ts = packet->ts;
input_ch->last_ts = ch->last_ts;
// new packet might have different handlers // new packet might have different handlers
h = packet->handler; h = packet->handler;


Loading…
Cancel
Save