[mythtv] [PATCH] XvMC - the segv in videoout_xvmc
Steve Brown
sbrown at cortland.com
Tue Nov 25 19:32:18 EST 2003
A few things didn't get deallocated and got the nvidia library confused.
Not sure I understand the XvMC api yet, but the changes seem to help.
Steve
-------------- next part --------------
diff -u -r1.16 videoout_xvmc.cpp
--- libs/libmythtv/videoout_xvmc.cpp 16 Nov 2003 19:08:33 -0000 1.16
+++ libs/libmythtv/videoout_xvmc.cpp 25 Nov 2003 22:54:00 -0000
@@ -308,6 +308,8 @@
data->XJ_gc = XCreateGC(data->XJ_disp, data->XJ_win, 0, 0);
XJ_depth = DefaultDepthOfScreen(data->XJ_screen);
+ XFlush(data->XJ_disp);
+ XSync(data->XJ_disp, false);
XvImageFormatValues *xvfmv;
int num_subpic;
@@ -412,7 +414,17 @@
if (ret != Success)
{
- cerr << "Unable to create XvMC Context\n";
+ cerr << "Unable to create XvMC Context return status:" << ret ;
+ switch (ret)
+ {
+ case XvBadPort: cerr << " XvBadPort"; break;
+ case BadValue: cerr << " BadValue" ; break;
+ case BadMatch: cerr << " BadMatch" ; break;
+ case BadAlloc: cerr << " BadAlloc" ; break;
+ default: cerr << " unrecognized return value"; break;
+ }
+ cerr << endl;
+
return false;
}
@@ -436,7 +448,9 @@
if (ret != Success)
{
cerr << "Unable to create XvMC Macro Blocks\n";
+ XvMCDestroyBlocks(data->XJ_disp,&(data->data_blocks[i]));
XvMCDestroyContext(data->XJ_disp, &data->ctx);
+ return false;
}
}
@@ -486,6 +500,7 @@
if (rez == Success)
{
+ data->subpicture_alloc = true;
XvMCClearSubpicture(data->XJ_disp, &data->subpicture, 0, 0, XJ_width,
XJ_height, data->subpicture_clear_color);
@@ -500,10 +515,10 @@
data->xvimage->data = data->shminfo.shmaddr;
- shmctl(data->shminfo.shmid, IPC_RMID, 0);
-
XShmAttach(data->XJ_disp, &data->shminfo);
+ shmctl(data->shminfo.shmid, IPC_RMID, 0);
+
if (data->subpicture.num_palette_entries > 0)
{
int snum = data->subpicture.num_palette_entries;
@@ -532,8 +547,11 @@
data->palette);
}
}
- else
+ else
+ {
data->subpicture_mode = NO_SUBPICTURE;
+ data->subpicture_alloc = false;
+ }
XSync(data->XJ_disp, 0);
@@ -558,7 +576,7 @@
void VideoOutputXvMC::DeleteXvMCBuffers()
{
- for (int i = 0; i < numbuffers; i++)
+ for (int i = 0; i < 8; i++)
{
XvMCDestroyMacroBlocks(data->XJ_disp, &data->mv_blocks[i]);
XvMCDestroyBlocks(data->XJ_disp, &data->data_blocks[i]);
@@ -588,6 +606,8 @@
data->subpicture_alloc = false;
XFree(data->xvimage);
+ XFlush(data->XJ_disp);
+ XSync(data->XJ_disp, false);
if (data->palette)
delete [] data->palette;
More information about the mythtv-dev
mailing list