Reland "Add IvfVideoFrameGenerator"
This is a reland of 712a26f3842b4eba1f38c3ba7371b1cf771fd232 Original change's description: > Add IvfVideoFrameGenerator > > Bug: webrtc:10138 > Change-Id: Iea590f334d22fb7d22077c9bdd3b5ba79691df2e > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160185 > Commit-Queue: Artem Titov <titovartem@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29902} Bug: webrtc:10138 Change-Id: If522d079f0a1e30d6f2b330792aa1d1fc043b8b8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160418 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29913}
This commit is contained in:
@ -122,6 +122,8 @@ absl::optional<EncodedImage> IvfFileReader::NextFrame() {
|
||||
// is missing it means there is a bug in error handling.
|
||||
RTC_DCHECK(next_frame_header_);
|
||||
int64_t current_timestamp = next_frame_header_->timestamp;
|
||||
// The first frame from the file should be marked as Key frame.
|
||||
bool is_first_frame = num_read_frames_ == 0;
|
||||
while (next_frame_header_ &&
|
||||
current_timestamp == next_frame_header_->timestamp) {
|
||||
// Resize payload to fit next spatial layer.
|
||||
@ -165,6 +167,10 @@ absl::optional<EncodedImage> IvfFileReader::NextFrame() {
|
||||
for (size_t i = 0; i < layer_sizes.size(); ++i) {
|
||||
image.SetSpatialLayerFrameSize(static_cast<int>(i), layer_sizes[i]);
|
||||
}
|
||||
if (is_first_frame) {
|
||||
image._frameType = VideoFrameType::kVideoFrameKey;
|
||||
}
|
||||
image._completeFrame = true;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@ class IvfFileReader {
|
||||
bool HasMoreFrames() const { return num_read_frames_ < num_frames_; }
|
||||
bool HasError() const { return has_error_; }
|
||||
|
||||
uint16_t GetFrameWidth() const { return width_; }
|
||||
uint16_t GetFrameHeight() const { return height_; }
|
||||
|
||||
bool Close();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user