diff --git a/.cproject b/.cproject
index 83b23738..e36aaf57 100644
--- a/.cproject
+++ b/.cproject
@@ -52,6 +52,7 @@
+
@@ -338,7 +339,7 @@
cmake
- -G "Unix Makefiles" ../ -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -D"ENABLE_BLACKMAGIC=0" -D"CMAKE_BUILD_TYPE:STRING=Debug"
+ -G "Unix Makefiles" ../ -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -D"ENABLE_BLACKMAGIC=0" -D"CMAKE_BUILD_TYPE:STRING=Debug"
true
false
diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp
index b8666d6a..1e7814da 100644
--- a/src/FFmpegReader.cpp
+++ b/src/FFmpegReader.cpp
@@ -870,6 +870,9 @@ void FFmpegReader::ProcessAudioPacket(int requested_frame, int target_frame, int
int16_t *audio_buf = new int16_t[AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
int packet_samples = 0;
+ uint8_t *original_packet_data = my_packet->data;
+ int original_packet_size = my_packet->size;
+
while (my_packet->size > 0) {
// re-initialize buffer size (it gets changed in the avcodec_decode_audio2 method call)
int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE;
@@ -888,6 +891,10 @@ void FFmpegReader::ProcessAudioPacket(int requested_frame, int target_frame, int
my_packet->size -= used;
}
+ // Restore packet size and data (to avoid crash in av_free_packet)
+ my_packet->data = original_packet_data;
+ my_packet->size = original_packet_size;
+
// Estimate the # of samples and the end of this packet's location (to prevent GAPS for the next timestamp)
int pts_remaining_samples = packet_samples / info.channels; // Adjust for zero based array
@@ -935,11 +942,7 @@ void FFmpegReader::ProcessAudioPacket(int requested_frame, int target_frame, int
}
#pragma omp critical (packet_cache)
- {
- // Remove packet
- av_init_packet(my_packet); // TODO: this is a hack, to prevent a bug calling av_free_packet after avcodec_decode_audio3(). It causes a memory leak by not freeing pkt->data.
- RemoveAVPacket(my_packet);
- }
+ RemoveAVPacket(my_packet);
#pragma omp task firstprivate(requested_frame, target_frame, my_cache, starting_sample, audio_buf)
{
diff --git a/src/Main.cpp b/src/Main.cpp
index 91d39508..8b07ecb3 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -60,7 +60,10 @@ int main(int argc, char* argv[])
//f->AddOverlayNumber(frame_number);
//f->Display();
- if (x == 5000)
+ if (x == 32)
+ sinelReader.debug = true;
+
+ if (x == 50)
break;
}