Commit 8a4c1b84 authored by Wan-Teh Chang's avatar Wan-Teh Chang

Don't zero obu_ctx->buffer when allocating it.

Also, move the update of bytes_read closer to the related code.

Change-Id: I1d5fd992c00eb9aca25ffe7ddd23a291a03a92ec
parent baf6666a
......@@ -263,6 +263,10 @@ int file_is_obu(struct ObuDecInputContext *obu_ctx) {
return 0;
}
if (is_annexb) {
bytes_read += annexb_header_length;
}
if (obu_header.type != OBU_TEMPORAL_DELIMITER &&
obu_header.type != OBU_SEQUENCE_HEADER) {
return 0;
......@@ -283,7 +287,7 @@ int file_is_obu(struct ObuDecInputContext *obu_ctx) {
}
// Appears that input is valid Section 5 AV1 stream.
obu_ctx->buffer = (uint8_t *)calloc(OBU_BUFFER_SIZE, 1);
obu_ctx->buffer = (uint8_t *)malloc(OBU_BUFFER_SIZE);
if (!obu_ctx->buffer) {
fprintf(stderr, "Out of memory.\n");
rewind(f);
......@@ -291,9 +295,6 @@ int file_is_obu(struct ObuDecInputContext *obu_ctx) {
}
obu_ctx->buffer_capacity = OBU_BUFFER_SIZE;
if (is_annexb) {
bytes_read += annexb_header_length;
}
memcpy(obu_ctx->buffer, &detect_buf[0], (size_t)bytes_read);
obu_ctx->bytes_buffered = (size_t)bytes_read;
// If the first OBU is a SEQUENCE_HEADER, then it will have a payload.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment