Merge mozilla-central into mozilla-inbound
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 02 Feb 2013 13:53:46 -0500
changeset 122208 2962a3ff97dad7b1468a3b54c0bb474853f61585
parent 122207 13654177590abae26b328c9d2e0356a3e235423c (current diff)
parent 122205 be76182b91a66ecfb464df2d9b8de481ed57ce90 (diff)
child 122209 4466d3ff8ada315e689120977012702733af932e
push idunknown
push userunknown
push dateunknown
milestone21.0a1
Merge mozilla-central into mozilla-inbound
mach
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1358893928000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1359495205000">
   <emItems>
       <emItem  blockID="i58" id="webmaster@buzzzzvideos.info">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
                         <versionRange  minVersion="0.1" maxVersion="4.3.1.00" severity="1">
                     </versionRange>
@@ -202,16 +202,20 @@
       <emItem  blockID="i222" id="dealcabby@jetpack">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i51" id="admin@youtubeplayer.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i258" id="helperbar@helperbar.com">
+                        <versionRange  minVersion="0" maxVersion="*" severity="1">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i46" id="{841468a1-d7f4-4bd3-84e6-bb0f13a06c64}">
                         <versionRange  minVersion="0.1" maxVersion="*">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="9.0a1" maxVersion="9.0" />
                           </targetApplication>
                     </versionRange>
                   </emItem>
       <emItem  blockID="i256" id="/^[0-9a-f]+@[0-9a-f]+\.info/">
@@ -297,16 +301,20 @@
       <emItem  blockID="i109" id="{392e123b-b691-4a5e-b52f-c4c1027e749c}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i76" id="crossriderapp3924@crossrider.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i262" id="{167d9323-f7cc-48f5-948a-6f012831a69f}">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i196" id="info@wxdownloadmanager.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i67" id="youtube2@youtube2.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
@@ -504,17 +512,21 @@
                   </pluginItem>
       <pluginItem  blockID="p85">
                   <match name="filename" exp="JavaPlugin2_NPAPI\.plugin" />                      <versionRange  minVersion="0" maxVersion="13.6.0" severity="1"></versionRange>
                   </pluginItem>
       <pluginItem  os="Darwin" blockID="p89">
                   <match name="filename" exp="AdobePDFViewerNPAPI\.plugin" />                      <versionRange  minVersion="0" maxVersion="10.1.3" severity="1"></versionRange>
                   </pluginItem>
       <pluginItem  blockID="p94">
-                  <match name="filename" exp="Flash\ Player\.plugin" />                      <versionRange  minVersion="0" maxVersion="10.2.159.1" severity="0"></versionRange>
+                  <match name="filename" exp="Flash\ Player\.plugin" />                                    <versionRange  minVersion="0" maxVersion="10.2.159.1" severity="0">
+                                <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+                              <versionRange  minVersion="0" maxVersion="17.*" />
+                          </targetApplication>
+                  </versionRange>
                   </pluginItem>
       <pluginItem  blockID="p102">
                   <match name="filename" exp="npmozax\.dll" />                      <versionRange  minVersion="0" maxVersion="*"></versionRange>
                   </pluginItem>
       <pluginItem  blockID="p113">
                   <match name="filename" exp="npuplaypc\.dll" />                      <versionRange  minVersion="0" maxVersion="1.0.0.0" severity="1"></versionRange>
                   </pluginItem>
       <pluginItem  blockID="p119">
@@ -679,16 +691,23 @@
                   </pluginItem>
       <pluginItem  blockID="p254">
                   <match name="filename" exp="PDF Browser Plugin\.plugin" />                                    <versionRange  minVersion="0" maxVersion="2.4.2" severity="1">
                                 <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="18.0a1" maxVersion="*" />
                           </targetApplication>
                   </versionRange>
                   </pluginItem>
+      <pluginItem  blockID="p260">
+                  <match name="filename" exp="(NPSWF32\.dll)|(Flash\ Player\.plugin)" />                                    <versionRange  minVersion="0" maxVersion="10.2.9999" severity="0" vulnerabilitystatus="1">
+                                <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+                              <versionRange  minVersion="18.0a1" maxVersion="*" />
+                          </targetApplication>
+                  </versionRange>
+                  </pluginItem>
     </pluginItems>
 
   <gfxItems>
     <gfxBlacklistEntry  blockID="g35">      <os>WINNT 6.1</os>      <vendor>0x10de</vendor>              <devices>
                       <device>0x0a6c</device>
                   </devices>
             <feature>DIRECT2D</feature>      <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>      <driverVersion>8.17.12.5896</driverVersion>      <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>    </gfxBlacklistEntry>
     <gfxBlacklistEntry  blockID="g36">      <os>WINNT 6.1</os>      <vendor>0x10de</vendor>              <devices>
--- a/mach
+++ b/mach
@@ -7,19 +7,19 @@ from __future__ import print_function, u
 
 import os
 import platform
 import sys
 
 # Ensure we are running Python 2.7+. We put this check here so we generate a
 # user-friendly error message rather than a cryptic stack trace on module
 # import.
-if sys.version_info[0] == 2 and sys.version_info[1] < 7:
-    print('Python 2.7 or above is required to run mach.')
-    print('You are running', platform.python_version())
+if sys.version_info[0] != 2 or sys.version_info[1] < 7:
+    print('Python 2.7 or above (but not Python 3) is required to run mach.')
+    print('You are running Python', platform.python_version())
     sys.exit(1)
 
 # TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
 SEARCH_PATHS = [
     'python/mach',
     'python/mozboot',
     'python/mozbuild',
     'build',
--- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h
+++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h
@@ -156,16 +156,19 @@ public:
                       mEchoCancel(webrtc::kEcAec)
   {
   }
 
   virtual ~WebrtcAudioConduit();
 
   MediaConduitErrorCode Init(WebrtcAudioConduit *other);
 
+  int GetChannel() { return mChannel; }
+  webrtc::VoiceEngine* GetVoiceEngine() { return mVoiceEngine; }
+
 private:
   WebrtcAudioConduit(const WebrtcAudioConduit& other) MOZ_DELETE;
   void operator=(const WebrtcAudioConduit& other) MOZ_DELETE;
 
   //Local database of currently applied receive codecs
   typedef std::vector<AudioCodecConfig* > RecvCodecList;
 
   //Function to convert between WebRTC and Conduit codec structures
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -1,13 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "VideoConduit.h"
+#include "AudioConduit.h"
 #include "video_engine/include/vie_errors.h"
 #include "CSFLog.h"
 
 namespace mozilla {
 
 static const char* logTag ="WebrtcVideoSessionConduit";
 
 const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
@@ -67,16 +68,17 @@ WebrtcVideoConduit::~WebrtcVideoConduit(
   {
     mPtrViECodec->Release();
   }
 
   if(mPtrViEBase)
   {
     mPtrViEBase->StopSend(mChannel);
     mPtrViEBase->StopReceive(mChannel);
+    SyncTo(nullptr);
     mPtrViEBase->DeleteChannel(mChannel);
     mPtrViEBase->Release();
   }
 
   if (mPtrRTP)
   {
     mPtrRTP->Release();
   }
@@ -229,16 +231,32 @@ MediaConduitErrorCode WebrtcVideoConduit
     CSFLogError(logTag,  "%s NACKStatus Failed %d ", __FUNCTION__,
                 mPtrViEBase->LastError());
     return kMediaConduitNACKStatusError;
   }
   CSFLogError(logTag, "%s Initialization Done", __FUNCTION__);
   return kMediaConduitNoError;
 }
 
+void
+WebrtcVideoConduit::SyncTo(WebrtcAudioConduit *aConduit)
+{
+  CSFLogDebug(logTag, "%s Synced to %p", __FUNCTION__, aConduit);
+
+  if (aConduit) {
+    mPtrViEBase->SetVoiceEngine(aConduit->GetVoiceEngine());
+    mPtrViEBase->ConnectAudioChannel(mChannel, aConduit->GetChannel());
+    // NOTE: this means the VideoConduit will keep the AudioConduit alive!
+    mSyncedTo = aConduit;
+  } else if (mSyncedTo) {
+    mPtrViEBase->DisconnectAudioChannel(mChannel);
+    mPtrViEBase->SetVoiceEngine(nullptr);
+    mSyncedTo = nullptr;
+  }
+}
 
 MediaConduitErrorCode
 WebrtcVideoConduit::AttachRenderer(mozilla::RefPtr<VideoRenderer> aVideoRenderer)
 {
   CSFLogDebug(logTag,  "%s ", __FUNCTION__);
 
   //null renderer
   if(!aVideoRenderer)
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
@@ -28,31 +28,38 @@
  using  webrtc::ViECodec;
  using  webrtc::ViECapture;
  using  webrtc::ViERender;
  using  webrtc::ViEExternalCapture;
 
 
 namespace mozilla {
 
+class WebrtcAudioConduit;
+
 /**
  * Concrete class for Video session. Hooks up
  *  - media-source and target to external transport
  */
 class WebrtcVideoConduit:public VideoSessionConduit
                          ,public webrtc::Transport
                          ,public webrtc::ExternalRenderer
 {
 
 public:
 
   //VoiceEngine defined constant for Payload Name Size.
   static const unsigned int CODEC_PLNAME_SIZE;
 
   /**
+   * Set up A/V sync between this (incoming) VideoConduit and an audio conduit.
+   */
+  void SyncTo(WebrtcAudioConduit *aConduit);
+
+  /**
    * Function to attach Renderer end-point for the Media-Video conduit.
    * @param aRenderer : Reference to the concrete Video renderer implementation
    * Note: Multiple invocations of this API shall remove an existing renderer
    * and attaches the new to the Conduit.
    */
    MediaConduitErrorCode AttachRenderer(mozilla::RefPtr<VideoRenderer> aVideoRenderer);
 
   /**
@@ -201,15 +208,17 @@ private:
   bool mEngineTransmitting; //If true ==> Transmit Sub-system is up and running
   bool mEngineReceiving;    // if true ==> Receive Sus-sysmtem up and running
   bool mEngineRendererStarted; // If true ==> Rendering Sub-system is up and running
 
   int mChannel; // Video Channel for this conduit
   int mCapId;   // Capturer for this conduit
   RecvCodecList    mRecvCodecList;
   VideoCodecConfig* mCurSendCodecConfig;
+
+  mozilla::RefPtr<WebrtcAudioConduit> mSyncedTo;
 };
 
 
 
 } // end namespace
 
 #endif
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -1352,17 +1352,17 @@ static int vcmRxStartICE_m(cc_mcapid_t m
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing audio pipeline");
       return VCM_ERROR;
     }
 
     CSFLogDebug(logTag, "Created audio pipeline %p, conduit=%p, pc_stream=%d pc_track=%d",
                 pipeline.get(), conduit.get(), pc_stream_id, pc_track_id);
 
-    stream->StorePipeline(pc_track_id, pipeline);
+    stream->StorePipeline(pc_track_id, false, pipeline);
   } else if (CC_IS_VIDEO(mcap_id)) {
 
     std::vector<mozilla::VideoCodecConfig *> configs;
     // Instantiate an appropriate conduit
     mozilla::RefPtr<mozilla::VideoSessionConduit> conduit =
              mozilla::VideoSessionConduit::Create();
     if(!conduit)
       return VCM_ERROR;
@@ -1396,17 +1396,17 @@ static int vcmRxStartICE_m(cc_mcapid_t m
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing video pipeline");
       return VCM_ERROR;
     }
 
     CSFLogDebug(logTag, "Created video pipeline %p, conduit=%p, pc_stream=%d pc_track=%d",
                 pipeline.get(), conduit.get(), pc_stream_id, pc_track_id);
 
-    stream->StorePipeline(pc_track_id, pipeline);
+    stream->StorePipeline(pc_track_id, true, pipeline);
   } else {
     CSFLogError(logTag, "%s: mcap_id unrecognized", __FUNCTION__);
     return VCM_ERROR;
   }
 
   CSFLogDebug( logTag, "%s success", __FUNCTION__);
   return 0;
 }
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -115,16 +115,18 @@ class MediaPipeline : public sigslot::ha
 
   virtual Direction direction() const { return direction_; }
 
   int rtp_packets_sent() const { return rtp_packets_sent_; }
   int rtcp_packets_sent() const { return rtp_packets_sent_; }
   int rtp_packets_received() const { return rtp_packets_received_; }
   int rtcp_packets_received() const { return rtp_packets_received_; }
 
+  MediaSessionConduit *Conduit() { return conduit_; }
+
   // Thread counting
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPipeline)
 
  protected:
   virtual void DetachMediaStream() {}
 
   // Separate class to allow ref counting
   class PipelineTransport : public TransportInterface {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -7,16 +7,18 @@
 #include "cc_constants.h"
 #include "CSFLog.h"
 #include "CSFLogStream.h"
 
 #include "nricectx.h"
 #include "nricemediastream.h"
 #include "PeerConnectionImpl.h"
 #include "PeerConnectionMedia.h"
+#include "AudioConduit.h"
+#include "VideoConduit.h"
 #include "runnable_utils.h"
 
 #ifdef MOZILLA_INTERNAL_API
 #include "MediaStreamList.h"
 #include "nsIScriptGlobalObject.h"
 #include "jsapi.h"
 #endif
 
@@ -324,22 +326,45 @@ LocalSourceStreamInfo::StorePipeline(int
   }
   //TODO: Revisit once we start supporting multiple streams or multiple tracks
   // of same type
   mPipelines[aTrack] = aPipeline;
 }
 
 void
 RemoteSourceStreamInfo::StorePipeline(int aTrack,
-  mozilla::RefPtr<mozilla::MediaPipeline> aPipeline)
+                                      bool aIsVideo,
+                                      mozilla::RefPtr<mozilla::MediaPipeline> aPipeline)
 {
   MOZ_ASSERT(mPipelines.find(aTrack) == mPipelines.end());
   if (mPipelines.find(aTrack) != mPipelines.end()) {
-    CSFLogErrorS(logTag, __FUNCTION__ << ": Storing duplicate track");
+    CSFLogErrorS(logTag, __FUNCTION__ << ": Request to store duplicate track " << aTrack);
     return;
   }
+  CSFLogDebug(logTag, "%s track %d %s = %p", __FUNCTION__, aTrack, aIsVideo ? "video" : "audio",
+              aPipeline.get());
+  // See if we have both audio and video here, and if so cross the streams and sync them
+  // XXX Needs to be adjusted when we support multiple streams of the same type
+  for (std::map<int, bool>::iterator it = mTypes.begin(); it != mTypes.end(); ++it) {
+    if (it->second != aIsVideo) {
+      // Ok, we have one video, one non-video - cross the streams!
+      mozilla::WebrtcAudioConduit *audio_conduit = static_cast<mozilla::WebrtcAudioConduit*>
+                                                   (aIsVideo ?
+                                                    mPipelines[it->first]->Conduit() :
+                                                    aPipeline->Conduit());
+      mozilla::WebrtcVideoConduit *video_conduit = static_cast<mozilla::WebrtcVideoConduit*>
+                                                   (aIsVideo ?
+                                                    aPipeline->Conduit() :
+                                                    mPipelines[it->first]->Conduit());
+      video_conduit->SyncTo(audio_conduit);
+      CSFLogDebug(logTag, "Syncing %p to %p, %d to %d", video_conduit, audio_conduit,
+                  aTrack, it->first);
+    }
+  }
   //TODO: Revisit once we start supporting multiple streams or multiple tracks
   // of same type
   mPipelines[aTrack] = aPipeline;
+  //TODO: move to attribute on Pipeline
+  mTypes[aTrack] = aIsVideo;
 }
 
 
 }  // namespace sipcc
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
@@ -200,32 +200,35 @@ class RemoteSourceStreamInfo {
     mMediaStream(already_AddRefed<nsDOMMediaStream>(aMediaStream)),
     mPipelines() {
       MOZ_ASSERT(aMediaStream);
     }
 
   nsDOMMediaStream* GetMediaStream() {
     return mMediaStream;
   }
-  void StorePipeline(int aTrack, mozilla::RefPtr<mozilla::MediaPipeline> aPipeline);
+  void StorePipeline(int aTrack, bool aIsVideo,
+                     mozilla::RefPtr<mozilla::MediaPipeline> aPipeline);
 
   void Detach() {
     // walk through all the MediaPipelines and disconnect them.
+    // XXX we should clear the mTypes map
     for (std::map<int, mozilla::RefPtr<mozilla::MediaPipeline> >::iterator it =
            mPipelines.begin(); it != mPipelines.end();
          ++it) {
       it->second->Shutdown();
     }
     mMediaStream = NULL;
   }
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteSourceStreamInfo)
  private:
   nsRefPtr<nsDOMMediaStream> mMediaStream;
   std::map<int, mozilla::RefPtr<mozilla::MediaPipeline> > mPipelines;
+  std::map<int, bool> mTypes;
 };
 
 class PeerConnectionMedia : public sigslot::has_slots<> {
  public:
   PeerConnectionMedia(PeerConnectionImpl *parent)
       : mParent(parent),
       mLocalSourceStreamsLock(PR_NewLock()),
       mIceCtx(NULL) {}
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -203,14 +203,66 @@ class Warnings(MachCommandBase):
             if warning['column'] is not None:
                 print('%s:%d:%d [%s] %s' % (filename, warning['line'],
                     warning['column'], warning['flag'], warning['message']))
             else:
                 print('%s:%d [%s] %s' % (filename, warning['line'],
                     warning['flag'], warning['message']))
 
 @CommandProvider
+class ClangCommands(MachCommandBase):
+    @Command('clang-complete', help='Generate a .clang_complete file.')
+    def clang_complete(self):
+        import shlex
+
+        build_vars = {}
+
+        def on_line(line):
+            elements = [s.strip() for s in line.split('=', 1)]
+
+            if len(elements) != 2:
+                return
+
+            build_vars[elements[0]] = elements[1]
+
+        try:
+            old_logger = self.log_manager.replace_terminal_handler(None)
+            self._run_make(target='showbuild', log=False, line_handler=on_line)
+        finally:
+            self.log_manager.replace_terminal_handler(old_logger)
+
+        def print_from_variable(name):
+            if name not in build_vars:
+                return
+
+            value = build_vars[name]
+
+            value = value.replace('-I.', '-I%s' % self.topobjdir)
+            value = value.replace(' .', ' %s' % self.topobjdir)
+            value = value.replace('-I..', '-I%s/..' % self.topobjdir)
+            value = value.replace(' ..', ' %s/..' % self.topobjdir)
+
+            args = shlex.split(value)
+            for i in range(0, len(args) - 1):
+                arg = args[i]
+
+                if arg.startswith(('-I', '-D')):
+                    print(arg)
+                    continue
+
+                if arg.startswith('-include'):
+                    print(arg + ' ' + args[i + 1])
+                    continue
+
+        print_from_variable('COMPILE_CXXFLAGS')
+
+        print('-I%s/ipc/chromium/src' % self.topsrcdir)
+        print('-I%s/ipc/glue' % self.topsrcdir)
+        print('-I%s/ipc/ipdl/_ipdlheaders' % self.topobjdir)
+
+
+@CommandProvider
 class Package(MachCommandBase):
     """Package the built product for distribution."""
 
     @Command('package', help='Package the built product for distribution as an APK, DMG, etc.')
     def package(self):
         return self._run_make(directory=".", target='package', ensure_exit_code=False)