Pārlūkot izejas kodu

Fix memory leak in AudioPlaySdRaw

dds
PaulStoffregen pirms 10 gadiem
vecāks
revīzija
1b51f558fb
2 mainītis faili ar 2 papildinājumiem un 6 dzēšanām
  1. +2
    -5
      play_sd_raw.cpp
  2. +0
    -1
      play_sd_raw.h

+ 2
- 5
play_sd_raw.cpp Parādīt failu

@@ -30,10 +30,6 @@
void AudioPlaySdRaw::begin(void)
{
playing = false;
if (block) {
release(block);
block = NULL;
}
file_offset = 0;
file_size = 0;
}
@@ -70,6 +66,7 @@ void AudioPlaySdRaw::stop(void)
void AudioPlaySdRaw::update(void)
{
unsigned int i, n;
audio_block_t *block;

// only update if we're playing
if (!playing) return;
@@ -86,11 +83,11 @@ void AudioPlaySdRaw::update(void)
block->data[i] = 0;
}
transmit(block);
release(block);
} else {
rawfile.close();
playing = false;
}
release(block);
}

#define B2M (uint32_t)((double)4294967296000.0 / AUDIO_SAMPLE_RATE_EXACT / 2.0) // 97352592

+ 0
- 1
play_sd_raw.h Parādīt failu

@@ -43,7 +43,6 @@ public:
virtual void update(void);
private:
File rawfile;
audio_block_t *block;
uint32_t file_size;
uint32_t file_offset;
bool playing;

Notiek ielāde…
Atcelt
Saglabāt