Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
merthin
Level 7

Questions on SetMaxVideoDecodeResolution + roScreen + roVide

Hello and Happy New Year 2014 all!

I’m working in a channel that uses both the 2D API (roScreen) and Video Playback (roVideoPlayer) to support a custom look while selecting the videos to play. The channel has only one screen and after some navigation it will create a roVideoPlayer playing a video serve over HLS.

In devices like the Roku XD|S and Roku 3 it works fine but not in the Roku 2 XS. In this device although I get messages like “DownloadSegmentInfo” but the video doesn’t play and eventually I get an event of type “requestFailed. (-3) An unexpected problem (but not server timeout or HTTP error) has been detected.”

After some search in the forums I try calling to the SetMaxVideoDecodeResolution method before playing the media content:

player.SetMaxVideoDecodeResolution(1080,720)

The video did play correctly but for only ~20 seconds, after that time, only the sound didn’t freeze. Which confirms that the issue I’m experimenting is memory related as the documentation of the method says: “This API enables applications that want to use both the 2D APIs and video playback with a lower resolution than 1080p. Without this call, these applications are likely to not have enough memory for either video playback or roScreen rendering.”

Checking at the models table I notice that both the Roku 2 XS and the Roku XD|S have 256 the RAM but only the former implements the 2D API using OpenGL (which seems to be shared with the decode memory). The Roku 3 otherwise relies on OpenGL but has 512 RAM.

Does anyone has experience something like this before? If so, what could be a good approach to power a custom UI with Playback in the Roku 2 | XS.

Also: the documentation is not clear, but are the dimensions 1920x1080 and 1080x720 the only valid inputs. What about an SD dimension? I try using them but I don’t get anything, yet I don’t see why I could not be within a display type of 1080p for my channel UI and force the video to don’t be rendered beyond an SD dimension.

Many thanks in advance for any comment!
0 Kudos
7 REPLIES 7\
TheEndless
Level 9

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

It should be "1280, 720", not "1080, 720". I'm not sure if that'll make a difference or not, but that'd be the first thing I'd try.

Bitmap memory management can be both tricky and tedious, especially when you're trying to play video as well. Make sure you're only keeping references open to the bitmaps that need to be on screen during the video playback, so you're not using up excess memory on items that don't need to be displayed.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
merthin
Level 7

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

Thank you. I took it from the documentation: "Video decode memory allocation is based on a resolution of 1920x1080 or 1080x720 as the maximum supported resolution for a particular Roku model (please see Section 1.4 of the Developer Guide for a list of these models)" and it was working, after your suggestion it keeps working as well.

Yeah, I will have to revisit the bitmap loading strategy. Cleaning the cache of bitmap before executing the playback did a difference, but the whole experience doesn't look as smooth as when I just cancel all image rendering all together.
Do you use any method to get the amount of memory you are already using? I will like to know if there is a threshold that I should avoid on the Roku 2 XS.

Thanks
0 Kudos
NewManLiving
Level 8

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

Open a telnet session at the ip of your
Roku box with port 8080
The r2d2_bitmaps command will dump
Memory content and parameters
If at the first attempt you receive command
Not recognized. Just resubmit
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
merthin
Level 7

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

Thanks @NewManLiving. It helped a lot.
0 Kudos
merthin
Level 7

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

After some refactoring I manage to get more free memory but the problem persists:
"Available memory 36507648 used 192512 max 36700160"

Besides getting rid of unused bitmaps (that consume a lot of memory),
what else might be needed to get playback on the Roku devices that have 256 MB?
Even after my changes I only get the video to last longer but eventually it stops to
only play the sound.

thanks in advance
0 Kudos
RokuJoel
Roku Employee
Roku Employee

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

Can you get the video to play using roVideoScreen without losing the audio? Because losing the video and hearing audio only sounds more like (no pun intended) a video encoding issue. If your video is HLS, does it include an audio only variant?

- Joel
0 Kudos
NewManLiving
Level 8

Re: Questions on SetMaxVideoDecodeResolution + roScreen + ro

Are you using double buffering? What does your memory look like prior to playing the video?
Some things I would try, don't know if they would help but:

1 - you say you use one roscreen and then create an rovideoplayer after a selection is made
Try creating the rovideoplayer when you create the roScreen at the start of your program,
Grabbing the crucial memory that you need at the beginning may change how it is allocated
later on. This of course depends on how the firmware manages memory. You don't need
to show it . just do not punch the 'proverbial' hole until a selection is made. Or use my nemesis:
set the windows redraw flag to true

2 - Try hooking in an roSystemLog component. This requires you to adhere to the rules set forth
In the documentation. But it may pick up other information that is not sent to you in any of the
component events. Set all the flags on and you just might pick up something additional during video execution
I use it in my application and it has added some additional information

3 - In roVideoPlayer isStatusMessage event make sure you examine every message that comes in by
adding an 'else' after all 'known' messages. This is where I find that my most helpful error messages
come in. The documentation is not updated on this and more messages than the standard
if "startup progress", else if "start of play", else if "end of stream", else if "playback stopped", else
(yes there is an else) and it can be an HTTP error. In my application one is sent that is not
recorded in the isRequestFailed. As a matter of fact, the error message that comes in during the
is RequestFailed is not even related to what actually happened. But the "HTTP" error that comes in
via the isStatusMessage is right on the money. Also my roSystemLogEvent picks up the correct error
message

Like I said, some things you can at least try
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos