Bug 714445: nsWebMReader should not read preferences off the main thread. r=roc

This commit is contained in:
Kyle Huey 2012-01-01 12:10:49 -05:00
parent e7bb002491
commit dca538b319
2 changed files with 23 additions and 20 deletions

View File

@ -137,9 +137,12 @@ nsWebMReader::nsWebMReader(nsBuiltinDecoder* aDecoder)
mAudioStartUsec(-1),
mAudioFrames(0),
mHasVideo(false),
mHasAudio(false)
mHasAudio(false),
mForceStereoMode(0)
{
MOZ_COUNT_CTOR(nsWebMReader);
Preferences::GetInt("media.webm.force_stereo_mode", &mForceStereoMode);
}
nsWebMReader::~nsWebMReader()
@ -306,10 +309,7 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
break;
}
PRInt32 forceStereoMode;
if (NS_SUCCEEDED(Preferences::GetInt("media.webm.force_stereo_mode",
&forceStereoMode))) {
switch (forceStereoMode) {
switch (mForceStereoMode) {
case 1:
mInfo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
break;
@ -326,7 +326,6 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
mInfo.mStereoMode = STEREO_MODE_MONO;
}
}
}
else if (!mHasAudio && type == NESTEGG_TRACK_AUDIO) {
nestegg_audio_params params;
r = nestegg_track_audio_params(mContext, track, &params);

View File

@ -240,6 +240,10 @@ private:
// 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;
};
#endif