Fix FRAME delimiter is not handled properly in yuv/y4m reader
Note that sdk/android/api/org/webrtc/FileVideoCapturer.java is handling correctly. Bug: None Change-Id: I3a9783d75bd0a4b3a454b87a01039154200c4d29 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256581 Auto-Submit: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36315}
This commit is contained in:
parent
6a15e3ba5c
commit
0c28820dcd
@ -204,9 +204,10 @@ rtc::scoped_refptr<Video> OpenY4mFile(const std::string& file_name) {
|
||||
const int i420_frame_size = 3 * *width * *height / 2;
|
||||
std::vector<fpos_t> frame_positions;
|
||||
while (true) {
|
||||
int parse_frame_header_result = -1;
|
||||
if (fscanf(file, "FRAME\n%n", &parse_frame_header_result) != 0 ||
|
||||
parse_frame_header_result == -1) {
|
||||
std::array<char, 6> read_buffer;
|
||||
if (fread(read_buffer.data(), 1, read_buffer.size(), file) <
|
||||
read_buffer.size() ||
|
||||
memcmp(read_buffer.data(), "FRAME\n", read_buffer.size()) != 0) {
|
||||
if (!feof(file)) {
|
||||
RTC_LOG(LS_ERROR) << "Did not find FRAME header, ignoring rest of file";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user