diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp index a83533de1ebba..8fed06ef08e1b 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp @@ -276,10 +276,12 @@ unsigned int CActiveAEStream::AddData(uint8_t* const *data, unsigned int offset, if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD) { m_currentBuffer->pkt->nb_samples += 2560; - uint8_t highByte = (minFrames >> 8) & 0xFF; - uint8_t lowByte = minFrames & 0xFF; - memcpy(m_currentBuffer->pkt->data[0]+m_currentBuffer->pkt->nb_samples-2, &highByte, 1); - memcpy(m_currentBuffer->pkt->data[0]+m_currentBuffer->pkt->nb_samples-1, &lowByte, 1); + // Copies the high byte and the low byte + // Reason: We cannot assume that on every architecture an int is a byte array + // therefore we set those values per manual byte access. An alternative would be memcpy + // but this cannot be optimized that fine as the following code + *((uint8_t *) m_currentBuffer->pkt->data[0]+m_currentBuffer->pkt->nb_samples-2) = (uint8_t) ((minFrames >> 8) & 0xFF); + *((uint8_t *) m_currentBuffer->pkt->data[0]+m_currentBuffer->pkt->nb_samples-1) = (uint8_t) (minFrames & 0xFF); m_bufferedTime += m_format.m_streamInfo.GetDuration() / 1000 / 24; if (m_currentBuffer->pkt->nb_samples / 2560 == 24) rawPktComplete = true;