return audio16;\r
}\r
\r
+static std::vector<int8_t> audio_32_to_24(const boost::iterator_range<int32_t*>& input)\r
+{ \r
+ std::vector<int8_t> audio24(input.size()*3+16);\r
+ auto audio32_ptr = reinterpret_cast<const uint32_t*>(input.begin());\r
+ auto audio24_ptr = reinterpret_cast<uint8_t*>(audio24.data());\r
+ auto size = input.size();\r
+ for(int n = 0; n < size; ++n) \r
+ *reinterpret_cast<uint32_t*>(audio24_ptr + n*3) = *(audio32_ptr + n) >> 8; \r
+ audio24.resize(input.size());\r
+ return audio24;\r
+}\r
+\r
}}
\ No newline at end of file
\r
void schedule_next_video(const safe_ptr<core::read_frame>& frame)\r
{\r
- static std::vector<int16_t> silence(MAX_HANC_BUFFER_SIZE, 0);\r
+ static std::vector<int8_t> silence(MAX_HANC_BUFFER_SIZE, 0);\r
\r
executor_.begin_invoke([=]\r
{\r
\r
if(embedded_audio_)\r
{ \r
- auto frame_audio = core::audio_32_to_16(frame->audio_data());\r
+ auto frame_audio = core::audio_32_to_24(frame->audio_data());\r
auto frame_audio_data = frame_audio.size() != audio_samples ? silence.data() : frame_audio.data(); \r
\r
encode_hanc(reinterpret_cast<BLUE_UINT32*>(reserved_frames_.front()->hanc_data()), frame_audio_data, audio_samples, audio_nchannels);\r
\r
void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r
{ \r
- const auto sample_type = AUDIO_CHANNEL_16BIT | AUDIO_CHANNEL_LITTLEENDIAN;\r
+ const auto sample_type = AUDIO_CHANNEL_24BIT | AUDIO_CHANNEL_LITTLEENDIAN;\r
const auto emb_audio_flag = blue_emb_audio_enable | blue_emb_audio_group1_enable;\r
\r
hanc_stream_info_struct hanc_stream_info;\r