History

lavc/hevc/parser: only split packets on NALUs with nuh_layer_id=0

A packet should contain a full access unit, which for multilayer video should contain all the layers.

Anton Khirnov committed 2 years ago

Commit a811ab71 parent 52ce2d21 file · +6 −1Browse files

Unified · Split

libavcodec/hevc/parser.c+6−1
@@ -262,7 +262,7 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, · 261 unmodified lines
262 int i;262 int i;
263 263
264 for (i = 0; i < buf_size; i++) {264 for (i = 0; i < buf_size; i++) {
265 int nut;265 int nut, layer_id;
266 266
267 pc->state64 = (pc->state64 << 8) | buf[i];267 pc->state64 = (pc->state64 << 8) | buf[i];
268 268
@@ -270,6 +270,11 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, · 1 unmodified line
270 continue;270 continue;
271 271
272 nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;272 nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;
273
274 layer_id = (pc->state64 >> 11) & 0x3F;
275 if (layer_id > 0)
276 continue;
277
273 // Beginning of access unit278 // Beginning of access unit
274 if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX ||279 if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX ||
275 (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {280 (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t