[FFmpeg-cvslog] Revert "lavf/dashenc: update bitrates on dash_write_trailer"
James Almer
git at videolan.org
Tue Sep 26 20:32:20 EEST 2017
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Sep 26 13:59:56 2017 -0300| [52223ffe44614738499ea6c0068810e250fb7b26] | committer: James Almer
Revert "lavf/dashenc: update bitrates on dash_write_trailer"
This reverts commit 89c0fda5f43d8a3d3a1c538ff8d72e6737bc7d8e.
A different solution will be committed instead.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52223ffe44614738499ea6c0068810e250fb7b26
---
libavformat/dashenc.c | 42 ++++++++++++------------------------------
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 6471649eb7..ca24015115 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -443,30 +443,6 @@ static int write_manifest(AVFormatContext *s, int final)
return 0;
}
-static int set_bitrate(AVFormatContext *s)
-{
- DASHContext *c = s->priv_data;
- int i;
-
- for (i = 0; i < s->nb_streams; i++) {
- OutputStream *os = &c->streams[i];
-
- os->bit_rate = s->streams[i]->codecpar->bit_rate;
- if (os->bit_rate) {
- snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
- " bandwidth=\"%d\"", os->bit_rate);
- } else {
- int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
- AV_LOG_ERROR : AV_LOG_WARNING;
- av_log(s, level, "No bit rate set for stream %d\n", i);
- if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
- return AVERROR(EINVAL);
- }
- }
-
- return 0;
-}
-
static int dash_init(AVFormatContext *s)
{
DASHContext *c = s->priv_data;
@@ -503,10 +479,6 @@ static int dash_init(AVFormatContext *s)
if (!c->streams)
return AVERROR(ENOMEM);
- ret = set_bitrate(s);
- if (ret < 0)
- return ret;
-
for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[i];
AVFormatContext *ctx;
@@ -514,6 +486,18 @@ static int dash_init(AVFormatContext *s)
AVDictionary *opts = NULL;
char filename[1024];
+ os->bit_rate = s->streams[i]->codecpar->bit_rate;
+ if (os->bit_rate) {
+ snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+ " bandwidth=\"%d\"", os->bit_rate);
+ } else {
+ int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
+ AV_LOG_ERROR : AV_LOG_WARNING;
+ av_log(s, level, "No bit rate set for stream %d\n", i);
+ if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
+ return AVERROR(EINVAL);
+ }
+
ctx = avformat_alloc_context();
if (!ctx)
return AVERROR(ENOMEM);
@@ -878,8 +862,6 @@ static int dash_write_trailer(AVFormatContext *s)
{
DASHContext *c = s->priv_data;
- set_bitrate(s);
-
if (s->nb_streams > 0) {
OutputStream *os = &c->streams[0];
// If no segments have been written so far, try to do a crude
More information about the ffmpeg-cvslog
mailing list