Bug 725152 - Only use force_stereo_mode pref if it's explicitly set. r=kinetik

This commit is contained in:
Joe Olivas 2012-02-14 15:35:26 +13:00
parent 8f51dc6a1f
commit dc638382f4
2 changed files with 32 additions and 21 deletions

View File

@ -136,13 +136,17 @@ nsWebMReader::nsWebMReader(nsBuiltinDecoder* aDecoder)
mAudioTrack(0),
mAudioStartUsec(-1),
mAudioFrames(0),
mForceStereoMode(0),
mHasVideo(false),
mHasAudio(false),
mForceStereoMode(0)
mStereoModeForced(false)
{
MOZ_COUNT_CTOR(nsWebMReader);
Preferences::GetInt("media.webm.force_stereo_mode", &mForceStereoMode);
mStereoModeForced =
NS_SUCCEEDED(Preferences::GetInt(
"media.webm.force_stereo_mode",
&mForceStereoMode));
}
nsWebMReader::~nsWebMReader()
@ -309,21 +313,24 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
break;
}
switch (mForceStereoMode) {
case 1:
mInfo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
break;
case 2:
mInfo.mStereoMode = STEREO_MODE_RIGHT_LEFT;
break;
case 3:
mInfo.mStereoMode = STEREO_MODE_TOP_BOTTOM;
break;
case 4:
mInfo.mStereoMode = STEREO_MODE_BOTTOM_TOP;
break;
default:
mInfo.mStereoMode = STEREO_MODE_MONO;
// Switch only when stereo mode is explicitly set.
if (mStereoModeForced) {
switch (mForceStereoMode) {
case 1:
mInfo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
break;
case 2:
mInfo.mStereoMode = STEREO_MODE_RIGHT_LEFT;
break;
case 3:
mInfo.mStereoMode = STEREO_MODE_TOP_BOTTOM;
break;
case 4:
mInfo.mStereoMode = STEREO_MODE_BOTTOM_TOP;
break;
default:
mInfo.mStereoMode = STEREO_MODE_MONO;
}
}
}
else if (!mHasAudio && type == NESTEGG_TRACK_AUDIO) {

View File

@ -201,7 +201,7 @@ private:
nestegg* mContext;
// VP8 decoder state
vpx_codec_ctx_t mVP8;
vpx_codec_ctx_t mVP8;
// Vorbis decoder state
vorbis_info mVorbisInfo;
@ -237,13 +237,17 @@ private:
// Picture region, as relative to the initial frame size.
nsIntRect mPicture;
// Value of the "media.webm.force_stereo_mode" pref, which we need off the
// main thread.
PRInt32 mForceStereoMode;
// Booleans to indicate if we have audio and/or video data
bool mHasVideo;
bool mHasAudio;
// Value of the "media.webm.force_stereo_mode" pref, which we need off the
// main thread.
PRInt32 mForceStereoMode;
// Boolean which is set to true when the "media.webm.force_stereo_mode"
// pref is explicitly set.
bool mStereoModeForced;
};
#endif