On 2013-04-26 09:56:22 +0200, Anton Khirnov wrote:
> CC:[email protected]
> ---
>  libavformat/hlsenc.c  |   14 +++++++++-----
>  libavformat/segment.c |   14 +++++++++-----
>  2 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 89980d7..ae11e34 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -250,18 +250,22 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>      AVFormatContext *oc = hls->avf;
>      AVStream *st = s->streams[pkt->stream_index];
>      int64_t end_pts = hls->recording_time * hls->number;
> -    int ret;
> +    int ret, can_split = 0;
>  
>      if (hls->start_pts == AV_NOPTS_VALUE) {
>          hls->start_pts = pkt->pts;
>          hls->end_pts   = pkt->pts;
>      }
>  
> -    if ((hls->has_video && st->codec->codec_type == AVMEDIA_TYPE_VIDEO)      
> &&
> -        av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
> -                      end_pts, AV_TIME_BASE_Q) >= 0 &&
> -        pkt->flags & AV_PKT_FLAG_KEY) {
> +    if (hls->has_video) {
> +        can_split = st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
> +                    pkt->flags & AV_PKT_FLAG_KEY;
> +    } else {
> +        can_split = 1;
> +    }

you could save the else if you initialized can_split to 1. same for
segment.c. Do as you prefer and feel free to push, rest is ok.

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to