Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: webrtc/test/testsupport/frame_reader.h

Issue 2362683002: New helper function test::ReadI420Buffer, refactor FrameReader to use it. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/test/testsupport/frame_reader.h
diff --git a/webrtc/test/testsupport/frame_reader.h b/webrtc/test/testsupport/frame_reader.h
index 9b50ec7bf4ac5df4c71c94cdaaf40fbc02aaf3a9..8c2e85851bddd4001eb052339e527ab14d1e5d18 100644
--- a/webrtc/test/testsupport/frame_reader.h
+++ b/webrtc/test/testsupport/frame_reader.h
@@ -15,9 +15,12 @@
#include <string>
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
+class I420Buffer;
+
namespace test {
// Handles reading of frames from video files.
@@ -34,7 +37,7 @@ class FrameReader {
// for the frame size.
// Returns true if there are more frames to read, false if we've already
// read the last frame (in the previous call).
- virtual bool ReadFrame(uint8_t* source_buffer) = 0;
+ virtual rtc::scoped_refptr<I420Buffer> ReadFrame() = 0;
// Closes the input file if open. Essentially makes this class impossible
// to use anymore. Will also be invoked by the destructor.
@@ -53,10 +56,10 @@ class FrameReaderImpl : public FrameReader {
// input_filename The file to read from.
// frame_length_in_bytes The size of each frame.
kjellander_webrtc 2016/09/22 11:29:37 Update/remove this documentation
nisse-webrtc 2016/09/22 11:48:15 Done.
// For YUV this is 3 * width * height / 2
- FrameReaderImpl(std::string input_filename, size_t frame_length_in_bytes);
+ FrameReaderImpl(std::string input_filename, int width, int height);
~FrameReaderImpl() override;
bool Init() override;
- bool ReadFrame(uint8_t* source_buffer) override;
+ rtc::scoped_refptr<I420Buffer> ReadFrame() override;
void Close() override;
size_t FrameLength() override;
int NumberOfFrames() override;
@@ -64,6 +67,8 @@ class FrameReaderImpl : public FrameReader {
private:
std::string input_filename_;
size_t frame_length_in_bytes_;
+ int width_;
+ int height_;
int number_of_frames_;
FILE* input_file_;
};

Powered by Google App Engine
This is Rietveld 408576698