diff --git a/drivers/dvb/demux/sc2_demux/ts_output.c b/drivers/dvb/demux/sc2_demux/ts_output.c index 5b52bc485..91228de9c 100644 --- a/drivers/dvb/demux/sc2_demux/ts_output.c +++ b/drivers/dvb/demux/sc2_demux/ts_output.c @@ -67,6 +67,7 @@ struct es_params_t { s64 pre_time_ms; u32 es_wp; u32 es_header_wp; + u8 es_wp_has_err; }; struct ts_out { @@ -1034,14 +1035,15 @@ static int write_es_data(struct out_elem *pout, struct es_params_t *es_params) if (es_params->has_splice == 0) { memcpy(&header, &es_params->header, h_len); ATRACE_COUNTER(pout->name, es_params->header.pts); - pr_dbg("%s pid:0x%0x sid:0x%0x flag:%d, pts:0x%lx, dts:0x%lx, len:%d\n", + pr_dbg("%s pid:0x%0x sid:0x%0x flag:%d, pts:0x%lx, dts:0x%lx, len:%d offset:0x%0x\n", pout->type == AUDIO_TYPE ? "audio" : "video", pout->es_pes->pid, pout->sid, header.pts_dts_flag, (unsigned long)header.pts, (unsigned long)header.dts, - header.len); + header.len, + pout->pchan->r_offset); } else { header.len = es_params->header.len; pr_dbg("%s pid:0x%0x sid:0x%0x flag:%d, pts:0x%lx, dts:0x%lx, len:%d\n", @@ -2137,6 +2139,7 @@ static void notify_encrypt_for_t5w(struct out_elem *pout, struct es_params_t *es sizeof(struct dmx_sec_es_data), 0, 0); pr_dbg("notify sec mode encrypt type:%d\n", pout->type); + es_params->es_wp_has_err = 1; } } else { if (pout->type == VIDEO_TYPE || pout->type == AUDIO_TYPE) { @@ -2149,6 +2152,7 @@ static void notify_encrypt_for_t5w(struct out_elem *pout, struct es_params_t *es sizeof(struct dmx_non_sec_es_header), 0, 0); pr_dbg("notify non-sec mode encrypt type:%d\n", pout->type); + es_params->es_wp_has_err = 1; } } } else { @@ -2204,6 +2208,20 @@ static int _handle_es(struct out_elem *pout, struct es_params_t *es_params) } else { es_params->pre_time_ms = -1; } + /*first es error, jump & correct wp*/ + if (ret == 0 && es_params->es_wp_has_err) { + unsigned int cur_wp = 0; + + cur_wp = pcur_header[7] << 24 | + pcur_header[6] << 16 | pcur_header[5] << 8 | pcur_header[4]; + memcpy(&es_params->last_last_header, + &es_params->last_header, 16); + memcpy(&es_params->last_header, pcur_header, + sizeof(es_params->last_header)); + pout->pchan->r_offset = cur_wp % pout->pchan->mem_size; + es_params->es_wp_has_err = 0; + return 0; + } } if (ret < 0) { if (ret == -3) {