How was it determined that the speed of light in vacuum is a constant? For over a hundred years now we have accepted that the speed of light is the same in all frames of reference. What I'm wondering is - how was this determined? 
I'm aware of the Michelson and Morley experiment, but that only showed that the speed of light doesn't depend on the movement of the light source. As in - it's not like a cannonball being shot out of a moving cannon.
But here's another thought - what if light is like sound, a wave travelling inside a medium? And that medium itself also can have a velocity? For example, take the classical example of two people - one inside a train, and the other standing on the platform. When each one of them measures the speed of sound, they'll get the same value. When one makes the sound and the other tries to measure the speed this particular sound has in their vicinity (like the Michelson and Morley experiment), they will also get the same value.
In this setup both people will also conclude that the speed of sound is the same no matter how fast the source of the sound is moving. There can be a Doppler effect (also observed for light), but the speed of sound itself will be constant.
That's because the sound waves travel through air (or, briefly, the material of the train carriage), and the air inside the carriage moves relative to the air outside. In essence, sound speeds up when it enters the carriage, and slows down when it exits it. But since you cannot measure sound from afar, you also cannot see this effect.
Now, obviously this is not how the world works and it has been thoroughly tested by now, but I'm wondering - how was this possibility eliminated? Which experiments contradicted with it?
 A: 
what if light is like sound, a wave travelling inside a medium? And that medium itself also can have a velocity?

That was, in fact, the prevailing view of the scientific community around the time of the famous Michelson Morley experiment. This concept is called the luminiferous aether. 
Roughly speaking there are three different kinds of aether theories: rigid aether, dragged aether, and Lorentz aether. 
The rigid aether theory proposed that the aether is a very stiff but nearly massless solid material. This was in agreement with the known facts that light could be polarized and that it’s speed was very high. The rigid aether was essentially disproven by the Michelson Morley experiment because they did their experiment over the course of the year so at some point the earth would have been moving with respect to this rigid aether. 
The dragged aether theories gained popularity after the failure of the rigid aether. Basically, they proposed an aether that was more fluid-like and stuck to matter so as to be pulled along. Different dragged aether theories differed in the amount of dragging. These theories were refuted with the experiment by Sagnac. Sagnac showed that a ring interferometer measured the earth’s rotation and that the measured rotation rate was equal to that determined astronomically. A completely dragged aether would have produced no interference pattern and a partially dragged aether would have produced a reduced interference. 
The Lorentz aether is the only aether theory that remains viable. It is, by design, experimentally indistinguishable from there being no aether. It essentially is supposed to be there but to never do anything that would allow you to detect it. So while it is viable, it explains no more than there being no aether. 
A: When using the term 'the speed of light' it is sometimes necessary to make the distinction between its one-way speed and its two-way speed. The one-way speed of light, from a source to a detector, cannot be measured independently of a convention as to how to synchronize the clocks at the source and the detector. What can however be experimentally measured is the round-trip speed (or "two-way" speed of light) from the source to the detector and back again. Albert Einstein chose a synchronization convention (see Einstein synchronization) that made the one-way speed equal to the two-way speed. The constancy of the one-way speed in any given inertial frame is the basis of his special theory of relativity.
Many tests of special relativity such as the Michelson–Morley experiment and the Kennedy–Thorndike experiment have shown within tight limits that in an inertial frame the two-way speed of light is isotropic and independent of the closed path considered.
Lorenz Ether Theory assumes, that the one – way speed of light is the same in all directions only in the preferred frame, or Ether. Light propagates in Ether, like waves on  water. Simultaneity in this theory is absolute. In all other moving in the Ether laboratories it anisotropic, but observers in all these moving laboratories cannot measure it without prior clock synchronization. They can only measure two – way speed of light, which appears to be the same in all directions, as was confirmed by Michelson Morley experiment. Lorentz theory explains isotropy of two way speed of light  by distortion of interferometer (Lorentz contraction).
SR assumes, that one – way speed of light by definition is the same in all relatively moving laboratories, and all observers in all laboratories must adjust (synchronize) clocks "inside" their laboratories  Einstein – way (this leads to relativity of simultaneity). It is clear that measured by these clocks one way speed of light will be equal precisely to constant c in every laboratory.
In a sense every observer in special relatively has his own "rest frame" that is similar lo Lorentz "preferred", because one - way speed of light is isotropic in it.
Because the same mathematical formalism occurs in both, it is not possible to distinguish between LET and SR by experiment. There was a number of works that compare these theories.
One can easily forget that Einstein Synchronization is only a convention. In rotating frames, even in special relativity, the non-transitivity of Einstein synchronization diminishes its usefulness. If clock 1 and clock 2 are not synchronized directly, but by using a chain of intermediate clocks, the synchronization depends on the path chosen. Synchronization around the circumference of a rotating disk gives a non vanishing time difference that depends on the direction used. This is important in the Sagnac effect. The Global Positioning System accounts for this effect.
