Skip to content

Commit

Permalink
fix a crash bug: when media resource not video or audio, the player w…
Browse files Browse the repository at this point in the history
…ill crash.
  • Loading branch information
lionel0806 committed Jul 2, 2015
1 parent 85b6cf7 commit 74f0f7d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ijkmedia/ijkplayer/ff_ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -3408,9 +3408,15 @@ void ffp_check_buffering_l(FFPlayer *ffp)
int buf_time_percent = -1;
int hwm_in_bytes = ffp->high_water_mark_in_bytes;
int need_start_buffering = 0;
int audio_time_base_valid = is->audio_st && is->audio_st->time_base.den > 0 && is->audio_st->time_base.num > 0;
int video_time_base_valid = is->video_st && is->video_st->time_base.den > 0 && is->video_st->time_base.num > 0;
int audio_time_base_valid = 0;
int video_time_base_valid = 0;
int64_t buf_time_position = -1;

if(is->audio_st)
audio_time_base_valid = is->audio_st->time_base.den > 0 && is->audio_st->time_base.num > 0;
if(is->video_st)
video_time_base_valid = is->video_st->time_base.den > 0 && is->video_st->time_base.num > 0;

if (hwm_in_ms > 0) {
int cached_duration_in_ms = -1;
int64_t audio_cached_duration = -1;
Expand Down

0 comments on commit 74f0f7d

Please sign in to comment.