Re: [FFmpeg-devel] [PATCH 07/11] avformat/dashenc: logic to compute bitrate overhead

2018-04-01 Thread Jeyapal, Karthick


On 3/23/18 10:57 AM, vdi...@akamai.com wrote:
> From: Vishwanath Dixit 
>
> ---
>  libavformat/dashenc.c | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index d20bdba..0ba9f55 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -86,6 +86,8 @@ typedef struct OutputStream {
>  char full_path[1024];
>  char temp_path[1024];
>  int64_t chunk_duration;
> +int total_pkt_size;
> +int bitrate_overhead;
Rename this variable to muxer_overhead, for easier understanding.
>  } OutputStream;
>  
>  typedef struct DASHContext {
> @@ -1209,6 +1211,13 @@ static int dash_flush(AVFormatContext *s, int final, 
> int stream)
>  }
>  }
>  
> +if (!os->bitrate_overhead)
> +os->bitrate_overhead = ((int64_t) (range_length - 
> os->total_pkt_size) *
> +8 * AV_TIME_BASE) /
> +   av_rescale_q(os->max_pts - os->start_pts,
> +st->time_base, 
> AV_TIME_BASE_Q);
> +os->total_pkt_size = 0;
> +
>  if (!os->bit_rate) {
>  // calculate average bitrate of first segment
>  int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
> av_rescale_q(os->max_pts - os->start_pts,
> @@ -1340,6 +1349,7 @@ static int dash_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  else
>  os->max_pts = FFMAX(os->max_pts, pkt->pts + pkt->duration);
>  os->packets_written++;
> +os->total_pkt_size += pkt->size;
>  if ((ret = ff_write_chained(os->ctx, 0, pkt, s, 0)) < 0)
>  return ret;
>  



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 07/11] avformat/dashenc: logic to compute bitrate overhead

2018-03-22 Thread vdixit
From: Vishwanath Dixit 

---
 libavformat/dashenc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index d20bdba..0ba9f55 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -86,6 +86,8 @@ typedef struct OutputStream {
 char full_path[1024];
 char temp_path[1024];
 int64_t chunk_duration;
+int total_pkt_size;
+int bitrate_overhead;
 } OutputStream;
 
 typedef struct DASHContext {
@@ -1209,6 +1211,13 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 }
 }
 
+if (!os->bitrate_overhead)
+os->bitrate_overhead = ((int64_t) (range_length - 
os->total_pkt_size) *
+8 * AV_TIME_BASE) /
+   av_rescale_q(os->max_pts - os->start_pts,
+st->time_base, AV_TIME_BASE_Q);
+os->total_pkt_size = 0;
+
 if (!os->bit_rate) {
 // calculate average bitrate of first segment
 int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
av_rescale_q(os->max_pts - os->start_pts,
@@ -1340,6 +1349,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 else
 os->max_pts = FFMAX(os->max_pts, pkt->pts + pkt->duration);
 os->packets_written++;
+os->total_pkt_size += pkt->size;
 if ((ret = ff_write_chained(os->ctx, 0, pkt, s, 0)) < 0)
 return ret;
 
-- 
1.9.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel