Bug 1244870 - initialization of err variable r?jya draft
authorJean-Luc Bonnafoux <jeanluc.bonnafoux@wanadoo.fr>
Tue, 24 Apr 2018 20:42:02 +0200
changeset 787381 1c66a8a552d56f0d4a087e856a122089ab30ab43
parent 787142 26e53729a10976f52e75efa44e17b5e054969fec
push id107713
push userbmo:jeanluc.bonnafoux@wanadoo.fr
push dateTue, 24 Apr 2018 18:43:23 +0000
reviewersjya
bugs1244870
milestone61.0a1
Bug 1244870 - initialization of err variable r?jya MozReview-Commit-ID: 6Zh7tqNdHeu
dom/media/platforms/omx/OmxPlatformLayer.cpp
--- a/dom/media/platforms/omx/OmxPlatformLayer.cpp
+++ b/dom/media/platforms/omx/OmxPlatformLayer.cpp
@@ -44,22 +44,20 @@ typedef OmxConfig<AudioInfo> OmxAudioCon
 typedef OmxConfig<VideoInfo> OmxVideoConfig;
 
 template<typename ConfigType>
 UniquePtr<ConfigType> ConfigForMime(const nsACString&);
 
 static OMX_ERRORTYPE
 ConfigAudioOutputPort(OmxPlatformLayer& aOmx, const AudioInfo& aInfo)
 {
-  OMX_ERRORTYPE err;
-
   OMX_PARAM_PORTDEFINITIONTYPE def;
   InitOmxParameter(&def);
   def.nPortIndex = aOmx.OutputPortIndex();
-  err = aOmx.GetParameter(OMX_IndexParamPortDefinition, &def, sizeof(def));
+  OMX_ERRORTYPE err = aOmx.GetParameter(OMX_IndexParamPortDefinition, &def, sizeof(def));
   RETURN_IF_ERR(err);
 
   def.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
   err = aOmx.SetParameter(OMX_IndexParamPortDefinition, &def, sizeof(def));
   RETURN_IF_ERR(err);
 
   OMX_AUDIO_PARAM_PCMMODETYPE pcmParams;
   InitOmxParameter(&pcmParams);
@@ -82,22 +80,20 @@ ConfigAudioOutputPort(OmxPlatformLayer& 
   return OMX_ErrorNone;
 }
 
 class OmxAacConfig : public OmxAudioConfig
 {
 public:
   OMX_ERRORTYPE Apply(OmxPlatformLayer& aOmx, const AudioInfo& aInfo) override
   {
-    OMX_ERRORTYPE err;
-
     OMX_AUDIO_PARAM_AACPROFILETYPE aacProfile;
     InitOmxParameter(&aacProfile);
     aacProfile.nPortIndex = aOmx.InputPortIndex();
-    err = aOmx.GetParameter(OMX_IndexParamAudioAac, &aacProfile, sizeof(aacProfile));
+    OMX_ERRORTYPE err = aOmx.GetParameter(OMX_IndexParamAudioAac, &aacProfile, sizeof(aacProfile));
     RETURN_IF_ERR(err);
 
     aacProfile.nChannels = aInfo.mChannels;
     aacProfile.nSampleRate = aInfo.mRate;
     aacProfile.eAACProfile = static_cast<OMX_AUDIO_AACPROFILETYPE>(aInfo.mProfile);
     err = aOmx.SetParameter(OMX_IndexParamAudioAac, &aacProfile, sizeof(aacProfile));
     RETURN_IF_ERR(err);
 
@@ -108,22 +104,20 @@ public:
   }
 };
 
 class OmxMp3Config : public OmxAudioConfig
 {
 public:
   OMX_ERRORTYPE Apply(OmxPlatformLayer& aOmx, const AudioInfo& aInfo) override
   {
-    OMX_ERRORTYPE err;
-
     OMX_AUDIO_PARAM_MP3TYPE mp3Param;
     InitOmxParameter(&mp3Param);
     mp3Param.nPortIndex = aOmx.InputPortIndex();
-    err = aOmx.GetParameter(OMX_IndexParamAudioMp3, &mp3Param, sizeof(mp3Param));
+    OMX_ERRORTYPE err = aOmx.GetParameter(OMX_IndexParamAudioMp3, &mp3Param, sizeof(mp3Param));
     RETURN_IF_ERR(err);
 
     mp3Param.nChannels = aInfo.mChannels;
     mp3Param.nSampleRate = aInfo.mRate;
     err = aOmx.SetParameter(OMX_IndexParamAudioMp3, &mp3Param, sizeof(mp3Param));
     RETURN_IF_ERR(err);
 
     LOG("Config OMX_IndexParamAudioMp3, channel %lu, sample rate %lu",
@@ -139,22 +133,20 @@ enum OmxAmrSampleRate {
 };
 
 template <OmxAmrSampleRate R>
 class OmxAmrConfig : public OmxAudioConfig
 {
 public:
   OMX_ERRORTYPE Apply(OmxPlatformLayer& aOmx, const AudioInfo& aInfo) override
   {
-    OMX_ERRORTYPE err;
-
     OMX_AUDIO_PARAM_AMRTYPE def;
     InitOmxParameter(&def);
     def.nPortIndex = aOmx.InputPortIndex();
-    err = aOmx.GetParameter(OMX_IndexParamAudioAmr, &def, sizeof(def));
+    OMX_ERRORTYPE err = aOmx.GetParameter(OMX_IndexParamAudioAmr, &def, sizeof(def));
     RETURN_IF_ERR(err);
 
     def.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
     err = aOmx.SetParameter(OMX_IndexParamAudioAmr, &def, sizeof(def));
     RETURN_IF_ERR(err);
 
     MOZ_ASSERT(aInfo.mChannels == 1);
     MOZ_ASSERT(aInfo.mRate == R);
@@ -191,17 +183,17 @@ class OmxCommonVideoConfig : public OmxV
 {
 public:
   explicit OmxCommonVideoConfig()
     : OmxVideoConfig()
   {}
 
   OMX_ERRORTYPE Apply(OmxPlatformLayer& aOmx, const VideoInfo& aInfo) override
   {
-    OMX_ERRORTYPE err;
+    OMX_ERRORTYPE err = OMX_ErrorNone;
     OMX_PARAM_PORTDEFINITIONTYPE def;
 
     // Set up in/out port definition.
     nsTArray<uint32_t> ports;
     aOmx.GetPortIndices(ports);
     for (auto idx : ports) {
       InitOmxParameter(&def);
       def.nPortIndex = idx;