Bug 567056. Rename mAspectRatio to mPixelAspectRatio. r=kinetik
authorChris Double <chris.double@double.co.nz>
Mon, 24 May 2010 09:36:10 +1200
changeset 42580 229f7795d5d1fc855535801a5ab56e3225c72feb
parent 42579 b37bdb032fe774d3795cf37f4a445c0f62f06c66
child 42581 680805a771ab1b868c533f0b906046cac3ed7ab2
push id13409
push userrocallahan@mozilla.com
push dateSun, 23 May 2010 21:42:20 +0000
treeherdermozilla-central@5a490984d550 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs567056
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 567056. Rename mAspectRatio to mPixelAspectRatio. r=kinetik
content/media/nsBuiltinDecoderReader.h
content/media/nsBuiltinDecoderStateMachine.cpp
content/media/nsMediaDecoder.cpp
content/media/nsMediaDecoder.h
content/media/ogg/nsOggCodecState.cpp
content/media/ogg/nsOggCodecState.h
content/media/ogg/nsOggReader.cpp
layout/base/FrameLayerBuilder.cpp
--- a/content/media/nsBuiltinDecoderReader.h
+++ b/content/media/nsBuiltinDecoderReader.h
@@ -51,30 +51,30 @@
 
 class nsBuiltinDecoderStateMachine;
 
 // Stores info relevant to presenting media samples.
 class nsVideoInfo {
 public:
   nsVideoInfo()
     : mFramerate(0.0),
-      mAspectRatio(1.0),
+      mPixelAspectRatio(1.0),
       mCallbackPeriod(1),
       mAudioRate(0),
       mAudioChannels(0),
       mFrame(0,0),
       mHasAudio(PR_FALSE),
       mHasVideo(PR_FALSE)
   {}
 
   // Frames per second.
   float mFramerate;
 
-  // Aspect ratio, as stored in the metadata.
-  float mAspectRatio;
+  // Pixel aspect ratio, as stored in the metadata.
+  float mPixelAspectRatio;
 
   // Length of a video frame in milliseconds, or the callback period if
   // there's no audio.
   PRUint32 mCallbackPeriod;
 
   // Samples per second.
   PRUint32 mAudioRate;
 
--- a/content/media/nsBuiltinDecoderStateMachine.cpp
+++ b/content/media/nsBuiltinDecoderStateMachine.cpp
@@ -1025,17 +1025,17 @@ void nsBuiltinDecoderStateMachine::Rende
 
   if (aData->mDuplicate) {
     return;
   }
 
   nsRefPtr<Image> image = aData->mImage;
   if (image) {
     const nsVideoInfo& info = mReader->GetInfo();
-    mDecoder->SetVideoData(gfxIntSize(info.mPicture.width, info.mPicture.height), info.mAspectRatio, image);
+    mDecoder->SetVideoData(gfxIntSize(info.mPicture.width, info.mPicture.height), info.mPixelAspectRatio, image);
   }
 }
 
 PRInt64
 nsBuiltinDecoderStateMachine::GetAudioClock()
 {
   NS_ASSERTION(IsCurrentThread(mDecoder->mStateMachineThread), "Should be on state machine thread.");
   if (!mAudioStream || !HasAudio())
--- a/content/media/nsMediaDecoder.cpp
+++ b/content/media/nsMediaDecoder.cpp
@@ -65,17 +65,17 @@
 
 nsMediaDecoder::nsMediaDecoder() :
   mElement(0),
   mRGBWidth(-1),
   mRGBHeight(-1),
   mProgressTime(),
   mDataTime(),
   mVideoUpdateLock(nsnull),
-  mAspectRatio(1.0),
+  mPixelAspectRatio(1.0),
   mSizeChanged(PR_FALSE),
   mShuttingDown(PR_FALSE)
 {
   MOZ_COUNT_CTOR(nsMediaDecoder);
 }
 
 nsMediaDecoder::~nsMediaDecoder()
 {
@@ -121,24 +121,24 @@ void nsMediaDecoder::Invalidate()
   nsIFrame* frame = mElement->GetPrimaryFrame();
 
   {
     nsAutoLock lock(mVideoUpdateLock);
     if (mSizeChanged) {
       nsIntSize scaledSize(mRGBWidth, mRGBHeight);
       // Apply the aspect ratio to produce the intrinsic size we report
       // to the element.
-      if (mAspectRatio > 1.0) {
+      if (mPixelAspectRatio > 1.0) {
         // Increase the intrinsic width
         scaledSize.width =
-          ConditionDimension(mAspectRatio*scaledSize.width, scaledSize.width);
+          ConditionDimension(mPixelAspectRatio*scaledSize.width, scaledSize.width);
       } else {
         // Increase the intrinsic height
         scaledSize.height =
-          ConditionDimension(scaledSize.height/mAspectRatio, scaledSize.height);
+          ConditionDimension(scaledSize.height/mPixelAspectRatio, scaledSize.height);
       }
       mElement->UpdateMediaSize(scaledSize);
 
       mSizeChanged = PR_FALSE;
       if (frame) {
         nsPresContext* presContext = frame->PresContext();
         nsIPresShell *presShell = presContext->PresShell();
         presShell->FrameNeedsReflow(frame,
@@ -208,24 +208,24 @@ nsresult nsMediaDecoder::StopProgress()
 
   nsresult rv = mProgressTimer->Cancel();
   mProgressTimer = nsnull;
 
   return rv;
 }
 
 void nsMediaDecoder::SetVideoData(const gfxIntSize& aSize,
-                                  float aAspectRatio,
+                                  float aPixelAspectRatio,
                                   Image* aImage)
 {
   nsAutoLock lock(mVideoUpdateLock);
 
   if (mRGBWidth != aSize.width || mRGBHeight != aSize.height ||
-      mAspectRatio != aAspectRatio) {
+      mPixelAspectRatio != aPixelAspectRatio) {
     mRGBWidth = aSize.width;
     mRGBHeight = aSize.height;
-    mAspectRatio = aAspectRatio;
+    mPixelAspectRatio = aPixelAspectRatio;
     mSizeChanged = PR_TRUE;
   }
   if (mImageContainer && aImage) {
     mImageContainer->SetCurrentImage(aImage);
   }
 }
--- a/content/media/nsMediaDecoder.h
+++ b/content/media/nsMediaDecoder.h
@@ -226,17 +226,17 @@ public:
   // Gets the image container for the media element. Will return null if
   // the element is not a video element. This can be called from any
   // thread; ImageContainers can be used from any thread.
   ImageContainer* GetImageContainer() { return mImageContainer; }
 
   // Set the video width, height, pixel aspect ratio, and current image.
   // Ownership of the image is transferred to the decoder.
   void SetVideoData(const gfxIntSize& aSize,
-                    float aAspectRatio,
+                    float aPixelAspectRatio,
                     Image* aImage);
 
 protected:
 
   // Start timer to update download progress information.
   nsresult StartProgress();
 
   // Stop progress information timer.
@@ -278,17 +278,17 @@ protected:
   // in the midst of being changed.
   PRLock* mVideoUpdateLock;
 
   // Framerate of video being displayed in the element
   // expressed in numbers of frames per second.
   float mFramerate;
 
   // Pixel aspect ratio (ratio of the pixel width to pixel height)
-  float mAspectRatio;
+  float mPixelAspectRatio;
 
   // Has our size changed since the last repaint?
   PRPackedBool mSizeChanged;
 
   // True if the decoder is being shutdown. At this point all events that
   // are currently queued need to return immediately to prevent javascript
   // being run that operates on the element and decoder during shutdown.
   // Read/Write from the main thread only.
--- a/content/media/ogg/nsOggCodecState.cpp
+++ b/content/media/ogg/nsOggCodecState.cpp
@@ -144,17 +144,17 @@ PRBool nsOggCodecState::PageInFromBuffer
 }
 
 nsTheoraState::nsTheoraState(ogg_page* aBosPage) :
   nsOggCodecState(aBosPage),
   mSetup(0),
   mCtx(0),
   mFrameDuration(0),
   mFrameRate(0),
-  mAspectRatio(0)
+  mPixelAspectRatio(0)
 {
   MOZ_COUNT_CTOR(nsTheoraState);
   th_info_init(&mInfo);
   th_comment_init(&mComment);
 }
 
 nsTheoraState::~nsTheoraState() {
   MOZ_COUNT_DTOR(nsTheoraState);
@@ -186,17 +186,17 @@ PRBool nsTheoraState::Init() {
   if (f > PR_UINT32_MAX) {
     return mActive = PR_FALSE;
   }
   mFrameDuration = static_cast<PRUint32>(f);
 
   n = mInfo.aspect_numerator;
 
   d = mInfo.aspect_denominator;
-  mAspectRatio = (n == 0 || d == 0) ?
+  mPixelAspectRatio = (n == 0 || d == 0) ?
     1.0f : static_cast<float>(n) / static_cast<float>(d);
 
   // Ensure the frame isn't larger than our prescribed maximum.
   PRUint32 pixels;
   if (!MulOverflow32(mInfo.pic_width, mInfo.pic_height, pixels) ||
       pixels > MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT ||
       pixels == 0)
   {
--- a/content/media/ogg/nsOggCodecState.h
+++ b/content/media/ogg/nsOggCodecState.h
@@ -185,17 +185,17 @@ public:
   th_dec_ctx* mCtx;
 
   // Frame duration in ms.
   PRUint32 mFrameDuration;
 
   // Number of frames per second.
   float mFrameRate;
 
-  float mAspectRatio;
+  float mPixelAspectRatio;
 };
 
 class nsSkeletonState : public nsOggCodecState {
 public:
   nsSkeletonState(ogg_page* aBosPage);
   virtual ~nsSkeletonState();
   virtual CodecType GetType() { return TYPE_SKELETON; }
   virtual PRBool DecodeHeader(ogg_packet* aPacket);
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -245,26 +245,24 @@ nsresult nsOggReader::ReadMetadata()
     if (s != mVorbisState && s != mTheoraState) {
       s->Deactivate();
     }
   }
 
   // Initialize the first Theora and Vorbis bitstreams. According to the
   // Theora spec these can be considered the 'primary' bitstreams for playback.
   // Extract the metadata needed from these streams.
-  float aspectRatio = 0;
   // Set a default callback period for if we have no video data
   mCallbackPeriod = 1000 / AUDIO_FRAME_RATE;
   if (mTheoraState) {
     if (mTheoraState->Init()) {
       mCallbackPeriod = mTheoraState->mFrameDuration;
-      aspectRatio = mTheoraState->mAspectRatio;
       gfxIntSize sz(mTheoraState->mInfo.pic_width,
                     mTheoraState->mInfo.pic_height);
-      mDecoder->SetVideoData(sz, mTheoraState->mAspectRatio, nsnull);
+      mDecoder->SetVideoData(sz, mTheoraState->mPixelAspectRatio, nsnull);
     } else {
       mTheoraState = nsnull;
     }
   }
   if (mVorbisState) {
     mVorbisState->Init();
   }
 
@@ -272,17 +270,17 @@ nsresult nsOggReader::ReadMetadata()
   mInfo.mHasVideo = HasVideo();
   mInfo.mCallbackPeriod = mCallbackPeriod;
   if (HasAudio()) {
     mInfo.mAudioRate = mVorbisState->mInfo.rate;
     mInfo.mAudioChannels = mVorbisState->mInfo.channels;
   }
   if (HasVideo()) {
     mInfo.mFramerate = mTheoraState->mFrameRate;
-    mInfo.mAspectRatio = mTheoraState->mAspectRatio;
+    mInfo.mPixelAspectRatio = mTheoraState->mPixelAspectRatio;
     mInfo.mPicture.width = mTheoraState->mInfo.pic_width;
     mInfo.mPicture.height = mTheoraState->mInfo.pic_height;
     mInfo.mPicture.x = mTheoraState->mInfo.pic_x;
     mInfo.mPicture.y = mTheoraState->mInfo.pic_y;
     mInfo.mFrame.width = mTheoraState->mInfo.frame_width;
     mInfo.mFrame.height = mTheoraState->mInfo.frame_height;
   }
   mInfo.mDataOffset = mDataOffset;
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -417,16 +417,19 @@ FrameLayerBuilder::MakeContainerLayerFor
   nsAutoTArray<LayerItems*,10> layerItems;
   BuildLayers(aBuilder, aChildren, aManager, &layerItems);
 
   Layer* lastChild = nsnull;
   for (PRUint32 i = 0; i < layerItems.Length(); ++i) {
     Layer* child = layerItems[i]->mLayer;
     container->InsertAfter(child, lastChild);
     lastChild = child;
+    // release the layer now because the ItemGroup destructor doesn't run;
+    // the container is still holding a reference to it
+    layerItems[i]->mLayer = nsnull;
   }
   container->SetIsOpaqueContent(aChildren.IsOpaque());
   nsRefPtr<Layer> layer = container.forget();
   return layer.forget();
 }
 
 /* static */ void
 FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,