The two biggest owners of radio stations in America have both filed for bankruptcy.

iHeartMedia, the operator of 850 stations across the United States, submitted the paperwork on Thursday. Its rival Cumulus, the operator of 445 stations, did the same thing a few months ago.

The two cases are unique, but both companies face similar challenges in a troubled industry. And both companies are trying to restructure their debt.

iHeartMedia (IHRT) has been crippled by piles of debt for many years. It has been struggling to get out from under a massive debt load it took on as part of a leveraged buyout of billboard company Clear Channel Outdoor in 2008.

"The heavy debt burden became unsustainable during the persistent long-term secular decline of the radio broadcasting business," analyst Sharon Bonelli of Fitch Ratings said in an email.

That's why iHeart has been negotiating with creditors and investors for months. On Thursday it announced an agreement to restructure more than $10 billion in debt, about half of what it owes.

"The agreement we announced today ... allows us to definitively address the more than $20 billion in debt that has burdened our capital structure," iHeartMedia CEO Bob Pittman said in a statement.

The company said it has enough cash to support it through Chapter 11 proceedings.

The San Antonio-based company used to be called Clear Channel. It bills itself as a multi-platform media company, but it's best known for operating a far-flung network of radio stations.

It also operates iHeartRadio's music streaming service, a popular concert business, and a majority stake in Clear Channel Outdoor.

The company has struggled with falling revenue. It was down in 2015, barely grew in 2016 and fell in the first nine months of 2017. This has come amid declines in the radio ad business and growing competition from streaming rivals like Spotify and Pandora.

"We believe there is still inherent value in the traditional radio broadcasting sector, but balance sheets will continue to need to be right-sized to support the underlying economics of the industry," Bonelli said.

Cumulus is also going through Chapter 11 right now.

The bankruptcy filing comes as Spotify prepares for its much anticipated listing on the New York Stock Exchange.

Updated: This article has been updated with more detailed information on iHeartRadio's annual revenue in recent years.