* Actually use the client suggested buffer size.
* When the client didn't suggest it, take the sample size into account. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -373,18 +373,25 @@ AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
|
|||||||
outputAudioFormat.channel_count
|
outputAudioFormat.channel_count
|
||||||
= fInputFormat.u.encoded_audio.output.channel_count;
|
= fInputFormat.u.encoded_audio.output.channel_count;
|
||||||
outputAudioFormat.format = fInputFormat.u.encoded_audio.output.format;
|
outputAudioFormat.format = fInputFormat.u.encoded_audio.output.format;
|
||||||
|
outputAudioFormat.buffer_size
|
||||||
|
= inOutFormat->u.raw_audio.buffer_size;
|
||||||
// Check that format is not still a wild card!
|
// Check that format is not still a wild card!
|
||||||
if (outputAudioFormat.format == 0) {
|
if (outputAudioFormat.format == 0) {
|
||||||
TRACE(" format still a wild-card, assuming B_AUDIO_SHORT.\n");
|
TRACE(" format still a wild-card, assuming B_AUDIO_SHORT.\n");
|
||||||
outputAudioFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
|
outputAudioFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
|
||||||
}
|
}
|
||||||
|
size_t sampleSize = outputAudioFormat.format
|
||||||
|
& media_raw_audio_format::B_AUDIO_SIZE_MASK;
|
||||||
// Check that channel count is not still a wild card!
|
// Check that channel count is not still a wild card!
|
||||||
if (outputAudioFormat.channel_count == 0) {
|
if (outputAudioFormat.channel_count == 0) {
|
||||||
TRACE(" channel_count still a wild-card, assuming stereo.\n");
|
TRACE(" channel_count still a wild-card, assuming stereo.\n");
|
||||||
outputAudioFormat.channel_count = 2;
|
outputAudioFormat.channel_count = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputAudioFormat.buffer_size = 1024 * outputAudioFormat.channel_count;
|
if (outputAudioFormat.buffer_size == 0) {
|
||||||
|
outputAudioFormat.buffer_size = 512
|
||||||
|
* sampleSize * outputAudioFormat.channel_count;
|
||||||
|
}
|
||||||
inOutFormat->type = B_MEDIA_RAW_AUDIO;
|
inOutFormat->type = B_MEDIA_RAW_AUDIO;
|
||||||
inOutFormat->u.raw_audio = outputAudioFormat;
|
inOutFormat->u.raw_audio = outputAudioFormat;
|
||||||
|
|
||||||
@@ -423,8 +430,6 @@ AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
|
|||||||
fCodecInitDone = (result >= 0);
|
fCodecInitDone = (result >= 0);
|
||||||
|
|
||||||
fStartTime = 0;
|
fStartTime = 0;
|
||||||
size_t sampleSize = outputAudioFormat.format
|
|
||||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK;
|
|
||||||
fOutputFrameSize = sampleSize * outputAudioFormat.channel_count;
|
fOutputFrameSize = sampleSize * outputAudioFormat.channel_count;
|
||||||
fOutputFrameCount = outputAudioFormat.buffer_size / fOutputFrameSize;
|
fOutputFrameCount = outputAudioFormat.buffer_size / fOutputFrameSize;
|
||||||
fOutputFrameRate = outputAudioFormat.frame_rate;
|
fOutputFrameRate = outputAudioFormat.frame_rate;
|
||||||
|
|||||||
Reference in New Issue
Block a user