forked from xiaozhi/xiaozhi-esp32
opus encode valid data packets
This commit is contained in:
@@ -427,6 +427,7 @@ void Application::AudioDecodeTask() {
|
|||||||
AudioPacket* packet;
|
AudioPacket* packet;
|
||||||
xQueueReceive(audio_decode_queue_, &packet, portMAX_DELAY);
|
xQueueReceive(audio_decode_queue_, &packet, portMAX_DELAY);
|
||||||
|
|
||||||
|
if (packet->type == kAudioPacketTypeData) {
|
||||||
int frame_size = opus_decode_sample_rate_ / 1000 * opus_duration_ms_;
|
int frame_size = opus_decode_sample_rate_ / 1000 * opus_duration_ms_;
|
||||||
packet->pcm.resize(frame_size);
|
packet->pcm.resize(frame_size);
|
||||||
|
|
||||||
@@ -443,6 +444,7 @@ void Application::AudioDecodeTask() {
|
|||||||
assert(0 == silk_resampler(&resampler_state_, resampled.data(), packet->pcm.data(), frame_size));
|
assert(0 == silk_resampler(&resampler_state_, resampled.data(), packet->pcm.data(), frame_size));
|
||||||
packet->pcm = std::move(resampled);
|
packet->pcm = std::move(resampled);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
audio_device_.QueueAudioPacket(packet);
|
audio_device_.QueueAudioPacket(packet);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user