diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index de2d954..7b20f56 100644
a
|
b
|
bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, |
3985 | 3985 | int ret = 0; |
3986 | 3986 | int data_size = 0; |
3987 | 3987 | bool firstloop = true; |
3988 | | int frames = -1; |
| 3988 | int decoded_size = -1; |
3989 | 3989 | |
3990 | 3990 | avcodeclock->lock(); |
3991 | 3991 | int audIdx = selectedTrack[kTrackTypeAudio].av_stream_index; |
… |
… |
bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, |
4048 | 4048 | data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; |
4049 | 4049 | ret = avcodec_decode_audio3(ctx, audioSamples, |
4050 | 4050 | &data_size, &tmp_pkt); |
4051 | | frames = data_size / |
4052 | | (ctx->channels * |
4053 | | av_get_bits_per_sample_fmt(ctx->sample_fmt)>>3); |
| 4051 | decoded_size = data_size; |
4054 | 4052 | already_decoded = true; |
4055 | 4053 | reselectAudioTrack |= ctx->channels; |
4056 | 4054 | } |
… |
… |
bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, |
4103 | 4101 | data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; |
4104 | 4102 | ret = avcodec_decode_audio3(ctx, audioSamples, &data_size, |
4105 | 4103 | &tmp_pkt); |
4106 | | frames = data_size / |
4107 | | (ctx->channels * |
4108 | | av_get_bits_per_sample_fmt(ctx->sample_fmt)>>3); |
| 4104 | decoded_size = data_size; |
4109 | 4105 | } |
4110 | 4106 | else |
4111 | | frames = -1; |
| 4107 | decoded_size = -1; |
4112 | 4108 | } |
4113 | 4109 | memcpy(audioSamples, tmp_pkt.data, tmp_pkt.size); |
4114 | 4110 | data_size = tmp_pkt.size; |
… |
… |
bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, |
4131 | 4127 | data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; |
4132 | 4128 | ret = avcodec_decode_audio3(ctx, audioSamples, &data_size, |
4133 | 4129 | &tmp_pkt); |
4134 | | frames = data_size / |
4135 | | (ctx->channels * |
4136 | | av_get_bits_per_sample_fmt(ctx->sample_fmt)>>3); |
| 4130 | decoded_size = data_size; |
4137 | 4131 | } |
4138 | 4132 | |
4139 | 4133 | // When decoding some audio streams the number of |
… |
… |
bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, |
4170 | 4164 | extract_mono_channel(audSubIdx, &audioOut, |
4171 | 4165 | (char *)audioSamples, data_size); |
4172 | 4166 | |
| 4167 | int frames = (ctx->channels <= 0 || decoded_size < 0) ? -1 : |
| 4168 | decoded_size / (ctx->channels * |
| 4169 | av_get_bits_per_sample_fmt(ctx->sample_fmt)>>3); |
4173 | 4170 | m_audio->AddAudioData((char *)audioSamples, data_size, temppts, frames); |
4174 | 4171 | if (audioOut.do_passthru && !m_audio->NeedDecodingBeforePassthrough()) |
4175 | 4172 | { |