summaryrefslogtreecommitdiff
path: root/libavformat/flvenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r--libavformat/flvenc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index e6e3d7a011..b544b55568 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -121,7 +121,7 @@ static int mp3info(void *data, int *byteSize, int *samplesPerFrame, int *sampleR
}
}
- *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot);
+ *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) );
return 1;
}
@@ -295,8 +295,15 @@ static int flv_write_packet(AVFormatContext *s, int stream_index,
int mp3SampleRate = 0;
int mp3IsMono = 0;
int mp3SamplesPerFrame = 0;
+ int c=0;
+
+ /* copy out mp3 header from ring buffer */
+ uint8_t header[4];
+ for (c=0; c<4; c++) {
+ header[c] = flv->audio_fifo[(flv->audioInPos+c) % AUDIO_FIFO_SIZE];
+ }
- if ( mp3info(&flv->audioFifo[flv->audioInPos],&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
+ if ( mp3info(header,&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
if ( flv->audioSize >= mp3FrameSize ) {
int soundFormat = 0x22;