Bug 1182444: Show audio as enabled when an audio track is present in stream. r=jesup

This commit is contained in:
Jean-Yves Avenard 2015-07-16 19:15:06 +10:00
parent fc1b65e187
commit 70c1e1f031
2 changed files with 27 additions and 0 deletions

View File

@ -3569,6 +3569,12 @@ HTMLMediaElement::UpdateReadyStateInternal()
// We are playing a stream that has video and a video frame is now set.
// This means we have all metadata needed to change ready state.
MediaInfo mediaInfo = mMediaInfo;
if (hasAudio) {
mediaInfo.EnableAudio();
}
if (hasVideo) {
mediaInfo.EnableVideo();
}
MetadataLoaded(&mediaInfo, nsAutoPtr<const MetadataTags>(nullptr));
}

View File

@ -339,11 +339,32 @@ public:
return mVideo.IsValid();
}
void EnableVideo()
{
if (HasVideo()) {
return;
}
// Set dummy values so that HasVideo() will return true;
// See VideoInfo::IsValid()
mVideo.mDisplay = nsIntSize(1, 1);
}
bool HasAudio() const
{
return mAudio.IsValid();
}
void EnableAudio()
{
if (HasAudio()) {
return;
}
// Set dummy values so that HasAudio() will return true;
// See AudioInfo::IsValid()
mAudio.mChannels = 2;
mAudio.mRate = 44100;
}
bool IsEncrypted() const
{
return mCrypto.IsEncrypted();