Skip to content

Commit

Permalink
fix key block group key frame detection
Browse files Browse the repository at this point in the history
- a block group is a key frame if it has no block references (unlike
simple groups which use flags & 0x80)
- also improved debug logs - added per-lace debug log, including the
  absolute file offset, size, key frame etc
  • Loading branch information
erankor committed Jan 20, 2024
1 parent 38265b4 commit 0cc1378
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 35 deletions.
12 changes: 12 additions & 0 deletions vod/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
#define vod_log_debug2(level, log, err, fmt, arg1, arg2)
#define vod_log_debug3(level, log, err, fmt, arg1, arg2, arg3)
#define vod_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
#define vod_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
#define vod_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
#define vod_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7)

typedef int bool_t;
typedef int vod_status_t;
Expand Down Expand Up @@ -264,6 +267,15 @@ void vod_log_error(vod_uint_t level, vod_log_t *log, int err,
#define vod_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)

#define vod_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)

#define vod_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)

#define vod_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7)

#define vod_errno ngx_errno

typedef intptr_t bool_t;
Expand Down
12 changes: 6 additions & 6 deletions vod/mkv/ebml.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ ebml_parse_element(ebml_context_t* context, ebml_spec_t* spec, void* dest)
break;

case EBML_MASTER:
next_context.request_context = context->request_context;
next_context.cur_pos = context->cur_pos + size;
next_context.end_pos = context->end_pos;
next_context = *context;
next_context.cur_pos += size;

context->end_pos = next_context.cur_pos;
rc = ebml_parse_master(context, spec->child, cur_dest);
if (rc != VOD_OK)
Expand All @@ -276,9 +276,9 @@ ebml_parse_element(ebml_context_t* context, ebml_spec_t* spec, void* dest)
return VOD_OK;

case EBML_CUSTOM:
next_context.request_context = context->request_context;
next_context.cur_pos = context->cur_pos + size;
next_context.end_pos = context->end_pos;
next_context = *context;
next_context.cur_pos += size;

context->end_pos = next_context.cur_pos;
parser = spec->child;
rc = parser(context, spec, cur_dest);
Expand Down
1 change: 1 addition & 0 deletions vod/mkv/ebml.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef struct {
request_context_t* request_context;
const u_char* cur_pos;
const u_char* end_pos;
int64_t offset_delta;
} ebml_context_t;

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions vod/mkv/mkv_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#define MKV_ID_SIMPLEBLOCK (0xA3)
#define MKV_ID_BLOCKGROUP (0xA0)
#define MKV_ID_BLOCK (0xA1)
#define MKV_ID_REFERENCEBLOCK (0xFB)
#define MKV_ID_CLUSTER (0x1F43B675)

// sections
Expand Down
Loading

0 comments on commit 0cc1378

Please sign in to comment.