Viacom (VIAB - Get Report) and Dish Network  (DISH - Get Report) may have more in common than they know.

Both companies are feeling the weight of historic changes in the media industry as viewers and marketers migrate to mobile devices, weakening the outlook for the traditional pay TV bundle of services. And both have had poor years on Wall Street as subscriber losses have cut into revenue. Viacom shares have tumbled by 32%, while Dish has dropped by 14%.

At some point in the coming months, Viacom, owner of MTV, Nickelodeon and Comedy Channel, and Dish, a satellite TV operator with 13 million subscribers, will look to sign a contract renewal that could determine the future health and business model of both companies. Viacom isn't saying when its current deal with Dish expires, only that it's due to expire sometime next year.

"Both have a lot to lose" if a deal can't be struck, said Bruce Leichtman of the Leichtman Research Group in a phone interview. "The gain for Dish is to have Viacom's content on its Sling TV platform. The gain for Viacom is obviously those 13 million subscribers."

For Viacom, losing Dish would be a substantial hit to subscriber revenue and advertising. Investors would likely react negatively, sending shares down even further.

Earlier this year, Viacom was dropped by both Cable One and Suddenlink, two regional pay TV providers. The two companies determined that retaining Viacom's programming wasn't warranted by the costs that would likely have to be passed onto customers.

Viacom, though, has successfully renewed contracts with AT&T (T - Get Report) , privately-held New York-based MediaCom Communications and Charter Communications (CHTR - Get Report) , which is expected to close its acquisition of Time Warner Cable (TWC) early next year, so it's hardly fading out of view.

Cable TV providers are being pressured to keep costs low to stave off viewer desertions in favor of Internet-based services led by Netflix (NFLX - Get Report) , Hulu and Amazon (AMZN - Get Report) Prime.

Despite a better-than-expected fourth-quarter forecast from Viacom CEO Philippe Dauman, the company is under pressure to produce "must-see" television, the kind of series that have made AMC Networks (AMCX - Get Report) (The Walking Dead, Breaking Bad, Mad Men) such a darling of media investors.

Viacom's chief networks target the audiences that are moving fastest away from linear television to Internet video-on-demand platforms led by Netflix and Hulu, as well as Time Warner's (TWX) HBO NOW.

"Viacom will struggle to keep their network brands relevant in that environment -- but even if they succeed, the economic returns will pale in comparison to the legacy business, on which the stock has been valued," Todd Juenger, a Sanford C. Bernstein media analyst, wrote in a Nov. 12 investor note. "If Viacom begins to lose distribution, the financial outlook is dire."

Both Viacom and Dish declined to comment on the contract talks.

Conversely, Barclay's media analyst Kannan Venkateshwar, took a less jaundiced view in an Aug. 7 report writing that "we are skeptical that Dish has anything to gain by shrinking the bundle and losing subs," adding that "Dish might negotiate hard and the inflation may be limited, dropping Viacom completely would be, in our opinion, a low probability event."

Despite his reputation as one of the toughest negotiators in the business, Dish CEO Charlie Ergen recently said he was "optimistic" about getting a deal done. 

But Dish is a company in transition. Its been losing satellite TV subscribers while its seeks to add customers for its Internet-based streaming service SlingTV, a subscription platform that includes Walt Disney's (DIS - Get Report) ESPN, Time Warner's TBS and AMC's flagship network.

Dish lost 23,000 satellite subscribers in the third quarter as the 13 largest U.S. pay TV providers lost 190,000 net subscribers, according to Leichtman. In the year-earlier quarter, pay TV subscribers dropped 155,000 subscribers. The 13 largest providers, representing about 95% of the total market, had 94 million subscribers at the end of September.

Leichtman also found that the number of former Dish subscribers increased over the past year. "Over the past year, the top pay TV providers (including DISH's Sling TV) lost about 400,000 subscribers -- compared to a loss of about 130,000 subscribers during the prior year," he said. 

To make itself more attractive in negotiations and increase its demand for content, Viacom would need to get networks MTV, Comedy Central and Nickelodeon on to Dish's Sling TV platform.

At the same time -- and to make up for pay TV bundle losses -- Dish would like to increase the numbers of its Sling TV platform subscribers to compete with "must see" content provided by shows like The Walking Dead or programs from the Sundance Channel, which are also available there.

As contract talks heat up, Ergen is viewed as somewhat unpredictable. Speculation remains that he will bargain hard on price with an eye toward adding Viacom's premier networks to Sling TV. At the right price, that would seem to be a deal both companies could embrace.

The alternative might be bad for both of them.