demux, Frame: remove is_fragment_ field

this hasn't been set since parsing of the experimental chunk was
removed.
+ cleanup IsValidExtendedFormat(). is_fragmented has caused immediate
  failure since:
  4e2589f demux: restore strict fragment flag check

Change-Id: If9ecfc19556297100a6d5de1ba2cffdcbdc6c8fd
This commit is contained in:
James Zern 2015-12-15 17:38:37 -08:00
parent 466c92e829
commit ab714b8ac4

View File

@ -47,7 +47,6 @@ typedef struct Frame {
int duration_; int duration_;
WebPMuxAnimDispose dispose_method_; WebPMuxAnimDispose dispose_method_;
WebPMuxAnimBlend blend_method_; WebPMuxAnimBlend blend_method_;
int is_fragment_; // this is a frame fragment (and not a full frame).
int frame_num_; // the referent frame number for use in assembling fragments. int frame_num_; // the referent frame number for use in assembling fragments.
int complete_; // img_components_ contains a full image. int complete_; // img_components_ contains a full image.
ChunkData img_components_[2]; // 0=VP8{,L} 1=ALPH ChunkData img_components_[2]; // 0=VP8{,L} 1=ALPH
@ -597,16 +596,13 @@ static int IsValidExtendedFormat(const WebPDemuxer* const dmux) {
while (f != NULL) { while (f != NULL) {
const int cur_frame_set = f->frame_num_; const int cur_frame_set = f->frame_num_;
int frame_count = 0, fragment_count = 0; int frame_count = 0;
// Check frame properties and if the image is composed of fragments that // Check frame properties.
// each fragment came from a fragment.
for (; f != NULL && f->frame_num_ == cur_frame_set; f = f->next_) { for (; f != NULL && f->frame_num_ == cur_frame_set; f = f->next_) {
const ChunkData* const image = f->img_components_; const ChunkData* const image = f->img_components_;
const ChunkData* const alpha = f->img_components_ + 1; const ChunkData* const alpha = f->img_components_ + 1;
if (is_fragmented && !f->is_fragment_) return 0;
if (!is_fragmented && f->is_fragment_) return 0;
if (!is_animation && f->frame_num_ > 1) return 0; if (!is_animation && f->frame_num_ > 1) return 0;
if (f->complete_) { if (f->complete_) {
@ -631,16 +627,13 @@ static int IsValidExtendedFormat(const WebPDemuxer* const dmux) {
} }
if (f->width_ > 0 && f->height_ > 0 && if (f->width_ > 0 && f->height_ > 0 &&
!CheckFrameBounds(f, !(is_animation || is_fragmented), !CheckFrameBounds(f, !is_animation,
dmux->canvas_width_, dmux->canvas_height_)) { dmux->canvas_width_, dmux->canvas_height_)) {
return 0; return 0;
} }
fragment_count += f->is_fragment_;
++frame_count; ++frame_count;
} }
if (!is_fragmented && frame_count > 1) return 0;
if (fragment_count > 0 && frame_count != fragment_count) return 0;
} }
return 1; return 1;
} }