[Cin] cpu debug patch for Andrea

Andrew Randrianasulu randrianasulu at gmail.com
Sat Jul 17 07:59:33 CEST 2021


Andrea, can yo apply thus patch, load/play/encode file with this patch
applied and post output?

for me it prints twice  "1" and then consistently "8" (my num. of cores)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20210717/b473259b/attachment.htm>
-------------- next part --------------
diff --git a/cinelerra-5.1/cinelerra/audiopulse.C b/cinelerra-5.1/cinelerra/audiopulse.C
index 78db1875..72bfc9a7 100644
--- a/cinelerra-5.1/cinelerra/audiopulse.C
+++ b/cinelerra-5.1/cinelerra/audiopulse.C
@@ -205,6 +205,11 @@ int AudioPulse::read_buffer(char *buffer, int size)
 
 int AudioPulse::output_wait()
 {
+
+	if( !dsp_out && init_output() ) {
+		return 1;
+	}
+	
 	int error = 0;
 	pa_usec_t latency = pa_simple_get_latency((pa_simple*)dsp_out, &error);
 	int64_t udelay = latency;
@@ -248,4 +253,5 @@ int AudioPulse::interrupt_playback()
 	return 0;
 }
 
+
 #endif
diff --git a/cinelerra-5.1/cinelerra/audiopulse.h b/cinelerra-5.1/cinelerra/audiopulse.h
index 1739c256..5416fabf 100644
--- a/cinelerra-5.1/cinelerra/audiopulse.h
+++ b/cinelerra-5.1/cinelerra/audiopulse.h
@@ -43,6 +43,9 @@ public:
 	int output_wait();
 	int flush_device();
 	int interrupt_playback();
+	
+	//int get_output()
+	//int get_input()
 
 // the pulse audio handles
 	void *dsp_out;
@@ -53,6 +56,8 @@ public:
 	int64_t buffer_position;
 	int64_t timer_position;
 	int64_t frag_usecs, period_usecs;
+	
+private:
 	Timer *timer;
 	Mutex *timer_lock;
 
diff --git a/cinelerra-5.1/cinelerra/ci b/cinelerra-5.1/cinelerra/ci
index bc987833..22858982 120000
--- a/cinelerra-5.1/cinelerra/ci
+++ b/cinelerra-5.1/cinelerra/ci
@@ -1 +1 @@
-../bin/cinelerra
\ No newline at end of file
+../bin/cin
\ No newline at end of file
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 63144ec1..6323b23c 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -3664,7 +3664,10 @@ int FFMPEG::ff_interlace(int stream)
 
 
 int FFMPEG::ff_cpus()
+
 {
+	printf("filebase cpu %i \n", file_base->file->cpus);
+	
 	return !file_base ? 1 : file_base->file->cpus;
 }
 
diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C
index b8a5ed3d..50bae683 100644
--- a/cinelerra-5.1/cinelerra/file.C
+++ b/cinelerra-5.1/cinelerra/file.C
@@ -292,8 +292,8 @@ int File::can_scale_input(Asset *asset)
 
 int File::set_processors(int cpus)   // Set the number of cpus for certain codecs
 {
-	if( cpus > 8 )		// mpegvideo max_threads = 16, more causes errs
-		cpus = 8;	//  8 cpus ought to decode just about anything
+	if( cpus > 16 )		// mpegvideo max_threads = 16, more causes errs
+		cpus = 16;	//  8 cpus ought to decode just about anything
 // Set all instances so gets work.
 	this->cpus = cpus;
 
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index c4371646..b0e064ed 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -5348,6 +5348,7 @@ int MWindow::get_cpus(int out_w, int out_h)
 	int cpus = out_w*out_h/0x80000 + 1;
 	if( cpus > preferences->processors )
 		cpus = preferences->processors;
+	printf("cpus from mwindow: %i \n", cpus);
 	return cpus;
 }
 int MWindow::get_cpus()


More information about the Cin mailing list