ff_get_audio_frame_size: try to fix wma in wav
Fixes Ticket1905, Ticket2114
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2713e43ac8
)
This commit is contained in:

committed by
Carl Eugen Hoyos

parent
10ac44198d
commit
302d2591dc
@@ -846,6 +846,13 @@ static int get_audio_frame_size(AVCodecContext *enc, int size, int mux)
|
|||||||
if (enc->frame_size > 1)
|
if (enc->frame_size > 1)
|
||||||
return enc->frame_size;
|
return enc->frame_size;
|
||||||
|
|
||||||
|
//For WMA we currently have no other means to calculate duration thus we
|
||||||
|
//do it here by assuming CBR, which is true for all known cases.
|
||||||
|
if(!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) {
|
||||||
|
if (enc->codec_id == AV_CODEC_ID_WMAV1 || enc->codec_id == AV_CODEC_ID_WMAV2)
|
||||||
|
return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user