texmgr requests

I am requesting 10 images with the texturemanager. the ID’s are stored and then compared with the downloads to assign the right name for the bitmap.
What I’m getting back though is only 5 of the 10, something like 1, 2, 3, 4, 10 or 1, 3, 4, 2, 10 or 3, 1, 2, 4, 10. Always get the first and last request but never anything between 5-9.
What Am I missing?
Thanks

for i = 0 to 9
	requestinfo = CreateObject("roAssociativeArray")
	requestpic = CreateObject("roTextureRequest" , "http://www.xxxx.com/roku/screensaverlite/"+motionlist[i].GetName())
	m.texmgr.RequestTexture(requestpic)
	requestinfo.name = motionlist[i].GetName()
	requestinfo.ID = requestpic.GetID()
	request.Push(requestinfo)
end for					
while true
    	msg= m.texport.getmessage()
    	if type(msg)="roTextureRequestEvent" then
    	if msg.GetState() = 3
    	for x = 0 to 9
        if request[x].ID = msg.GetID()
        m.motionbit[x] = msg.GetBitmap()
        total = total+1
        exit for
        end if
        end for
        end if
        end if
        if total = 9
       	exit while
       	end if
end while

You’re not checking for any state other than 3. My guess would be that there’s a problem with images 5-9 that’s preventing them from loading (bad URLs?) and resulting in a state other than 3.

Thanks Endless, but I’m positive the URLS are good, they all load fine if I use URLTransfer and its not the same group every time.
If I leave out the "if msg.GetState = " the for/each loop cycles through all 10 ID’s, like for instance - 6, 5, 3, 7, 8, 9, 1, 2, 4, 10 but still only 5 images download.
Is there a limit to the number of messages the port can cue?, because these are coming in really fast, less than 2 seconds.

What is the size of the bitmaps

NML - varys, most are around 600 x 300, 500 x 500 is the biggest, bit-wise.

Can’t really look at your code right now
At work. Try loading 1then 2 etc and check
Your memory Even the tmanager has it’s limits
Esp if you are holding the bitmap. Also make sure
You have a valid bitmap.

Well it would be great to know what the Texmanagers limits are, never heard of that but overall bitmap memory is 24mb free with all loaded. It works just fine with any number of slow ways - URLTransfer or one at a time with the TexManager. The problem is requesting all 10 at once and the port or the code is not handling what comes back.

Yes but URL transfer writes everything to disk
But if you can load all 10 bitmaps from
Disk into memory then it’s not a memory problem

“squirreltown” wrote:
Thanks Endless, but I’m positive the URLS are good, they all load fine if I use URLTransfer and its not the same group every time.
If I leave out the "if msg.GetState = " the for/each loop cycles through all 10 ID’s, like for instance - 6, 5, 3, 7, 8, 9, 1, 2, 4, 10 but still only 5 images download.
Is there a limit to the number of messages the port can cue?, because these are coming in really fast, less than 2 seconds.
What’s the GetState() of the ones that fail to load?

On a potentially related note, your code is checking for a total of 9, but you’re trying to load 10 images.

“TheEndless” wrote:

What’s the GetState() of the ones that fail to load?
You know, I’m not checking that. Tell me if I’m wrong but I’m not aware of how that might help me. I know the files/urls are good because they’ve been working for months. If I take that same while loop above and stick it inside the for/each loop everything downloads, but of course it loses any speed advantage since it’s basically blocking while waiting for each file. I’m just trying to get a process thats taking about 8-9 seconds to take maybe half of that. If it were a memory problem with the tex manager itself i would expect it to download the first 5 files not the first 4 and the last one. Actually, no matter if I check anything or not or try to assign a variable to the returned bitmap or not, The loop requests 10 files and 5 come back, according to r2d2_bitmaps. It smells like a timing issue to me but I have no clue what to do about it. I tried slowing the requests with a sleep in between but that didn’t help, and tried wait(0 and wait(20 on the return - no difference.

“TheEndless” wrote:
On a potentially related note, your code is checking for a total of 9, but you’re trying to load 10 images.
Thanks for pointing that out, that starting with zero thing gets me sometimes, but in this case not an issue yet as the total never gets above 5.

So just for grins I took the code posted above and ran it twice consecutively, just got files 1-5 the first pass and 5 -10 the second pass, and that worked, and is considerably faster then what i have now so I’ll take the improvement, but sure wouldn’t mind finding out what the issue is with running all 10 files at once, happy to entertain any ideas about that.

I would be interested to know if you
Get a valid bitmap back each time.
You increment your counter and save the
Bitmap but do you make sure it is a bitmap
Even with a state code of 3 not all my
Bitmaps were valid but did eventually come
In as valid ones if getbitmap = invalid print invalid

“squirreltown” wrote:

“TheEndless” wrote:

What’s the GetState() of the ones that fail to load?
You know, I’m not checking that. Tell me if I’m wrong but I’m not aware of how that might help me.
If the state comes back as 5 (Cancelled) instead of 4 (Failed), that would be a pointer to something causing the requests to be cancelled (going out of scope, maybe?). A value of 1 (Downloading) or 2 (Downloaded) would indicate that the TextureRequest is getting hung up during the downloading. Without that additional information, it’s much harder to diagnose the cause. Likewise, if it comes back as something other than 3, you could try re-issuing the request.

Thanks Endless, thats good info, appreciate it.

Well just got home and the mind is a very, very tired but looking at this
One point I think I noticed is that your total count will never get incremented unless

1 - it is a roTextureRequestEvent
2 - state = 3
3 - request Id = msg ID

So these three items must be true at least total = 9 even for you to exit the loop, otherwise it would be endless
Also I assume that total is set to 0 somewhere. Is this just a portion of the code ?

Also never knew there was an exit for, just an exit while, perhaps there is a loop or continue statement that would be nice

NML -

Yes all three of those things need to be happening to continue, and it works as i would expect it to - I want all of those thing to be true for each image, otherwise no point in continuing. Yes total=0 is set before the loop starts. The thing is if the construction of the loops was bad, it wouldn’t work at all - and since i have split the job into two parts it works well and in half the time (about 5 seconds) that URLtransfer or Texmgr one-at-a-time did. The total variable is just the first thing i could think of to exit the loop when done - I’m sure theres a more professional way to do it but it was never the issue. The weird thing is why the 5 image limit on this code. When i request 5 images, i get 5 images - 1,2,3&4 not necessarily in that order and 5. If I request 10, I get 1,2,3,4 and 10. Same code. Like i said above if I don’t include the state-checking, all 10 ID’s return with the five downloads. Since I got the time cut in half i’m slightly less motivated to figure out exactly whats going on but I’m sure I’ll come back to it at some point and look closer at the states as Endless suggested, maybe cut one more second off the time.

BTW the “exit for” is courtesy of destruk who showed me that way to make a search loop a while back.

Good to know about the exit for ; it is not documented

From the code snippet that you supplied (and I have been doing too much coding lately and it does get to you, so I think I am looking at it correctly ) but

But when you say continue, what do you mean ? You CANNOT exit your while loop unless total = 9 . And in order for total to = 9 those three conditions HAVE TO BE MET at least nine times, not 5 or 4. Unless there is some code to exit the while loop that you do not show. So looking at other state codes would not be an issue here because you MUST HAVE a state code of 3 at least 9 times, regardless of other state codes that may come in. And you MUST find your message ID at least 9 times, in order for total = total + 1, Total does not get changed any other way, and if total is not changed to eventually = 9 then you will be waiting until you press the home button to get out of your loop. So again your three conditions are met exactly as you expect them to be or you would never get out of your while loop. So are you getting a valid bitmap the first time around and if you are what happens with it.

“NewManLiving” wrote:
Good to know about the exit for ; it is not documented
http://sdkdocs.roku.com/display/sdkdoc/ … entSummary

Interesting how did I miss that all these months. Possibly because the 5.7 summary does
Not mention it. That is where I look first and if I do not understand it then I would
Click on the link to read it. Is there a continue or a loop
Statement that I missed as well. Now that would save you a bunch of if statements

Perhaps I missed something with the code above as well. Seems to me he is
Getting something at least 9 times or he would never get out of his loop.
Can’t say if it’s a bitmap though

Well I’m not a professional and I don’t know how others do it, but error handling is the normally the last thing i write into the code, I’m usually trying to get something to just work - this was the first time I used the texmgr ID’s to track and name the images and I never got past the fact that I was requesting 10 images and getting back 5 every time, that was the point of the original post - not that I wasn’t exiting the loop or handling errors, both of which are problems i can solve but were further down the road. In the end I solved it by working around it - splitting the job in two, the reason all the requests don’t come back when requested at once will have to wait for another day.