Commit 13a24b6b authored by Yaowu Xu's avatar Yaowu Xu

Remove unused buffer_size

Manually cherry-picked from libvpx/nextgenv2:
fa99c376

Change-Id: Ia614aaa784c405a3d0f815846a584dd358008b18
parent e0644a1f
...@@ -218,8 +218,7 @@ static int read_frame(struct AvxDecInputContext *input, uint8_t **buf, ...@@ -218,8 +218,7 @@ static int read_frame(struct AvxDecInputContext *input, uint8_t **buf,
switch (input->aom_input_ctx->file_type) { switch (input->aom_input_ctx->file_type) {
#if CONFIG_WEBM_IO #if CONFIG_WEBM_IO
case FILE_TYPE_WEBM: case FILE_TYPE_WEBM:
return webm_read_frame(input->webm_ctx, buf, bytes_in_buffer, return webm_read_frame(input->webm_ctx, buf, bytes_in_buffer);
buffer_size);
#endif #endif
case FILE_TYPE_RAW: case FILE_TYPE_RAW:
return raw_read_frame(input->aom_input_ctx->file, buf, bytes_in_buffer, return raw_read_frame(input->aom_input_ctx->file, buf, bytes_in_buffer,
......
...@@ -56,7 +56,7 @@ class WebMVideoSource : public CompressedVideoSource { ...@@ -56,7 +56,7 @@ class WebMVideoSource : public CompressedVideoSource {
void FillFrame() { void FillFrame() {
ASSERT_TRUE(aom_ctx_->file != NULL); ASSERT_TRUE(aom_ctx_->file != NULL);
const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_); const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_);
ASSERT_GE(status, 0) << "webm_read_frame failed"; ASSERT_GE(status, 0) << "webm_read_frame failed";
if (status == 1) { if (status == 1) {
end_of_file_ = true; end_of_file_ = true;
...@@ -66,7 +66,7 @@ class WebMVideoSource : public CompressedVideoSource { ...@@ -66,7 +66,7 @@ class WebMVideoSource : public CompressedVideoSource {
void SeekToNextKeyFrame() { void SeekToNextKeyFrame() {
ASSERT_TRUE(aom_ctx_->file != NULL); ASSERT_TRUE(aom_ctx_->file != NULL);
do { do {
const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_); const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_);
ASSERT_GE(status, 0) << "webm_read_frame failed"; ASSERT_GE(status, 0) << "webm_read_frame failed";
++frame_; ++frame_;
if (status == 1) { if (status == 1) {
......
...@@ -118,7 +118,7 @@ int file_is_webm(struct WebmInputContext *webm_ctx, ...@@ -118,7 +118,7 @@ int file_is_webm(struct WebmInputContext *webm_ctx,
} }
int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
size_t *bytes_in_buffer, size_t *buffer_size) { size_t *buffer_size) {
// This check is needed for frame parallel decoding, in which case this // This check is needed for frame parallel decoding, in which case this
// function could be called even after it has reached end of input stream. // function could be called even after it has reached end of input stream.
if (webm_ctx->reached_eos) { if (webm_ctx->reached_eos) {
...@@ -142,7 +142,7 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, ...@@ -142,7 +142,7 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
} else if (block_entry_eos || block_entry->EOS()) { } else if (block_entry_eos || block_entry->EOS()) {
cluster = segment->GetNext(cluster); cluster = segment->GetNext(cluster);
if (cluster == NULL || cluster->EOS()) { if (cluster == NULL || cluster->EOS()) {
*bytes_in_buffer = 0; *buffer_size = 0;
webm_ctx->reached_eos = 1; webm_ctx->reached_eos = 1;
return 1; return 1;
} }
...@@ -159,7 +159,7 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, ...@@ -159,7 +159,7 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
} }
get_new_block = true; get_new_block = true;
} }
if (status) { if (status || block_entry == NULL) {
return -1; return -1;
} }
if (get_new_block) { if (get_new_block) {
...@@ -182,10 +182,9 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, ...@@ -182,10 +182,9 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
if (*buffer == NULL) { if (*buffer == NULL) {
return -1; return -1;
} }
*buffer_size = frame.len;
webm_ctx->buffer = *buffer; webm_ctx->buffer = *buffer;
} }
*bytes_in_buffer = frame.len; *buffer_size = frame.len;
webm_ctx->timestamp_ns = block->GetTime(cluster); webm_ctx->timestamp_ns = block->GetTime(cluster);
webm_ctx->is_key_frame = block->IsKey(); webm_ctx->is_key_frame = block->IsKey();
...@@ -198,10 +197,9 @@ int webm_guess_framerate(struct WebmInputContext *webm_ctx, ...@@ -198,10 +197,9 @@ int webm_guess_framerate(struct WebmInputContext *webm_ctx,
struct AvxInputContext *aom_ctx) { struct AvxInputContext *aom_ctx) {
uint32_t i = 0; uint32_t i = 0;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
size_t bytes_in_buffer = 0;
size_t buffer_size = 0; size_t buffer_size = 0;
while (webm_ctx->timestamp_ns < 1000000000 && i < 50) { while (webm_ctx->timestamp_ns < 1000000000 && i < 50) {
if (webm_read_frame(webm_ctx, &buffer, &bytes_in_buffer, &buffer_size)) { if (webm_read_frame(webm_ctx, &buffer, &buffer_size)) {
break; break;
} }
++i; ++i;
......
...@@ -43,21 +43,18 @@ int file_is_webm(struct WebmInputContext *webm_ctx, ...@@ -43,21 +43,18 @@ int file_is_webm(struct WebmInputContext *webm_ctx,
// Reads a WebM Video Frame. Memory for the buffer is created, owned and managed // Reads a WebM Video Frame. Memory for the buffer is created, owned and managed
// by this function. For the first call, |buffer| should be NULL and // by this function. For the first call, |buffer| should be NULL and
// |*bytes_in_buffer| should be 0. Once all the frames are read and used, // |*buffer_size| should be 0. Once all the frames are read and used,
// webm_free() should be called, otherwise there will be a leak. // webm_free() should be called, otherwise there will be a leak.
// Parameters: // Parameters:
// webm_ctx - WebmInputContext object // webm_ctx - WebmInputContext object
// buffer - pointer where the frame data will be filled. // buffer - pointer where the frame data will be filled.
// bytes_in_buffer - pointer to buffer size. // buffer_size - pointer to buffer size.
// buffer_size - unused TODO(vigneshv): remove this
// Return values: // Return values:
// 0 - Success // 0 - Success
// 1 - End of Stream // 1 - End of Stream
// -1 - Error // -1 - Error
// TODO(vigneshv): Make the return values consistent across all functions in
// this file.
int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
size_t *bytes_in_buffer, size_t *buffer_size); size_t *buffer_size);
// Guesses the frame rate of the input file based on the container timestamps. // Guesses the frame rate of the input file based on the container timestamps.
int webm_guess_framerate(struct WebmInputContext *webm_ctx, int webm_guess_framerate(struct WebmInputContext *webm_ctx,
......
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