projects
/
goodguy
/
cinelerra.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fbdd13b
)
fix valgrind memory leaks/reports, add cache to dump, fix hw probe frame leak, startu...
author
Good Guy
<good1.2guy@gmail.com>
Sat, 16 May 2020 22:14:53 +0000
(16:14 -0600)
committer
Good Guy
<good1.2guy@gmail.com>
Sat, 16 May 2020 22:14:53 +0000
(16:14 -0600)
cinelerra-5.1/cinelerra/cache.C
patch
|
blob
|
history
cinelerra-5.1/cinelerra/cache.h
patch
|
blob
|
history
cinelerra-5.1/cinelerra/edl.C
patch
|
blob
|
history
cinelerra-5.1/cinelerra/ffmpeg.C
patch
|
blob
|
history
cinelerra-5.1/cinelerra/mwindow.C
patch
|
blob
|
history
cinelerra-5.1/cinelerra/mwindow.h
patch
|
blob
|
history
cinelerra-5.1/cinelerra/performanceprefs.h
patch
|
blob
|
history
cinelerra-5.1/cinelerra/pluginlv2.C
patch
|
blob
|
history
cinelerra-5.1/cinelerra/pluginlv2.h
patch
|
blob
|
history
cinelerra-5.1/guicast/bcresources.C
patch
|
blob
|
history
diff --git
a/cinelerra-5.1/cinelerra/cache.C
b/cinelerra-5.1/cinelerra/cache.C
index 63bb4a0de4b32e9e5b9dcb0480c4f751c0f933c2..b8e2326dbc823d01aff508590875f8fb0ff420b3 100644
(file)
--- a/
cinelerra-5.1/cinelerra/cache.C
+++ b/
cinelerra-5.1/cinelerra/cache.C
@@
-273,16
+273,16
@@
int CICache::delete_oldest()
return result;
}
return result;
}
-void CICache::dump()
+void CICache::dump(
FILE *fp
)
{
CICacheItem *current;
total_lock->lock("CICache::dump");
{
CICacheItem *current;
total_lock->lock("CICache::dump");
-
printf(
"CICache::dump total size %jd\n", get_memory_usage(0));
+
fprintf(fp,
"CICache::dump total size %jd\n", get_memory_usage(0));
for(current = first; current; current = NEXT)
{
for(current = first; current; current = NEXT)
{
-
printf("cache item %p asset %p %s age=%d
\n",
- current, current->asset,
- current->a
sset->path, current->age
);
+
fprintf(fp, "cache item %p asset %p %s age=%d checked_out=%p
\n",
+ current, current->asset,
current->asset->path,
+ current->a
ge, (void*)current->checked_out
);
}
total_lock->unlock();
}
}
total_lock->unlock();
}
diff --git
a/cinelerra-5.1/cinelerra/cache.h
b/cinelerra-5.1/cinelerra/cache.h
index fde997a50289c41ee76f725681d6d2ad12eddc94..8ab4457f982ad370ae1bd3d3431260b921533572 100644
(file)
--- a/
cinelerra-5.1/cinelerra/cache.h
+++ b/
cinelerra-5.1/cinelerra/cache.h
@@
-104,10
+104,7
@@
public:
// deletes oldest assets until under the memory limit
int age();
// deletes oldest assets until under the memory limit
int age();
-
- void dump();
-
-
+ void dump(FILE *fp);
private:
// for deleting items
private:
// for deleting items
diff --git
a/cinelerra-5.1/cinelerra/edl.C
b/cinelerra-5.1/cinelerra/edl.C
index 6739dec89dab284da8dec9be63a6128e5e6fe0c0..130f80bb97c4557b1a26ff1b8587d0db21ef0e72 100644
(file)
--- a/
cinelerra-5.1/cinelerra/edl.C
+++ b/
cinelerra-5.1/cinelerra/edl.C
@@
-2278,6
+2278,8
@@
int EDL::collect_effects(EDL *&group)
}
if( !ret )
group = new_edl;
}
if( !ret )
group = new_edl;
+ else
+ new_edl->remove_user();
return ret;
}
return ret;
}
diff --git
a/cinelerra-5.1/cinelerra/ffmpeg.C
b/cinelerra-5.1/cinelerra/ffmpeg.C
index 58d280c00edf60315dd93d383e05196d9ee04a49..493be6abeace4e55e9eac4177964649a63c6fc2e 100644
(file)
--- a/
cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/
cinelerra-5.1/cinelerra/ffmpeg.C
@@
-428,14
+428,14
@@
int FFStream::decode_activate()
avctx->thread_count = ffmpeg->ff_cpus();
ret = avcodec_open2(avctx, decoder, &copts);
}
avctx->thread_count = ffmpeg->ff_cpus();
ret = avcodec_open2(avctx, decoder, &copts);
}
+ AVFrame *hw_frame = 0;
if( ret >= 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
if( ret >= 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
- AVFrame *frame = av_frame_alloc();
- if( !frame ) {
+ if( !(hw_frame=av_frame_alloc()) ) {
fprintf(stderr, "FFStream::decode_activate: av_frame_alloc failed\n");
ret = AVERROR(ENOMEM);
}
if( ret >= 0 )
fprintf(stderr, "FFStream::decode_activate: av_frame_alloc failed\n");
ret = AVERROR(ENOMEM);
}
if( ret >= 0 )
- ret = decode(frame);
+ ret = decode(
hw_
frame);
}
if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n",
}
if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n",
@@
-444,7
+444,7
@@
int FFStream::decode_activate()
avcodec_free_context(&avctx);
av_buffer_unref(&hw_device_ctx);
hw_device_ctx = 0;
avcodec_free_context(&avctx);
av_buffer_unref(&hw_device_ctx);
hw_device_ctx = 0;
- av_frame_free(&frame);
+ av_frame_free(&
hw_
frame);
hw_type = AV_HWDEVICE_TYPE_NONE;
int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
int idx = st->index;
hw_type = AV_HWDEVICE_TYPE_NONE;
int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
int idx = st->index;
@@
-454,7
+454,7
@@
int FFStream::decode_activate()
ret = 0;
continue;
}
ret = 0;
continue;
}
- probe_frame = frame;
+ probe_frame =
hw_
frame;
if( ret >= 0 )
reading = 1;
else
if( ret >= 0 )
reading = 1;
else
diff --git
a/cinelerra-5.1/cinelerra/mwindow.C
b/cinelerra-5.1/cinelerra/mwindow.C
index 8b93262c4e6930cd53027d40c9b3b5f2309d1c67..b38e3c653c57556ac36f90595162b1100861c01f 100644
(file)
--- a/
cinelerra-5.1/cinelerra/mwindow.C
+++ b/
cinelerra-5.1/cinelerra/mwindow.C
@@
-4642,6
+4642,14
@@
void MWindow::dump_exe(FILE *fp)
fprintf(fp, "\n");
}
fprintf(fp, "\n");
}
+void MWindow::dump_caches(FILE *fp)
+{
+ fprintf(fp, "audio cache: ");
+ audio_cache->dump(fp);
+ fprintf(fp, "video cache: ");
+ video_cache->dump(fp);
+}
+
void MWindow::trap_hook(FILE *fp, void *vp)
{
MWindow *mwindow = (MWindow *)vp;
void MWindow::trap_hook(FILE *fp, void *vp)
{
MWindow *mwindow = (MWindow *)vp;
@@
-4653,6
+4661,8
@@
void MWindow::trap_hook(FILE *fp, void *vp)
mwindow->dump_undo(fp);
fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp);
mwindow->dump_exe(fp);
mwindow->dump_undo(fp);
fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp);
mwindow->dump_exe(fp);
+ fprintf(fp, "\nCACHES:\n");
+ mwindow->dump_caches(fp);
}
}
diff --git
a/cinelerra-5.1/cinelerra/mwindow.h
b/cinelerra-5.1/cinelerra/mwindow.h
index 826ca600abb693afc81a294323ec94b4273051b2..c94a7bd52dc77d08f7746fea59808ecf8d972989 100644
(file)
--- a/
cinelerra-5.1/cinelerra/mwindow.h
+++ b/
cinelerra-5.1/cinelerra/mwindow.h
@@
-598,6
+598,7
@@
public:
void dump_edl(FILE *fp=stdout);
void dump_undo(FILE *fp=stdout);
void dump_exe(FILE *fp=stdout);
void dump_edl(FILE *fp=stdout);
void dump_undo(FILE *fp=stdout);
void dump_exe(FILE *fp=stdout);
+ void dump_caches(FILE *fp=stdout);
static void trap_hook(FILE *fp, void *vp);
void reset_android_remote();
static void trap_hook(FILE *fp, void *vp);
void reset_android_remote();
diff --git
a/cinelerra-5.1/cinelerra/performanceprefs.h
b/cinelerra-5.1/cinelerra/performanceprefs.h
index 3e00f9d8e828cb6269441d7865e29033f9ccf1db..e9acd3c70f8c9212170ec900c36ceb078209ee3f 100644
(file)
--- a/
cinelerra-5.1/cinelerra/performanceprefs.h
+++ b/
cinelerra-5.1/cinelerra/performanceprefs.h
@@
-338,6
+338,13
@@
public:
PreferencesWindow *pwindow;
};
PreferencesWindow *pwindow;
};
+class PrefsUseHWDevItems : public ArrayList<BC_ListBoxItem *>
+{
+public:
+ PrefsUseHWDevItems() {}
+ ~PrefsUseHWDevItems() { remove_all_objects(); }
+};
+
class PrefsUseHWDev : public BC_PopupTextBox
{
public:
class PrefsUseHWDev : public BC_PopupTextBox
{
public:
@@
-347,7
+354,7
@@
public:
int handle_event();
PreferencesWindow *pwindow;
int handle_event();
PreferencesWindow *pwindow;
-
ArrayList<BC_ListBoxItem *>
hw_dev_names;
+
PrefsUseHWDevItems
hw_dev_names;
};
};
diff --git
a/cinelerra-5.1/cinelerra/pluginlv2.C
b/cinelerra-5.1/cinelerra/pluginlv2.C
index 7b7dc678e717b2dd1578bfb3f4f3cad2092852e4..c6ef09cbe2125257a6dc07c004b9402f11b750fd 100644
(file)
--- a/
cinelerra-5.1/cinelerra/pluginlv2.C
+++ b/
cinelerra-5.1/cinelerra/pluginlv2.C
@@
-52,6
+52,8
@@
PluginLV2::PluginLV2()
schedule.schedule_work = lv2_worker_schedule;
worker_iface = 0; worker_done = -1;
pthread_mutex_init(&worker_lock, 0);
schedule.schedule_work = lv2_worker_schedule;
worker_iface = 0; worker_done = -1;
pthread_mutex_init(&worker_lock, 0);
+ pthread_mutex_init(&startup_lock, 0);
+ pthread_mutex_lock(&startup_lock);
pthread_cond_init(&worker_ready, 0);
work_avail = 0; work_input = 0;
work_output = 0; work_tail = &work_output;
pthread_cond_init(&worker_ready, 0);
work_avail = 0; work_input = 0;
work_output = 0; work_tail = &work_output;
@@
-417,6
+419,7
@@
PluginLV2Work *PluginLV2::get_work()
void *PluginLV2::worker_func()
{
pthread_mutex_lock(&worker_lock);
void *PluginLV2::worker_func()
{
pthread_mutex_lock(&worker_lock);
+ pthread_mutex_unlock(&startup_lock);
for(;;) {
while( !worker_done && !work_input )
pthread_cond_wait(&worker_ready, &worker_lock);
for(;;) {
while( !worker_done && !work_input )
pthread_cond_wait(&worker_ready, &worker_lock);
@@
-440,6
+443,7
@@
void *PluginLV2::worker_func(void* vp)
void PluginLV2::worker_start()
{
pthread_create(&worker_thread, 0, worker_func, this);
void PluginLV2::worker_start()
{
pthread_create(&worker_thread, 0, worker_func, this);
+ pthread_mutex_lock(&startup_lock);
}
void PluginLV2::worker_stop()
}
void PluginLV2::worker_stop()
diff --git
a/cinelerra-5.1/cinelerra/pluginlv2.h
b/cinelerra-5.1/cinelerra/pluginlv2.h
index ac99d2535dfc3015ba23ba910db6b28f8016ba53..6f1e60096a94cbbbad1df6b8d84ab78394c18859 100644
(file)
--- a/
cinelerra-5.1/cinelerra/pluginlv2.h
+++ b/
cinelerra-5.1/cinelerra/pluginlv2.h
@@
-137,7
+137,7
@@
public:
LV2_Worker_Schedule schedule;
PluginLV2Work *work_avail, *work_input;
PluginLV2Work *work_output, **work_tail;
LV2_Worker_Schedule schedule;
PluginLV2Work *work_avail, *work_input;
PluginLV2Work *work_output, **work_tail;
- pthread_mutex_t worker_lock;
+ pthread_mutex_t
startup_lock,
worker_lock;
pthread_cond_t worker_ready;
int worker_done;
};
pthread_cond_t worker_ready;
int worker_done;
};
diff --git
a/cinelerra-5.1/guicast/bcresources.C
b/cinelerra-5.1/guicast/bcresources.C
index 1d52855990ee9e7e5a10eb32f518e446e98d3087..2fb8f4f8b200aaeeff7fd47e256e07d0e3d201f4 100644
(file)
--- a/
cinelerra-5.1/guicast/bcresources.C
+++ b/
cinelerra-5.1/guicast/bcresources.C
@@
-1856,7
+1856,7
@@
void BC_Resources::encode_to_utf8(char *buffer, int buflen)
{
if(BC_Resources::locale_utf8) return;
char lbuf[buflen];
{
if(BC_Resources::locale_utf8) return;
char lbuf[buflen];
- encode(encoding, 0, buffer,
buflen
, lbuf, buflen);
+ encode(encoding, 0, buffer,
-1
, lbuf, buflen);
strcpy(buffer, lbuf);
}
strcpy(buffer, lbuf);
}