Update of /cvsroot/xine/xine-lib/src/post/goom
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22404/goom
Modified Files:
xine_goom.c
Log Message:
two fixes to viz glue code:
- avoid overrunning the provided input audio buffer.
- generate a bad frame if time is due but we don't have enough data
for updating the viz plugin. this could happen in some rare situations
but the result was pretty catastrophic: xine froze with 100% cpu usage.
Index: xine_goom.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/goom/xine_goom.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- xine_goom.c 23 Oct 2006 21:13:44 -0000 1.63
+++ xine_goom.c 2 Dec 2006 22:35:18 -0000 1.64
@@ -43,7 +43,7 @@
#include "goom.h"
-#define NUMSAMPLES 512
+#define NUMSAMPLES 512 /* hardcoded into goom api */
#define FPS 14
#define GOOM_WIDTH 320
@@ -83,7 +83,7 @@
PluginInfo *goom;
int data_idx;
- gint16 data [2][512];
+ gint16 data [2][NUMSAMPLES];
audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */
int channels;
@@ -386,6 +386,7 @@
this->sample_rate = rate;
this->samples_per_frame = rate / this->fps;
this->data_idx = 0;
+ this->sample_counter = 0;
init_yuv_planes(&this->yuv, this->width, this->height);
this->skip_frame = 0;
@@ -445,7 +446,6 @@
buf = &this->buf;
this->sample_counter += buf->num_frames;
-
j = (this->channels >= 2) ? 1 : 0;
do {
@@ -455,7 +455,7 @@
data8 += samples_used * this->channels;
/* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx <
NUMSAMPLES;
i++, this->data_idx++, data8 += this->channels ) {
this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
@@ -464,16 +464,15 @@
data = buf->mem;
data += samples_used * this->channels;
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ for( i = samples_used; i < buf->num_frames && this->data_idx <
NUMSAMPLES;
i++, this->data_idx++, data += this->channels ) {
this->data[0][this->data_idx] = data[0];
this->data[1][this->data_idx] = data[j];
}
}
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
- this->data_idx = 0;
+ if( this->sample_counter >= this->samples_per_frame ) {
+
samples_used += this->samples_per_frame;
frame = this->vo_port->get_frame (this->vo_port, this->width_back,
this->height_back,
@@ -481,14 +480,23 @@
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
- frame->bad_frame = 0;
+
+ /* frame is marked as bad if we don't have enough samples for
+ * updating the viz plugin (calculations may be skipped).
+ * we must keep the framerate though. */
+ if( this->data_idx == NUMSAMPLES ) {
+ frame->bad_frame = 0;
+ this->data_idx = 0;
+ } else {
+ frame->bad_frame = 1;
+ }
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
this->sample_counter -= this->samples_per_frame;
- if (!this->skip_frame) {
+ if (!this->skip_frame && !frame->bad_frame) {
/* Try to be fast */
goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0,
NULL, NULL);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog