encoder/opus: use new[] instead of xalloc()
This commit is contained in:
parent
4a49f3cce8
commit
f8570dd79f
@ -21,7 +21,6 @@
|
|||||||
#include "OggEncoder.hxx"
|
#include "OggEncoder.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "config/Domain.hxx"
|
#include "config/Domain.hxx"
|
||||||
#include "util/Alloc.hxx"
|
|
||||||
#include "util/ByteOrder.hxx"
|
#include "util/ByteOrder.hxx"
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ OpusEncoder::OpusEncoder(AudioFormat &_audio_format, ::OpusEncoder *_enc, bool _
|
|||||||
frame_size(_audio_format.GetFrameSize()),
|
frame_size(_audio_format.GetFrameSize()),
|
||||||
buffer_frames(_audio_format.sample_rate / 50),
|
buffer_frames(_audio_format.sample_rate / 50),
|
||||||
buffer_size(frame_size * buffer_frames),
|
buffer_size(frame_size * buffer_frames),
|
||||||
buffer((unsigned char *)xalloc(buffer_size)),
|
buffer(new uint8_t[buffer_size]),
|
||||||
enc(_enc)
|
enc(_enc)
|
||||||
{
|
{
|
||||||
opus_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&lookahead));
|
opus_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&lookahead));
|
||||||
@ -181,7 +180,7 @@ PreparedOpusEncoder::Open(AudioFormat &audio_format)
|
|||||||
|
|
||||||
OpusEncoder::~OpusEncoder()
|
OpusEncoder::~OpusEncoder()
|
||||||
{
|
{
|
||||||
free(buffer);
|
delete[] buffer;
|
||||||
opus_encoder_destroy(enc);
|
opus_encoder_destroy(enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +324,7 @@ OpusEncoder::GenerateTags(const Tag *tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *comments = (unsigned char *)xalloc(comments_size);
|
unsigned char *comments = new unsigned char[comments_size];
|
||||||
unsigned char *p = comments;
|
unsigned char *p = comments;
|
||||||
|
|
||||||
memcpy(comments, "OpusTags", 8);
|
memcpy(comments, "OpusTags", 8);
|
||||||
@ -369,7 +368,7 @@ OpusEncoder::GenerateTags(const Tag *tag)
|
|||||||
stream.PacketIn(packet);
|
stream.PacketIn(packet);
|
||||||
Flush();
|
Flush();
|
||||||
|
|
||||||
free(comments);
|
delete[] comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user