Commit 743e3393 authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review
Browse files

Merge "tests/*source: test file pointer before reading"

parents ad9ee2c9 66c7dffd
...@@ -49,7 +49,7 @@ class I420VideoSource : public VideoSource { ...@@ -49,7 +49,7 @@ class I420VideoSource : public VideoSource {
if (input_file_) if (input_file_)
fclose(input_file_); fclose(input_file_);
input_file_ = OpenTestDataFile(file_name_); input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_) << "Input file open failed. Filename: " ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_; << file_name_;
if (start_) { if (start_) {
fseek(input_file_, raw_sz_ * start_, SEEK_SET); fseek(input_file_, raw_sz_ * start_, SEEK_SET);
...@@ -92,6 +92,7 @@ class I420VideoSource : public VideoSource { ...@@ -92,6 +92,7 @@ class I420VideoSource : public VideoSource {
} }
virtual void FillFrame() { virtual void FillFrame() {
ASSERT_TRUE(input_file_ != NULL);
// Read a frame from input_file. // Read a frame from input_file.
if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) { if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) {
limit_ = frame_; limit_ = frame_;
......
...@@ -52,7 +52,7 @@ class IVFVideoSource : public CompressedVideoSource { ...@@ -52,7 +52,7 @@ class IVFVideoSource : public CompressedVideoSource {
virtual void Begin() { virtual void Begin() {
input_file_ = OpenTestDataFile(file_name_); input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_) << "Input file open failed. Filename: " ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_; << file_name_;
// Read file header // Read file header
...@@ -72,6 +72,7 @@ class IVFVideoSource : public CompressedVideoSource { ...@@ -72,6 +72,7 @@ class IVFVideoSource : public CompressedVideoSource {
} }
void FillFrame() { void FillFrame() {
ASSERT_TRUE(input_file_ != NULL);
uint8_t frame_hdr[kIvfFrameHdrSize]; uint8_t frame_hdr[kIvfFrameHdrSize];
// Check frame header and read a frame from input_file. // Check frame header and read a frame from input_file.
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)
......
...@@ -149,6 +149,7 @@ class TestVectorTest : public ::libvpx_test::DecoderTest, ...@@ -149,6 +149,7 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
virtual void DecompressedFrameHook(const vpx_image_t& img, virtual void DecompressedFrameHook(const vpx_image_t& img,
const unsigned int frame_number) { const unsigned int frame_number) {
ASSERT_TRUE(md5_file_ != NULL);
char expected_md5[33]; char expected_md5[33];
char junk[128]; char junk[128];
......
...@@ -99,7 +99,7 @@ class WebMVideoSource : public CompressedVideoSource { ...@@ -99,7 +99,7 @@ class WebMVideoSource : public CompressedVideoSource {
virtual void Begin() { virtual void Begin() {
input_file_ = OpenTestDataFile(file_name_); input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_) << "Input file open failed. Filename: " ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_; << file_name_;
nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb,
...@@ -130,6 +130,7 @@ class WebMVideoSource : public CompressedVideoSource { ...@@ -130,6 +130,7 @@ class WebMVideoSource : public CompressedVideoSource {
} }
void FillFrame() { void FillFrame() {
ASSERT_TRUE(input_file_ != NULL);
if (chunk_ >= chunks_) { if (chunk_ >= chunks_) {
unsigned int track; unsigned int track;
......
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