--- a/sc2src/sc2mpd.cpp
+++ b/sc2src/sc2mpd.cpp
@@ -305,9 +305,20 @@
void OhmReceiverDriver::Process(OhmMsgAudio& aMsg)
{
+ unsigned int bytes = 0;
+ unsigned int allocbytes = 0;
+ char *buf = NULL;
+ bool needswap = false;
+
if (aMsg.Audio().Bytes() == 0) {
- LOGDEB("OhmReceiverDriver::Process: empty message\n");
- return;
+ if (aMsg.Halt()) {
+ LOGDEB("OhmReceiverDriver::Process: empty message with halt flag "
+ "set\n");
+ goto put_audio_message;
+ } else {
+ LOGDEB("OhmReceiverDriver::Process: ignoring empty message\n");
+ return;
+ }
}
m_obs.process(aMsg);
@@ -315,10 +326,10 @@
LOGDEB("OhmReceiverDriver::Process: halt flag set in message\n");
}
- unsigned int bytes = aMsg.Audio().Bytes();
+ bytes = aMsg.Audio().Bytes();
// We allocate a bit more space to avoir reallocations in the resampler
- unsigned int allocbytes = bytes + 100;
- char *buf = (char *)malloc(allocbytes);
+ allocbytes = bytes + 100;
+ buf = (char *)malloc(allocbytes);
if (buf == 0) {
LOGERR("OhmReceiverDriver::Process: can't allocate " <<
bytes << " bytes\n");
@@ -328,7 +339,6 @@
// Songcast data is always msb-first. Convert to desired order:
// depends on what downstream wants, and just as well we do it
// here because we copy the buf anyway.
- bool needswap = false;
switch (m_eater->input_border) {
case AudioEater::BO_MSB:
break;
@@ -350,6 +360,7 @@
memcpy(buf, aMsg.Audio().Ptr(), bytes);
}
+put_audio_message:
AudioMessage *ap = new
AudioMessage(aMsg.BitDepth(), aMsg.Channels(), aMsg.Samples(),
aMsg.SampleRate(), aMsg.Halt(), buf, allocbytes);