Streaming specialist Roku (ROKU -10.29%) has been flying high lately due to some encouraging quarterly results it posted this month. The ad business is looking stronger, and investors are bullish on the company's prospects. But there is one thing that investors should keep an eye out for, and it's something that could derail the stock's progress.

Roku's margins are shrinking

A problem with Roku's business is that while it grows, not all metrics are moving in the right direction. The company recently posted its latest earnings results, which showed year-over-year revenue growth of 20%, with its top line reaching $912 million for the period ending Sept. 30.

But when you look further down at the gross profit, that only increased by 3%. And the actual gross margin percentage was 40.4%, which is far less than the 46.9% it reported in the year-ago period. Gross margin is important because it indicates how much a company has left over after cost of revenue to apply toward overhead and operating expenses. If it deteriorates, then that can offset any big increase in revenue.

This past quarter, Roku did incur restructuring charges that impacted its gross margin as it removed some content from the Roku Channel. But that doesn't mean this isn't a problem. Here's how Roku's gross margin has fared over the past five years:

ROKU Gross Profit Margin (Quarterly) Chart

ROKU Gross Profit Margin (Quarterly) data by YCharts

It has been on a downward trend for several quarters; this is not just a one-off. While restructuring charges may explain away some of the decline this time around, it's part of a potentially larger problem for Roku.

Why Roku's margins could get worse

Roku reports gross margins from its platform business and its devices. The platform segment includes revenue from digital advertising and is the company's bread and butter -- its margins are normally around 50% or better. Devices, however, normally have low and even negative margins. Last quarter, platform gross profit margins were 48.1% compared with negative 7.5% for devices.

And right now, Roku's device revenue is growing at a faster rate than platform revenue. Its device revenue of $125.2 million rose at a rate of 33% while platform sales increased by a more modest 18%. Roku has been focusing on devices lately. This includes creating its own TVs and selling smart home devices like lights and cameras. By expanding its product line, it can give the business an easier way to grow its revenue. But the problem with this idea is that it can come at the cost of worsening overall margins.

This quarter, device revenue accounted for 13.7% of the top line, whereas a year ago that figure was 12.4%. If devices make up more of the company's revenue, that can be problematic for Roku because it can make it more difficult to achieve profitability.

Roku's bottom line has been declining along with margins:

ROKU Net Income (Quarterly) Chart

ROKU Net Income (Quarterly) data by YCharts

Is Roku stock a buy?

Roku's stock jumped on the company's recent results, with investors excited that the ad market may be picking up steam again. But looking at its overall revenue growth and margins indicates that it may not be a smooth road ahead. Even if Roku's revenue increases rapidly, it may not necessarily be enough to lead it back to profitability.

Given the uncertainty ahead, this is a streaming stock I'd hold off on buying right now. Risk-averse investors may be better off taking a wait-and-see approach to see if this trend continues, because if it does, it could mean that profits will remain elusive for Roku, which won't be good news for the stock price.