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

Unified Diff: webrtc/modules/video_coding/utility/ivf_file_writer.h

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Nit 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
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.cc ('k') | webrtc/modules/video_coding/utility/ivf_file_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/utility/ivf_file_writer.h
diff --git a/webrtc/modules/video_coding/utility/ivf_file_writer.h b/webrtc/modules/video_coding/utility/ivf_file_writer.h
index 25d68a2803498efd562208ac7ca0b86f2bf4ffbf..b556111aa5c1fc436dea85e967d65e9f269ee652 100644
--- a/webrtc/modules/video_coding/utility/ivf_file_writer.h
+++ b/webrtc/modules/video_coding/utility/ivf_file_writer.h
@@ -15,38 +15,42 @@
#include <string>
#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/file.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/video_frame.h"
-#include "webrtc/system_wrappers/include/file_wrapper.h"
namespace webrtc {
class IvfFileWriter {
public:
+ // Takes ownership of the file, which will be closed either through
+ // Close or ~IvfFileWriter. If writing a frame would take the file above the
+ // |byte_limit| the file will be closed, the write (and all future writes)
+ // will fail. A |byte_limit| of 0 is equivalent to no limit.
+ static std::unique_ptr<IvfFileWriter> Wrap(rtc::File file, size_t byte_limit);
~IvfFileWriter();
- static std::unique_ptr<IvfFileWriter> Open(const std::string& file_name,
- VideoCodecType codec_type);
- bool WriteFrame(const EncodedImage& encoded_image);
+ bool WriteFrame(const EncodedImage& encoded_image, VideoCodecType codec_type);
bool Close();
private:
- IvfFileWriter(const std::string& path_name,
- std::unique_ptr<FileWrapper> file,
- VideoCodecType codec_type);
+ explicit IvfFileWriter(rtc::File file, size_t byte_limit);
+
bool WriteHeader();
- bool InitFromFirstFrame(const EncodedImage& encoded_image);
+ bool InitFromFirstFrame(const EncodedImage& encoded_image,
+ VideoCodecType codec_type);
- const VideoCodecType codec_type_;
+ VideoCodecType codec_type_;
+ size_t bytes_written_;
+ size_t byte_limit_;
size_t num_frames_;
uint16_t width_;
uint16_t height_;
int64_t last_timestamp_;
bool using_capture_timestamps_;
rtc::TimestampWrapAroundHandler wrap_handler_;
- const std::string file_name_;
- std::unique_ptr<FileWrapper> file_;
+ rtc::File file_;
RTC_DISALLOW_COPY_AND_ASSIGN(IvfFileWriter);
};
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.cc ('k') | webrtc/modules/video_coding/utility/ivf_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698