Bug 1102658 - Add initial references to the last few AudioData constructor callsites. r=bholley
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 21 Nov 2014 15:29:19 +1300
changeset 241127 d2828e139d252c1d2c5027dc38d0b96ac645d663
parent 241126 deb0b389efa7a82812c04a73657aeecf1ff5d663
child 241128 42c5ee6094ee1413a5bb7f645e9214a1afa24806
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1102658
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1102658 - Add initial references to the last few AudioData constructor callsites. r=bholley
dom/media/fmp4/android/AndroidDecoderModule.cpp
dom/media/fmp4/apple/AppleATDecoder.cpp
dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
--- a/dom/media/fmp4/android/AndroidDecoderModule.cpp
+++ b/dom/media/fmp4/android/AndroidDecoderModule.cpp
@@ -109,22 +109,23 @@ public:
 
     uint32_t numChannels = aFormat->GetInteger(NS_LITERAL_CSTRING("channel-count"));
     uint32_t sampleRate = aFormat->GetInteger(NS_LITERAL_CSTRING("sample-rate"));
     uint32_t numFrames = (aInfo->getSize() / numChannels) / 2;
 
     AudioDataValue* audio = new AudioDataValue[aInfo->getSize()];
     PodCopy(audio, static_cast<AudioDataValue*>(aBuffer), aInfo->getSize());
 
-    mCallback->Output(new AudioData(aInfo->getOffset(), aInfo->getPresentationTimeUs(),
-                                    aDuration,
-                                    numFrames,
-                                    audio,
-                                    numChannels,
-                                    sampleRate));
+    nsRefPtr<AudioData> data = new AudioData(aInfo->getOffset(), aInfo->getPresentationTimeUs(),
+                                             aDuration,
+                                             numFrames,
+                                             audio,
+                                             numChannels,
+                                             sampleRate);
+    mCallback->Output(data);
     return NS_OK;
   }
 };
 
 
 bool AndroidDecoderModule::SupportsAudioMimeType(const char* aMimeType) {
   JNIEnv* env = GetJNIForThread();
   MediaCodec* decoder = CreateDecoder(env, aMimeType);
--- a/dom/media/fmp4/apple/AppleATDecoder.cpp
+++ b/dom/media/fmp4/apple/AppleATDecoder.cpp
@@ -262,23 +262,23 @@ AppleATDecoder::SubmitSample(nsAutoPtr<m
 
     LOG("pushed audio at time %lfs; duration %lfs\n",
         (double)aSample->composition_timestamp / USECS_PER_S,
         (double)duration.value() / USECS_PER_S);
 
     nsAutoArrayPtr<AudioDataValue>
       data(new AudioDataValue[outputData.Length()]);
     PodCopy(data.get(), &outputData[0], outputData.Length());
-    AudioData* audio = new AudioData(aSample->byte_offset,
-                                     aSample->composition_timestamp,
-                                     duration.value(),
-                                     numFrames,
-                                     data.forget(),
-                                     channels,
-                                     rate);
+    nsRefPtr<AudioData> audio = new AudioData(aSample->byte_offset,
+                                              aSample->composition_timestamp,
+                                              duration.value(),
+                                              numFrames,
+                                              data.forget(),
+                                              channels,
+                                              rate);
     mCallback->Output(audio);
   }
 
   if (mTaskQueue->IsEmpty()) {
     mCallback->InputExhausted();
   }
 }
 
--- a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
@@ -123,23 +123,23 @@ FFmpegAudioDecoder<LIBAV_VER>::DecodePac
       CheckedInt<Microseconds> duration =
         FramesToUsecs(mFrame->nb_samples, samplingRate);
       if (!duration.isValid()) {
         NS_WARNING("Invalid count of accumulated audio samples");
         mCallback->Error();
         return;
       }
 
-      AudioData* data = new AudioData(samplePosition,
-                                      pts,
-                                      duration.value(),
-                                      mFrame->nb_samples,
-                                      audio.forget(),
-                                      numChannels,
-                                      samplingRate);
+      nsRefPtr<AudioData> data = new AudioData(samplePosition,
+                                               pts,
+                                               duration.value(),
+                                               mFrame->nb_samples,
+                                               audio.forget(),
+                                               numChannels,
+                                               samplingRate);
       mCallback->Output(data);
       pts += duration.value();
     }
     packet.data += bytesConsumed;
     packet.size -= bytesConsumed;
     samplePosition += bytesConsumed;
   }