Closed GoogleCodeExporter closed 9 years ago
Damien try the following (just an idea and my first thought):
Don't use the series inline but make use of the state object in
ThreadPool.QueueUserWorkItem.
Like so in TVSeriesPlugin.cs (may not compile, don't have a compiler with me).
As I
said, just a random idea.
Helper.ProximityForEach(seriesList, selectedIndex, delegate(DBSeries
series, int currIndex) {
if (!bg.CancellationPending) {
// now foreach series, queue up the
banner loading in the threadpool
ThreadPool.QueueUserWorkItem(delegate(object state) {
string img = string.Empty;
DBSeries stateSeries = state as DBSeries;
// Load Series Banners if
WideBanners otherwise load Posters for Filmstrip
if
(DBOption.GetOptions(DBOption.cView_Series_ListFormat) == "Filmstrip")
img =
ImageAllocator.GetSeriesPoster(stateSeries);
else
img =
ImageAllocator.GetSeriesBanner(stateSeries);
ReportFacadeLoadingProgress(BackGroundLoadingArgumentType.DelayedImgLoading,
currIndex, img);
Interlocked.Increment(ref done);
}, series);
}
else done++;
});
Inker
Original comment by StinkerI...@gmail.com
on 26 May 2009 at 6:16
Thanks Inker :)
I will see if I can re-produce with this change.
Original comment by damien.haynes@gmail.com
on 26 May 2009 at 6:41
Fixed in r684, will re-open if can re-produce.
Original comment by damien.haynes@gmail.com
on 26 May 2009 at 7:11
Problem still persists on my main HTPC, I cant seem to reproduce it on my
development PC.
Original comment by damien.haynes@gmail.com
on 27 May 2009 at 1:43
Had another quick look Damien, I oversaw that also the currIndex (with which we
signal to the GUI thread what item to pair the loaded image with) probably
needs to
be passed via the state object. Easy to get threading issues otherwise I would
assume.
So instead of just passing the series, pass both. I guess I'd new up a
Keyvaluepair
or maybe just a Object[]. Doesn't erally matter although of course the latter
will
require (un)boxing the int.
So if you could give it another try. Sorry I oversaw it at first.
Original comment by StinkerI...@gmail.com
on 28 May 2009 at 6:06
Thanks Inker, I have made the change and will test it for a few days
Original comment by damien.haynes@gmail.com
on 28 May 2009 at 7:15
Unfortunately problem still persists.
Original comment by damien.haynes@gmail.com
on 30 Jun 2009 at 10:18
I also got this problem but it seems completely random ^^
Original comment by bgmei...@gmail.com
on 4 Jul 2009 at 7:54
Hey,
I had a bit of freetime today and was bored, so I had another quick look, but
while
I dont know the root cause for this, basically i think we have to
a) be able to gather logs to pinpoint where pairings fail and/or
b) pair things not by their index but by seriesID directly because i suspect
the
index thingy to be fishy,
b may be enough to fix the problem altogether, but it really depends where the
problems stems from
for a) I suggest log calls are added for every step of the way showing the
pairings
of seriesID/image/filename:
in the delegate passed to proximityforeach
in the delegate passed to QueueUserWorkitem
and finally in bgreportprogress
then ask those users to reproduce
Actually I think we have a list avail of all valid banners on the DBSeries, so
maybe
just log if those are ever wrong, otherwise the log will grow huge.
heres what I suggest for b
in proximityforeach section, change
ReportFacadeLoadingProgress(BackGroundLoadingArgumentType.DelayedImgLoading,
stateSeries.Key, img);
to
ReportFacadeLoadingProgress(BackGroundLoadingArgumentType.DelayedImgLoading,
stateSeries.Value[DBSeries.ID], img); // pass the seriesID instead of the index
in
the list
in bg_ProgressChanged under BackGroundLoadingArgumentType.DelayedImgLoading,
change
if (itemsForDelayedImgLoading != null && itemsForDelayedImgLoading.Count >
arg.IndexArgument)
{
string image = arg.Argument as string;
itemsForDelayedImgLoading
[arg.IndexArgument].IconImageBig = image;
}
to something like
if (itemsForDelayedImgLoading != null)
{
string image = arg.Argument as string;
foreach(var item in itemsForDelayedImgLoading)
{
DBSeries seriesOfListItem = item.TVTag as DBSeries;
if(seriesOfListItem != null && seriesOfListItem[DBSeries.ID] ==
arg.IndexArgument)
{
item.IconImageBig = image;
break;
}
}
}
(as always no compiler here so likely wont compile as is)
Hope this helps as it kinda irks me this is buggy. But then again I didn't
really
sleep much so my thoughts may very well be entirely off. I don't know
Greets
Original comment by StinkerI...@gmail.com
on 15 Aug 2009 at 7:54
I tried testing changes for b) above but I noticed the issue still. Will look at
adding logs.
Original comment by damien.haynes@gmail.com
on 17 Aug 2009 at 3:53
Original comment by damien.haynes@gmail.com
on 30 Oct 2009 at 9:15
Original comment by damien.haynes@gmail.com
on 6 Nov 2009 at 8:57
Will close this as I think the remaining issue is a threading issue in
MediaPortal's texture manager. I have seen the problem surface in multiple
plugins.
Original comment by damien.haynes@gmail.com
on 20 Jul 2012 at 1:02
Original issue reported on code.google.com by
damien.haynes@gmail.com
on 26 May 2009 at 2:24