Browse code

avformat/hlsenc: more robust error tests

errors are negative throughout ffmpeg

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/01/11 12:58:29
Showing 1 changed files
... ...
@@ -395,7 +395,7 @@ static int hls_write_header(AVFormatContext *s)
395 395
 fail:
396 396
 
397 397
     av_dict_free(&options);
398
-    if (ret) {
398
+    if (ret < 0) {
399 399
         av_freep(&hls->basename);
400 400
         if (hls->avf)
401 401
             avformat_free_context(hls->avf);
... ...
@@ -438,7 +438,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
438 438
         hls->size = new_start_pos - hls->start_pos;
439 439
         ret = hls_append_segment(hls, hls->duration, hls->start_pos, hls->size);
440 440
         hls->start_pos = new_start_pos;
441
-        if (ret)
441
+        if (ret < 0)
442 442
             return ret;
443 443
 
444 444
         hls->end_pts = pkt->pts;
... ...
@@ -454,7 +454,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
454 454
             ret = hls_start(s);
455 455
         }
456 456
 
457
-        if (ret)
457
+        if (ret < 0)
458 458
             return ret;
459 459
 
460 460
         oc = hls->avf;