media-playback: Fix possible crash on startup
Frame width/height check crash if the frame is not given. We can reorder width/height check after other precondition checks.
This commit is contained in:
parent
c96366eafb
commit
22c4e11ec8
1 changed files with 6 additions and 6 deletions
|
|
@ -382,12 +382,6 @@ void mp_media_next_video(mp_media_t *m, bool preload)
|
||||||
enum video_range_type new_range;
|
enum video_range_type new_range;
|
||||||
AVFrame *f = d->frame;
|
AVFrame *f = d->frame;
|
||||||
|
|
||||||
if (!f->width || !f->height) {
|
|
||||||
blog(LOG_ERROR, "MP: media frame width or height are zero ('%s': %" PRIu32 "x%" PRIu32 ")", m->path,
|
|
||||||
f->width, f->height);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preload) {
|
if (!preload) {
|
||||||
if (!mp_media_can_play_frame(m, d))
|
if (!mp_media_can_play_frame(m, d))
|
||||||
return;
|
return;
|
||||||
|
|
@ -400,6 +394,12 @@ void mp_media_next_video(mp_media_t *m, bool preload)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!f->width || !f->height) {
|
||||||
|
blog(LOG_ERROR, "MP: media frame width or height are zero ('%s': %" PRIu32 "x%" PRIu32 ")", m->path,
|
||||||
|
f->width, f->height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool flip = false;
|
bool flip = false;
|
||||||
if (m->swscale) {
|
if (m->swscale) {
|
||||||
int ret = sws_scale(m->swscale, (const uint8_t *const *)f->data, f->linesize, 0, f->height,
|
int ret = sws_scale(m->swscale, (const uint8_t *const *)f->data, f->linesize, 0, f->height,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue