vf_psnr/ssim: don't crash if stats_file is NULL.
This commit is contained in:
		
							parent
							
								
									a60539bb5e
								
							
						
					
					
						commit
						0c7b44a01c
					
				@ -193,9 +193,10 @@ static av_cold int init(AVFilterContext *ctx)
 | 
			
		||||
    s->min_mse = +INFINITY;
 | 
			
		||||
    s->max_mse = -INFINITY;
 | 
			
		||||
 | 
			
		||||
    if (s->stats_file_str) {
 | 
			
		||||
        if (!strcmp(s->stats_file_str, "-")) {
 | 
			
		||||
            s->stats_file = stdout;
 | 
			
		||||
    } else if (s->stats_file_str) {
 | 
			
		||||
        } else {
 | 
			
		||||
            s->stats_file = fopen(s->stats_file_str, "w");
 | 
			
		||||
            if (!s->stats_file) {
 | 
			
		||||
                int err = AVERROR(errno);
 | 
			
		||||
@ -206,6 +207,7 @@ static av_cold int init(AVFilterContext *ctx)
 | 
			
		||||
                return err;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    s->dinput.process = do_psnr;
 | 
			
		||||
    return 0;
 | 
			
		||||
 | 
			
		||||
@ -223,9 +223,10 @@ static av_cold int init(AVFilterContext *ctx)
 | 
			
		||||
{
 | 
			
		||||
    SSIMContext *s = ctx->priv;
 | 
			
		||||
 | 
			
		||||
    if (s->stats_file_str) {
 | 
			
		||||
        if (!strcmp(s->stats_file_str, "-")) {
 | 
			
		||||
            s->stats_file = stdout;
 | 
			
		||||
    } else if (s->stats_file_str) {
 | 
			
		||||
        } else {
 | 
			
		||||
            s->stats_file = fopen(s->stats_file_str, "w");
 | 
			
		||||
            if (!s->stats_file) {
 | 
			
		||||
                int err = AVERROR(errno);
 | 
			
		||||
@ -236,6 +237,7 @@ static av_cold int init(AVFilterContext *ctx)
 | 
			
		||||
                return err;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    s->dinput.process = do_ssim;
 | 
			
		||||
    s->dinput.shortest = 1;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user