diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
--- a/content/html/content/public/nsHTMLMediaElement.h
+++ b/content/html/content/public/nsHTMLMediaElement.h
@@ -57,16 +57,17 @@
 
 typedef PRUint16 nsMediaNetworkState;
 typedef PRUint16 nsMediaReadyState;
 
 class nsHTMLMediaElement : public nsGenericHTMLElement,
                            public nsIObserver
 {
   typedef mozilla::layers::ImageContainer ImageContainer;
+  typedef mozilla::layers::ImageLayer ImageLayer;
 
 public:
   enum CanPlayStatus {
     CANPLAY_NO,
     CANPLAY_MAYBE,
     CANPLAY_YES
   };
 
@@ -175,16 +176,18 @@ public:
   // Called by the media decoder to indicate that the download has stalled
   // (no data has arrived for a while).
   void DownloadStalled();
 
   // Called by the media decoder and the video frame to get the
   // ImageContainer containing the video data.
   ImageContainer* GetImageContainer();
 
+  already_AddRefed<ImageLayer> GetImageLayer();
+
   // Called by the video frame to get the print surface, if this is
   // a static document and we're not actually playing video
   gfxASurface* GetPrintSurface() { return mPrintSurface; }
 
   // Dispatch events
   nsresult DispatchEvent(const nsAString& aName);
   nsresult DispatchAsyncEvent(const nsAString& aName);
   nsresult DispatchAudioAvailableEvent(float* aFrameBuffer,
@@ -522,16 +525,18 @@ protected:
   void Error(PRUint16 aErrorCode);
 
   nsRefPtr<nsMediaDecoder> mDecoder;
 
   // A reference to the ImageContainer which contains the current frame
   // of video to display.
   nsRefPtr<ImageContainer> mImageContainer;
 
+  nsRefPtr<ImageLayer> mImageLayer;
+
   // Holds a reference to the first channel we open to the media resource.
   // Once the decoder is created, control over the channel passes to the
   // decoder, and we null out this reference. We must store this in case
   // we need to cancel the channel before control of it passes to the decoder.
   nsCOMPtr<nsIChannel> mChannel;
 
   // Error attribute
   nsCOMPtr<nsIDOMMediaError> mError;
diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -2268,16 +2268,35 @@ ImageContainer* nsHTMLMediaElement::GetI
   nsRefPtr<LayerManager> manager = nsContentUtils::LayerManagerForDocument(GetOwnerDoc());
   if (!manager)
     return nsnull;
 
   mImageContainer = manager->CreateImageContainer();
   return mImageContainer;
 }
 
+already_AddRefed<ImageLayer> nsHTMLMediaElement::GetImageLayer()
+{
+  printf("%s\n",__PRETTY_FUNCTION__);
+  // Only video frames need an image container.
+  nsCOMPtr<nsIDOMHTMLVideoElement> video =
+    do_QueryInterface(static_cast<nsIContent*>(this));
+  if (!video)
+    return nsnull;
+  printf("getting frame...\n");
+  nsIFrame* frame = GetPrimaryFrame();
+  printf("frame=%p\n", frame);
+  if (frame && frame->GetType() == nsGkAtoms::HTMLVideoFrame &&
+      static_cast<nsVideoFrame*>(frame)->ShouldDisplayPoster()) {
+      printf("getting layer\n");
+    return static_cast<nsVideoFrame*>(frame)->GetLayer();
+  }
+  return nsnull;
+}
+
 nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
                                                          PRUint32 aFrameBufferLength,
                                                          float aTime)
 {
   // Auto manage the memory for the frame buffer. If we fail and return
   // an error, this ensures we free the memory in the frame buffer. Otherwise
   // we hand off ownership of the frame buffer to the audioavailable event,
   // which frees the memory when it's destroyed.
diff --git a/content/media/gstreamer/nsGStreamerLink.cpp b/content/media/gstreamer/nsGStreamerLink.cpp
--- a/content/media/gstreamer/nsGStreamerLink.cpp
+++ b/content/media/gstreamer/nsGStreamerLink.cpp
@@ -181,17 +181,17 @@ PRBool nsGStreamerLink::Init(nsHTMLMedia
   // Init base class
   if (!nsMediaDecoder::Init(aElement)) {
     NS_WARNING("Unable to initialise base class");
     TerminatingError(PR_TRUE);
     return PR_FALSE;
   }
 
   // Creating the image container for pushing the PLANAR YCbCr Data
-  mImageContainer = aElement->GetImageContainer();
+  //mImageContainer = aElement->GetImageContainer();
 
   // Remember that we initialised the base class (for cleanup purposes)
   mBaseClassIsInitialised = PR_TRUE;
 
   return PR_TRUE;
 }
 
 void nsGStreamerLink::Shutdown()
diff --git a/content/media/gstreamer/nsGStreamerVideoBin.cpp b/content/media/gstreamer/nsGStreamerVideoBin.cpp
--- a/content/media/gstreamer/nsGStreamerVideoBin.cpp
+++ b/content/media/gstreamer/nsGStreamerVideoBin.cpp
@@ -48,19 +48,20 @@
 
 
 #include "nsGStreamerConfig.h"
 #include "nsGStreamerLog.h"
 #include "nsGStreamerUtil.h"
 #include "nsGStreamerVideoBin.h"
 #include "string.h"
 #include "nsThreadUtils.h"
-
+#include "gfxImageSurface.h"
 using namespace mozilla;
 using mozilla::layers::ImageContainer;
+using mozilla::layers::ImageLayer;
 using mozilla::layers::PlanarYCbCrImage;
 
 nsGStreamerVideoBin::nsGStreamerVideoBin() :
     mVideoBin(nsnull),
     mImage(nsnull),
     mColorConverter(nsnull),
     mVideoSink(nsnull),
     mVideoBuffer(nsnull),
@@ -218,23 +219,85 @@ void nsGStreamerVideoBin::SetElementWrap
   mElementWrapper = aElementWrapper;
 }
 
 void nsGStreamerVideoBin::SetStreamerDecoder(
     nsGStreamerDecoder *aStreamerDecoder)
 {
   mStreamerDecoder = aStreamerDecoder;
 }
+void nsGStreamerVideoBin::GetBufferPointer(PRInt32 aWidth,
+                                           PRInt32 aHeight,
+                                           PRUint32 aSize,
+                                           unsigned char** aVideoBuffer)
+{
+  printf("%s\n",__PRETTY_FUNCTION__);
+  nsHTMLMediaElement* element = GetElementWrapper()->GetHTMLMediaElement();
+  if (!element) {
+    NS_GSTREAMER_LOG(("HTMLMediaElement not initialized\n"));
+    printf("no htmlmedia element!");
+    return;
+  }
+
+  nsRefPtr<ImageLayer> imageLayer = element->GetImageLayer();
+  if (!imageLayer) {
+    NS_GSTREAMER_LOG(("ImageLayer not initialized\n"));
+    printf("layer not initialized\n");
+    return;
+  }
+
+/*  if(imageLayer->Manager()->GetBackendType != LAYERS_OPENGL) {
+    NS_GSTREAMER_LOG(("not opengl layer manager\n"));
+    printf("not opengl layer manager\n");
+    return;
+  }
+*/
+  nsRefPtr<gfxContext> ctx=imageLayer->BeginUpdate();
+  if(ctx==nsnull){
+    NS_GSTREAMER_LOG(("didn't get Context!\n"));
+    printf("didn't get Context!\n");
+    return;
+  }
+
+  gfxImageSurface* imageSurface = static_cast<gfxImageSurface*>(ctx->OriginalSurface());
+  *aVideoBuffer = imageSurface->Data();
+  printf("aVideoBuffer:%p width:%u height:%u\n",
+          *aVideoBuffer,
+           imageSurface->Width(),
+           imageSurface->Height());
+}
 
 void nsGStreamerVideoBin::SetVideoData(PRInt32 aWidth,
                                        PRInt32 aHeight,
                                        float aFramerate,
                                        float aAspectRatio,
                                        unsigned char* aVideoBuffer)
 {
+  nsHTMLMediaElement* element = GetElementWrapper()->GetHTMLMediaElement();
+  if (!element) {
+    NS_GSTREAMER_LOG(("HTMLMediaElement not initialized\n"));
+    printf("no htmlmedia element!");
+    return;
+  }
+
+  nsRefPtr<ImageLayer> imageLayer = element->GetImageLayer();
+  if (!imageLayer) {
+    NS_GSTREAMER_LOG(("ImageLayer not initialized\n"));
+    printf("layer not initialized\n");
+    return;
+  }
+
+/*  if(imageLayer->Manager()->GetBackendType != LAYERS_OPENGL) {
+    NS_GSTREAMER_LOG(("not opengl layer manager\n"));
+    printf("not opengl layer manager\n");
+    return;
+  }
+*/
+  imageLayer->EndUpdate();
+
   if (!aVideoBuffer) {
     NS_GSTREAMER_LOG(("NULL Buffer\n"));
     return;
   }
 
   if (mPositionChangeQueued) {
     free(aVideoBuffer);
     NS_GSTREAMER_LOG(("Dropping the Buffer\n"));
@@ -271,21 +334,21 @@ void nsGStreamerVideoBin::SetVideoData(P
 //  NS_GSTREAMER_LOG(("."));
 
   NS_GSTREAMER_LOG(("-"));
 
   sSetRGBCalled++;
 
   Image::Format format = Image::PLANAR_YCBCR;
 
-  nsHTMLMediaElement* element = GetElementWrapper()->GetHTMLMediaElement();
+/*  nsHTMLMediaElement* element = GetElementWrapper()->GetHTMLMediaElement();
   if (!element) {
     NS_GSTREAMER_LOG(("HTMLMediaElement not initialized\n"));
     return;
-  }
+  }*/
 
   ImageContainer* imageContainer = element->GetImageContainer();
   if (!imageContainer) {
     NS_GSTREAMER_LOG(("ImageContainer not initialized\n"));
     return;
   }
 
   mImage = imageContainer->CreateImage(&format, 1);
diff --git a/content/media/gstreamer/nsGStreamerVideoBin.h b/content/media/gstreamer/nsGStreamerVideoBin.h
--- a/content/media/gstreamer/nsGStreamerVideoBin.h
+++ b/content/media/gstreamer/nsGStreamerVideoBin.h
@@ -148,16 +148,20 @@ class nsGStreamerVideoBin : private nsGS
     nsGStreamerDecoder *GetStreamerDecoder() {return mStreamerDecoder;};
 
     virtual void SetVideoData(PRInt32 aWidth,
                               PRInt32 aHeight,
                               float aFramerate,
                               float aAspectRatio,
                               unsigned char* aVideoBuffer);
 
+    virtual void GetBufferPointer(PRInt32 aWidth,
+                              PRInt32 aHeight,
+                              PRUint32 aSize,
+                              unsigned char** aVideoBuffer);
     // TODO: Remove below debug code
     gint mNoOfFrames;
 
     // PR_TRUE if an event to notify about a change in the playback
     // position has been queued, but not yet run. It is set to PR_FALSE when
     // the event is run. This allows coalescing of these events as they can be
     // produced many times per second. Synchronised via decoder monitor.
     // Accessed on main and state machine threads.
diff --git a/content/media/gstreamer/nsGStreamerVideoSinkInterface.h b/content/media/gstreamer/nsGStreamerVideoSinkInterface.h
--- a/content/media/gstreamer/nsGStreamerVideoSinkInterface.h
+++ b/content/media/gstreamer/nsGStreamerVideoSinkInterface.h
@@ -56,12 +56,16 @@ class nsGStreamerVideoSinkInterface
 {
   public:
     // Called when a frame is decoded
     virtual void SetVideoData(PRInt32 aWidth,
                               PRInt32 aHeight,
                               float aFramerate,
                               float aAspectRatio,
                               unsigned char* aVideoBuffer) = 0;
+    virtual void GetBufferPointer(PRInt32 aWidth,
+                                  PRInt32 aHeight,
+                                  PRUint32 aSize,
+                                  unsigned char** aVideoBuffer) = 0;
 };
 
 #endif
 
diff --git a/content/media/gstreamer/nsGstVideoSink.cpp b/content/media/gstreamer/nsGstVideoSink.cpp
--- a/content/media/gstreamer/nsGstVideoSink.cpp
+++ b/content/media/gstreamer/nsGstVideoSink.cpp
@@ -353,18 +353,23 @@ static GstFlowReturn gst_fennecvideosink
                        "invalid caps for buffer allocation %"
                        GST_PTR_FORMAT,
                        aCaps);
     return GST_FLOW_NOT_NEGOTIATED;
   }
 
 
   // Allocate a buffer with new
-  PRUint8 *newBuffer = new PRUint8 [aSize];
 
+  PRUint8 *newBuffer=NULL;// = new PRUint8 [aSize];
+  fennecvideosink->mVideoSinkInterface->GetBufferPointer(
+      GST_VIDEO_SINK_WIDTH(fennecvideosink),
+      GST_VIDEO_SINK_HEIGHT(fennecvideosink),
+      aSize,
+      &newBuffer);
   // Check that we got the buffer
   if (!newBuffer) {
     // Return error if we didn't
     return GST_FLOW_ERROR;
   }
 
   // Create gst buffer
   *aBuf = gst_buffer_try_new_and_alloc (0);
diff --git a/gfx/layers/ImageLayers.h b/gfx/layers/ImageLayers.h
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -36,16 +36,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_IMAGELAYER_H
 #define GFX_IMAGELAYER_H
 
 #include "Layers.h"
 
 #include "gfxPattern.h"
+#include "gfxContext.h"
 #include "nsThreadUtils.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * A class representing a buffer of pixel data. The data can be in one
  * of various formats including YCbCr.
@@ -227,16 +228,22 @@ public:
     // This makes our snapping equivalent to what would happen if our content
     // was drawn into a ThebesLayer (gfxContext would snap using the local
     // transform, then we'd snap again when compositing the ThebesLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), snap, nsnull)*
         SnapTransform(aTransformToSurface, gfxRect(0, 0, 0, 0), nsnull);
   }
 
+  virtual nsRefPtr<gfxContext> BeginUpdate() {
+      printf("%s not implemented for this type\n", __PRETTY_FUNCTION__);
+      return nsnull;
+  };
+  virtual void EndUpdate() { };
+
 protected:
   ImageLayer(LayerManager* aManager, void* aImplData)
     : Layer(aManager, aImplData), mFilter(gfxPattern::FILTER_GOOD) {}
 
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix);
 
   nsRefPtr<ImageContainer> mContainer;
   gfxPattern::GraphicsFilter mFilter;
diff --git a/gfx/layers/opengl/ImageLayerOGL.cpp b/gfx/layers/opengl/ImageLayerOGL.cpp
--- a/gfx/layers/opengl/ImageLayerOGL.cpp
+++ b/gfx/layers/opengl/ImageLayerOGL.cpp
@@ -853,13 +853,26 @@ ShadowImageLayerOGL::RenderLayer(int aPr
   program->SetRenderOffset(aOffset);
   program->SetTextureUnit(0);
 
   mOGLManager->BindAndDrawQuad(program);
 
   DEBUG_GL_ERROR_CHECK(gl());
 }
 
+nsRefPtr<gfxContext> ShadowImageLayerOGL::BeginUpdate()
+{
+    nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(mFrontSurfaceDescriptor);
+    gfxIntSize size = surf->GetSize();
+    mTexImage = gl()->CreateTextureImage(surf);
+    nsIntRegion updateRegion(nsIntRect(0, 0, size.width, size.height));
+    return mTexImage->BeginUpdate(updateRegion);
+}
+
+void ShadowImageLayerOGL::EndUpdate()
+{
+    mTexImage->EndUpdate();
+}
 #endif  // MOZ_IPC
 
 
 } /* layers */
 } /* mozilla */
diff --git a/gfx/layers/opengl/ImageLayerOGL.h b/gfx/layers/opengl/ImageLayerOGL.h
--- a/gfx/layers/opengl/ImageLayerOGL.h
+++ b/gfx/layers/opengl/ImageLayerOGL.h
@@ -181,16 +181,17 @@ public:
 
   // LayerOGL Implementation
   virtual void Destroy() { mDestroyed = PR_TRUE; }
   virtual void DeleteSurface() { printf("%s\n",__PRETTY_FUNCTION__);}; //XXX FIXME
   virtual Layer* GetLayer();
 
   virtual void RenderLayer(int aPreviousFrameBuffer,
                            const nsIntPoint& aOffset);
+
 };
 
 class THEBES_API PlanarYCbCrImageOGL : public PlanarYCbCrImage
 {
   typedef mozilla::gl::GLContext GLContext;
 
 public:
   PlanarYCbCrImageOGL(LayerManagerOGL *aManager,
@@ -259,16 +260,18 @@ public:
   // LayerOGL impl
   virtual void Destroy();
   virtual void DeleteSurface();
 
   virtual Layer* GetLayer();
 
   virtual void RenderLayer(int aPreviousFrameBuffer,
                            const nsIntPoint& aOffset);
+  nsRefPtr<gfxContext> BeginUpdate();
+  void EndUpdate();
 
 private:
   nsRefPtr<TextureImage> mTexImage;
   nsRefPtr<TextureImage> mBackTexImage;
 
   SurfaceDescriptor mFrontSurfaceDescriptor;
   SurfaceDescriptor mBackSurfaceDescriptor;
   PRBool mDoDirectBind;
diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -251,35 +251,41 @@ nsVideoFrame::BuildLayer(nsDisplayListBu
                       presContext->AppUnitsToGfxUnits(area.width),
                       presContext->AppUnitsToGfxUnits(area.height));
   r = CorrectForAspectRatio(r, videoSize);
   r.Round();
   gfxIntSize scaleHint(static_cast<PRInt32>(r.Width()),
                        static_cast<PRInt32>(r.Height()));
   container->SetScaleHint(scaleHint);
 
-  nsRefPtr<ImageLayer> layer = static_cast<ImageLayer*>
+  mLayer = static_cast<ImageLayer*>
     (aBuilder->LayerBuilder()->GetLeafLayerFor(aBuilder, aManager, aItem));
-  if (!layer) {
-    layer = aManager->CreateImageLayer();
-    if (!layer)
+  if (!mLayer) {
+    mLayer = aManager->CreateImageLayer();
+    if (!mLayer)
       return nsnull;
   }
 
-  layer->SetContainer(container);
-  layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
+  mLayer->SetContainer(container);
+  mLayer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
   // Set a transform on the layer to draw the video in the right place
   gfxMatrix transform;
   transform.Translate(r.pos);
   transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
-  layer->SetTransform(gfx3DMatrix::From2D(transform));
-  nsRefPtr<Layer> result = layer.forget();
+  mLayer->SetTransform(gfx3DMatrix::From2D(transform));
+  nsRefPtr<Layer> result = mLayer.get();
   return result.forget();
 }
 
+already_AddRefed<ImageLayer>
+nsVideoFrame::GetLayer()
+{
+    return mLayer.get();
+}
+
 NS_IMETHODIMP
 nsVideoFrame::Reflow(nsPresContext*           aPresContext,
                      nsHTMLReflowMetrics&     aMetrics,
                      const nsHTMLReflowState& aReflowState,
                      nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsVideoFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
diff --git a/layout/generic/nsVideoFrame.h b/layout/generic/nsVideoFrame.h
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -55,16 +55,17 @@ class nsPresContext;
 class nsDisplayItem;
 
 nsIFrame* NS_NewVideoFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 class nsVideoFrame : public nsContainerFrame, public nsIAnonymousContentCreator
 {
 public:
   typedef mozilla::layers::Layer Layer;
+  typedef mozilla::layers::ImageLayer ImageLayer;
   typedef mozilla::layers::LayerManager LayerManager;
 
   nsVideoFrame(nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
@@ -116,16 +117,17 @@ public:
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                      LayerManager* aManager,
                                      nsDisplayItem* aItem);
 
+  already_AddRefed<ImageLayer> GetLayer();
 protected:
 
   // Returns PR_TRUE if we're rendering for a video element. We still create
   // nsVideoFrame to render controls for an audio element.
   PRBool HasVideoElement();
 
   // Returns PR_TRUE if there is video data to render. Can return false
   // when we're the frame for an audio element, or we've created a video
@@ -141,11 +143,14 @@ protected:
 
   nsMargin mBorderPadding;
   
   // Anonymous child which is bound via XBL to the video controls.
   nsCOMPtr<nsIContent> mVideoControls;
   
   // Anonymous child which is the image element of the poster frame.
   nsCOMPtr<nsIContent> mPosterImage;
+  
+  //the layer, if any
+  nsRefPtr<ImageLayer> mLayer;
 };
 
 #endif /* nsVideoFrame_h___ */
diff --git a/netwerk/system/qt/nsQtNetworkManager.cpp b/netwerk/system/qt/nsQtNetworkManager.cpp
--- a/netwerk/system/qt/nsQtNetworkManager.cpp
+++ b/netwerk/system/qt/nsQtNetworkManager.cpp
@@ -103,16 +103,17 @@ nsQtNetworkManager::isOnline()
 {
     static PRBool sForceOnlineUSB = getenv("MOZ_USB_NET") != 0;
     return sForceOnlineUSB || QNetworkConfigurationManager().isOnline();
 }
 
 PRBool
 nsQtNetworkManager::EmitOpenConnection(const QString &host)
 {
+    return true;
     qDebug() << "EmitOpenConnection";
     //we are already online -> return true.
     if (isOnline())
       return true;
 
     if (NS_IsMainThread())
     {
         openSession();

