File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,17 @@ class AACDecoderHelix : public CommonHelix {
68
68
return max_pcm_size == 0 ? AAC_MAX_OUTPUT_SIZE : max_pcm_size;
69
69
}
70
70
71
+ // / Used by M3A format
72
+ void setAudioInfo (int channels, int samplerate) {
73
+ memset (&aacFrameInfo, 0 , sizeof (AACFrameInfo));
74
+ aacFrameInfo.nChans = channels;
75
+ // aacFrameInfo.bitsPerSample = bits; not used
76
+ aacFrameInfo.sampRateCore = samplerate;
77
+ aacFrameInfo.profile = AAC_PROFILE_LC;
78
+ AACSetRawBlockParams (decoder, 0 , &aacFrameInfo);
79
+ }
80
+
81
+
71
82
protected:
72
83
HAACDecoder decoder = nullptr ;
73
84
AACDataCallback pcmCallback = nullptr ;
@@ -85,7 +96,7 @@ class AACDecoderHelix : public CommonHelix {
85
96
86
97
// / finds the sync word in the buffer
87
98
int findSynchWord (int offset=0 ) override {
88
- int result = AACFindSyncWord (frame_buffer+offset, buffer_size)+offset ;
99
+ int result = AACFindSyncWord (frame_buffer+offset, buffer_size); ;
89
100
return result < 0 ? result : result + offset;
90
101
}
91
102
Original file line number Diff line number Diff line change @@ -94,17 +94,23 @@ class CommonHelix {
94
94
LOG_HELIX (Info," allocating frame_buffer with %zu bytes" , maxFrameSize ());
95
95
frame_buffer = new uint8_t [maxFrameSize ()];
96
96
}
97
- if (pcm_buffer == nullptr ) {
98
- LOG_HELIX (Info," allocating pcm_buffer with %zu bytes" , maxPCMSize ());
99
- pcm_buffer = new short [maxPCMSize ()];
100
- }
101
97
memset (frame_buffer,0 , maxFrameSize ());
98
+ if (frame_buffer==nullptr ){
99
+ LOG_HELIX (Error, " Not enough memory for buffers" );
100
+ active = false ;
101
+ return ;
102
+ }
103
+ }
104
+
105
+ if (pcm_buffer == nullptr ) {
106
+ LOG_HELIX (Info," allocating pcm_buffer with %zu bytes" , maxPCMSize ());
107
+ pcm_buffer = new short [maxPCMSize ()];
102
108
}
103
- if (pcm_buffer==nullptr || frame_buffer== nullptr ){
109
+ if (pcm_buffer==nullptr ){
104
110
LOG_HELIX (Error, " Not enough memory for buffers" );
105
111
active = false ;
106
112
return ;
107
- }
113
+ }
108
114
memset (pcm_buffer,0 , maxPCMSize ());
109
115
active = true ;
110
116
}
You can’t perform that action at this time.
0 commit comments