Use the next I/P/B or start code as the end of current frame. Before the patch, extension start code, user data start code, sequence end code and so on are treated as the start of next frame.
Showing the changes to libavcodec (1 of 3 files). Show all
Unified · Split
| @@ -59,12 +59,11 @@ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, · 58 unmodified lines | |||
| 59 | return 0; | 59 | return 0; |
| 60 | for(; i<buf_size; i++){ | 60 | for(; i<buf_size; i++){ |
| 61 | state= (state<<8) | buf[i]; | 61 | state= (state<<8) | buf[i]; |
| 62 | if((state&0xFFFFFF00) == 0x100){ | 62 | if (state == PIC_I_START_CODE || state == PIC_PB_START_CODE || |
| 63 | if(state > SLICE_MAX_START_CODE){ | 63 | state == CAVS_START_CODE) { |
| 64 | pc->frame_start_found=0; | 64 | pc->frame_start_found=0; |
| 65 | pc->state=-1; | 65 | pc->state=-1; |
| 66 | return i-3; | 66 | return i-3; |
| 67 | } | ||
| 68 | } | 67 | } |
| 69 | } | 68 | } |
| 70 | } | 69 | } |