diff --git a/fork/files/audio/decode/joc_core.h b/fork/files/audio/decode/joc_core.h index 6afcc92..9a24dba 100644 --- a/fork/files/audio/decode/joc_core.h +++ b/fork/files/audio/decode/joc_core.h @@ -190,9 +190,10 @@ typedef struct joc_object_params { /* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes * the frame invalid for rendering: the renderer holds the previous matrices or - * passes the core PCM through instead of decoding the matrix. Only status 3 - * still carries a complete object list (object count clamped to 15) for - * diagnostics; statuses 2 and 4 stop the parse after the failing header field. */ + * passes the core PCM through instead of decoding the matrix. Statuses 3 and 7 + * still carry the complete header and object list for diagnostics; statuses 2 + * and 4 stop the parse after the failing header field, and 7 stops inside + * joc_data, so only the per-object matrices are missing there. */ enum { JOC_FRAME_STATUS_OK = 0, JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */ @@ -200,7 +201,11 @@ enum { JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */ JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */ /* strictly increasing */ - JOC_FRAME_STATUS_TRAILING_DATA = 6 /* bytes after joc_data alignment */ + JOC_FRAME_STATUS_TRAILING_DATA = 6, /* bytes after joc_data alignment */ + /* The ID14 payload ends before its joc_data is complete. The header, + * clipgain, sequence counter and object parameters are intact, so the frame + * stays classified and is concealed by holding the previous matrices. */ + JOC_FRAME_STATUS_TRUNCATED = 7 }; typedef struct joc_frame_params { @@ -225,12 +230,18 @@ typedef struct joc_frame_params { joc_object_params objects[JOC_MAX_OBJECTS]; } joc_frame_params; -/* Parse an EMDF ID14 (JOC) payload. */ +/* Parse an EMDF ID14 (JOC) payload. A payload that ends inside joc_data is a + * damaged frame rather than a transport error: the call succeeds, the header and + * object parameters are filled in, and out_params->status is + * JOC_FRAME_STATUS_TRUNCATED. A payload too short for the 12-bit joc_header is + * unclassifiable and stays JOC_ERR_BITSTREAM_TRUNCATED. */ JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size, joc_frame_params* out_params); /* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and - * parse its ID14 payload. out_emdf may be NULL. */ + * parse its ID14 payload. out_emdf may be NULL. A damaged ID14 payload is + * reported through out_params->status like joc_parse_id14(); an incomplete + * container stays a transport error. */ JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size, joc_frame_params* out_params, joc_emdf_info* out_emdf); @@ -251,7 +262,8 @@ JOC_API joc_error JOC_CALL joc_eac3_frame_bytes(const uint8_t* data, size_t size /* Strict trailing-bit check for the JOC payload (A/B robustness corpus). * Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the - * leftover bits are not zero. */ + * leftover bits are not zero, and JOC_ERR_BITSTREAM_TRUNCATED when the payload + * ends inside joc_data. */ JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size, uint32_t* out_trailing_bits); diff --git a/fork/files/audio/decode/joc_stream.h b/fork/files/audio/decode/joc_stream.h index 7511483..137b99e 100644 --- a/fork/files/audio/decode/joc_stream.h +++ b/fork/files/audio/decode/joc_stream.h @@ -97,8 +97,9 @@ typedef struct joc_stream_status_info { uint64_t oamd_payloads; uint64_t oamd_transitions; /* Metadata the renderer had to work around, per audio frame: no JOC payload at - * all, a declared object count clamped to 15, and a syncframe carrying a second - * EMDF container that is not this frame's JOC metadata. */ + * all, an ID14 payload that ends inside joc_data (that frame holds the previous + * matrices), a declared object count clamped to 15, and a syncframe carrying a + * second EMDF container that is not this frame's JOC metadata. */ uint64_t missing_joc_frames; uint64_t objects_clamped_frames; uint64_t extra_container_frames; @@ -108,6 +109,9 @@ typedef struct joc_stream_status_info { uint64_t bed_mask_mismatch_frames; uint32_t output_channels; uint32_t ended; /* 1 after flush() */ + /* Appended field: joc_stream_status() accepts the size that ends at `ended` + * as well, so a caller built against the previous header keeps working. */ + uint64_t truncated_joc_frames; } joc_stream_status_info; JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out); diff --git a/fork/files/audio/decode/joc_version.h b/fork/files/audio/decode/joc_version.h index dc1143c..33bed7e 100644 --- a/fork/files/audio/decode/joc_version.h +++ b/fork/files/audio/decode/joc_version.h @@ -9,8 +9,8 @@ #define JOC_VERSION_H #define JOC_VERSION_MAJOR 1 -#define JOC_VERSION_MINOR 2 +#define JOC_VERSION_MINOR 3 #define JOC_VERSION_PATCH 0 -#define JOC_VERSION_STRING "1.2.0" +#define JOC_VERSION_STRING "1.3.0" #endif /* JOC_VERSION_H */ diff --git a/third_party/joc/include/joc_core.h b/third_party/joc/include/joc_core.h index 6afcc92..9a24dba 100644 --- a/third_party/joc/include/joc_core.h +++ b/third_party/joc/include/joc_core.h @@ -190,9 +190,10 @@ typedef struct joc_object_params { /* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes * the frame invalid for rendering: the renderer holds the previous matrices or - * passes the core PCM through instead of decoding the matrix. Only status 3 - * still carries a complete object list (object count clamped to 15) for - * diagnostics; statuses 2 and 4 stop the parse after the failing header field. */ + * passes the core PCM through instead of decoding the matrix. Statuses 3 and 7 + * still carry the complete header and object list for diagnostics; statuses 2 + * and 4 stop the parse after the failing header field, and 7 stops inside + * joc_data, so only the per-object matrices are missing there. */ enum { JOC_FRAME_STATUS_OK = 0, JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */ @@ -200,7 +201,11 @@ enum { JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */ JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */ /* strictly increasing */ - JOC_FRAME_STATUS_TRAILING_DATA = 6 /* bytes after joc_data alignment */ + JOC_FRAME_STATUS_TRAILING_DATA = 6, /* bytes after joc_data alignment */ + /* The ID14 payload ends before its joc_data is complete. The header, + * clipgain, sequence counter and object parameters are intact, so the frame + * stays classified and is concealed by holding the previous matrices. */ + JOC_FRAME_STATUS_TRUNCATED = 7 }; typedef struct joc_frame_params { @@ -225,12 +230,18 @@ typedef struct joc_frame_params { joc_object_params objects[JOC_MAX_OBJECTS]; } joc_frame_params; -/* Parse an EMDF ID14 (JOC) payload. */ +/* Parse an EMDF ID14 (JOC) payload. A payload that ends inside joc_data is a + * damaged frame rather than a transport error: the call succeeds, the header and + * object parameters are filled in, and out_params->status is + * JOC_FRAME_STATUS_TRUNCATED. A payload too short for the 12-bit joc_header is + * unclassifiable and stays JOC_ERR_BITSTREAM_TRUNCATED. */ JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size, joc_frame_params* out_params); /* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and - * parse its ID14 payload. out_emdf may be NULL. */ + * parse its ID14 payload. out_emdf may be NULL. A damaged ID14 payload is + * reported through out_params->status like joc_parse_id14(); an incomplete + * container stays a transport error. */ JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size, joc_frame_params* out_params, joc_emdf_info* out_emdf); @@ -251,7 +262,8 @@ JOC_API joc_error JOC_CALL joc_eac3_frame_bytes(const uint8_t* data, size_t size /* Strict trailing-bit check for the JOC payload (A/B robustness corpus). * Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the - * leftover bits are not zero. */ + * leftover bits are not zero, and JOC_ERR_BITSTREAM_TRUNCATED when the payload + * ends inside joc_data. */ JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size, uint32_t* out_trailing_bits); diff --git a/third_party/joc/include/joc_stream.h b/third_party/joc/include/joc_stream.h index 7511483..137b99e 100644 --- a/third_party/joc/include/joc_stream.h +++ b/third_party/joc/include/joc_stream.h @@ -97,8 +97,9 @@ typedef struct joc_stream_status_info { uint64_t oamd_payloads; uint64_t oamd_transitions; /* Metadata the renderer had to work around, per audio frame: no JOC payload at - * all, a declared object count clamped to 15, and a syncframe carrying a second - * EMDF container that is not this frame's JOC metadata. */ + * all, an ID14 payload that ends inside joc_data (that frame holds the previous + * matrices), a declared object count clamped to 15, and a syncframe carrying a + * second EMDF container that is not this frame's JOC metadata. */ uint64_t missing_joc_frames; uint64_t objects_clamped_frames; uint64_t extra_container_frames; @@ -108,6 +109,9 @@ typedef struct joc_stream_status_info { uint64_t bed_mask_mismatch_frames; uint32_t output_channels; uint32_t ended; /* 1 after flush() */ + /* Appended field: joc_stream_status() accepts the size that ends at `ended` + * as well, so a caller built against the previous header keeps working. */ + uint64_t truncated_joc_frames; } joc_stream_status_info; JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out); diff --git a/third_party/joc/include/joc_version.h b/third_party/joc/include/joc_version.h index dc1143c..33bed7e 100644 --- a/third_party/joc/include/joc_version.h +++ b/third_party/joc/include/joc_version.h @@ -9,8 +9,8 @@ #define JOC_VERSION_H #define JOC_VERSION_MAJOR 1 -#define JOC_VERSION_MINOR 2 +#define JOC_VERSION_MINOR 3 #define JOC_VERSION_PATCH 0 -#define JOC_VERSION_STRING "1.2.0" +#define JOC_VERSION_STRING "1.3.0" #endif /* JOC_VERSION_H */