- better information about decoding results
This commit is contained in:
parent
83dd8f88b7
commit
5bbdec8452
|
|
@ -484,9 +484,10 @@ void AudioReceiver::processDecoded(Audio::DataWindow& output, int options)
|
||||||
output.add(mResampledFrame, mResampledLength);
|
output.add(mResampledFrame, mResampledLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
AudioReceiver::DecodeResult AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
||||||
{
|
{
|
||||||
bool result = false, /*had_cng = false, */had_decode = false;
|
DecodeResult result = DecodeResult_Skip;
|
||||||
|
bool had_decode = false;
|
||||||
|
|
||||||
// Get next packet from buffer
|
// Get next packet from buffer
|
||||||
RtpBuffer::ResultList rl;
|
RtpBuffer::ResultList rl;
|
||||||
|
|
@ -517,7 +518,7 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
||||||
if (mDecodedLength)
|
if (mDecodedLength)
|
||||||
{
|
{
|
||||||
processDecoded(output, options);
|
processDecoded(output, options);
|
||||||
result = true;
|
result = DecodeResult_Ok;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -569,7 +570,7 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
||||||
if (mDecodedLength)
|
if (mDecodedLength)
|
||||||
processDecoded(output, options);
|
processDecoded(output, options);
|
||||||
}
|
}
|
||||||
result = true;
|
result = DecodeResult_Ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -603,7 +604,7 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
||||||
if (mDecodedLength)
|
if (mDecodedLength)
|
||||||
processDecoded(output, options);
|
processDecoded(output, options);
|
||||||
}
|
}
|
||||||
result = true;
|
result = DecodeResult_Ok;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -644,14 +645,16 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, int options, int* rate)
|
||||||
processDecoded(output, options);
|
processDecoded(output, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = mFrameCount > 0;
|
result = mFrameCount > 0 ? DecodeResult_Ok : DecodeResult_Skip;
|
||||||
|
|
||||||
// Check for bitrate counter
|
// Check for bitrate counter
|
||||||
processStatisticsWithAmrCodec(mCodec.get());
|
processStatisticsWithAmrCodec(mCodec.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ICELogMedia(<< "RTP packet with tail.");
|
{
|
||||||
|
result = DecodeResult_BadPacket;
|
||||||
|
// ICELogMedia(<< "RTP packet with tail.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,14 @@ namespace MT
|
||||||
DecodeOptions_SkipDecode = 4
|
DecodeOptions_SkipDecode = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
bool getAudio(Audio::DataWindow& output, int options = DecodeOptions_ResampleToMainRate, int* rate = nullptr);
|
enum DecodeResult
|
||||||
|
{
|
||||||
|
DecodeResult_Ok,
|
||||||
|
DecodeResult_Skip,
|
||||||
|
DecodeResult_BadPacket
|
||||||
|
};
|
||||||
|
|
||||||
|
DecodeResult getAudio(Audio::DataWindow& output, int options = DecodeOptions_ResampleToMainRate, int* rate = nullptr);
|
||||||
|
|
||||||
// Looks for codec by payload type
|
// Looks for codec by payload type
|
||||||
Codec* findCodec(int payloadType);
|
Codec* findCodec(int payloadType);
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,10 @@ void SingleAudioStream::process(const std::shared_ptr<jrtplib::RTPPacket>& packe
|
||||||
void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed)
|
void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed)
|
||||||
{
|
{
|
||||||
while (output.filled() < needed)
|
while (output.filled() < needed)
|
||||||
if (!mReceiver.getAudio(output))
|
{
|
||||||
|
if (mReceiver.getAudio(output) != AudioReceiver::DecodeResult_Ok)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (output.filled() < needed)
|
if (output.filled() < needed)
|
||||||
ICELogError(<< "Not enough data for speaker's mixer");
|
ICELogError(<< "Not enough data for speaker's mixer");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue