Bug 921963 - [RTSP] Support RTSP in Android JB build. r=sworkman
authorVincent Chang <vchang@mozilla.com>
Wed, 13 Nov 2013 16:03:26 +0800
changeset 155143 0def2d6e3665ac1fc7f179c1c2ce72fc62a0b6cc
parent 155015 99084b22e38d9751a1e9dc9b6bcef4a1ae572aee
child 155144 2fe36569617853865cafa727d822dcc55135923c
push id25663
push useremorley@mozilla.com
push dateMon, 18 Nov 2013 10:54:22 +0000
treeherdermozilla-central@3f2e49c7a6fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs921963
milestone28.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 921963 - [RTSP] Support RTSP in Android JB build. r=sworkman
configure.in
content/media/RtspMediaResource.cpp
netwerk/base/public/nsIStreamingProtocolController.idl
netwerk/ipc/PRtspController.ipdl
netwerk/protocol/rtsp/Makefile.in
netwerk/protocol/rtsp/controller/RtspController.cpp
netwerk/protocol/rtsp/controller/RtspControllerChild.cpp
netwerk/protocol/rtsp/controller/RtspControllerChild.h
netwerk/protocol/rtsp/controller/RtspControllerParent.cpp
netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp
netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp
netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp
netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp
netwerk/protocol/rtsp/rtsp/APacketSource.cpp
netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
netwerk/protocol/rtsp/rtsp/ARTPSession.cpp
netwerk/protocol/rtsp/rtsp/ARTPSource.cpp
netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp
netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp
netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp
netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp
netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
netwerk/protocol/rtsp/rtsp/RtspPrlog.h
netwerk/protocol/rtsp/rtsp/UDPPusher.cpp
netwerk/protocol/rtsp/rtsp/rtp_test.cpp
--- a/configure.in
+++ b/configure.in
@@ -235,16 +235,17 @@ if test -n "$gonkdir" ; then
           GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
             MOZ_B2G_BT=1
             MOZ_B2G_BT_BLUEZ=1
         elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
             MOZ_B2G_BT=1
             MOZ_B2G_BT_BLUEDROID=1
         fi
 
+        MOZ_RTSP=1
         MOZ_NFC=1
         MOZ_B2G_CAMERA=1
         MOZ_OMX_DECODER=1
         AC_SUBST(MOZ_OMX_DECODER)
         ;;
     *)
         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
         ;;
--- a/content/media/RtspMediaResource.cpp
+++ b/content/media/RtspMediaResource.cpp
@@ -388,17 +388,17 @@ RtspMediaResource::Listener::OnConnected
                                          nsIStreamingProtocolMetaData *meta)
 {
   if (!mResource)
     return NS_OK;
   return mResource->OnConnected(aTrackIdx, meta);
 }
 
 nsresult
-RtspMediaResource::Listener::OnDisconnected(uint8_t aTrackIdx, uint32_t reason)
+RtspMediaResource::Listener::OnDisconnected(uint8_t aTrackIdx, nsresult reason)
 {
   if (!mResource)
     return NS_OK;
   return mResource->OnDisconnected(aTrackIdx, reason);
 }
 
 nsresult
 RtspMediaResource::Listener::GetInterface(const nsIID & aIID, void **aResult)
@@ -509,26 +509,26 @@ RtspMediaResource::OnConnected(uint8_t a
 
   element->FinishDecoderSetup(mDecoder, this);
   mIsConnected = true;
 
   return NS_OK;
 }
 
 nsresult
-RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, uint32_t aReason)
+RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, nsresult aReason)
 {
   NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
 
   for (uint32_t i = 0 ; i < mTrackBuffer.Length(); ++i) {
     mTrackBuffer[i]->Stop();
     mTrackBuffer[i]->Reset();
   }
 
-  if (aReason == (uint32_t)NS_ERROR_CONNECTION_REFUSED) {
+  if (aReason == NS_ERROR_CONNECTION_REFUSED) {
     mDecoder->NetworkError();
   }
   return NS_OK;
 }
 
 void RtspMediaResource::Suspend(bool aCloseImmediately)
 {
   NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
--- a/netwerk/base/public/nsIStreamingProtocolController.idl
+++ b/netwerk/base/public/nsIStreamingProtocolController.idl
@@ -103,17 +103,17 @@ interface nsIStreamingProtocolListener :
      */
     void onConnected(in uint8_t index, in nsIStreamingProtocolMetaData meta);
 
     /**
      * Called when the Rtsp session is closed.
      * @param index Track number of the media stream.
      * @param reason The reason of disconnection.
      */
-    void onDisconnected(in uint8_t index, in uint32_t reason);
+    void onDisconnected(in uint8_t index, in nsresult reason);
 };
 
 /**
  * Media stream controller API: control and retrieve meta data from media stream.
  */
 [uuid(a9bdd4b0-8559-11e2-9e96-0800200c9a66)]
 interface nsIStreamingProtocolController : nsISupports
 {
--- a/netwerk/ipc/PRtspController.ipdl
+++ b/netwerk/ipc/PRtspController.ipdl
@@ -50,14 +50,14 @@ child:
   OnMediaDataAvailable(uint8_t index,
                        nsCString data,
                        uint32_t length,
                        uint32_t offset,
                        RtspMetadataParam[] meta);
   OnConnected(uint8_t index,
               RtspMetadataParam[] meta);
   OnDisconnected(uint8_t index,
-                 uint32_t reason);
-  AsyncOpenFailed(uint8_t reason);
+                 nsresult reason);
+  AsyncOpenFailed(nsresult reason);
 };
 
 } //namespace net
 } //namespace mozilla
--- a/netwerk/protocol/rtsp/Makefile.in
+++ b/netwerk/protocol/rtsp/Makefile.in
@@ -11,14 +11,21 @@ include $(DEPTH)/config/autoconf.mk
 LOCAL_INCLUDES = \
   -I$(srcdir)/../../base/src \
   -I$(topsrcdir)/content/base/src \
   -I$(topsrcdir)/content/events/src \
   -I$(topsrcdir)/xpcom/ds \
   -I$(srcdir) \
   -I$(srcdir)/rtsp \
   -I$(srcdir)/controller \
-  -I$(ANDROID_SOURCE)/frameworks/base/media/libstagefright/mpeg2ts \
   $(NULL)
 
+ifeq ($(ANDROID_VERSION),$(findstring $(ANDROID_VERSION),15))
+LOCAL_INCLUDES += -I$(ANDROID_SOURCE)/frameworks/base/media/libstagefright/mpeg2ts \
+                  $(NULL)
+else
+LOCAL_INCLUDES += -I$(ANDROID_SOURCE)/frameworks/av/media/libstagefright/mpeg2ts \
+                  $(NULL)
+endif
+
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DIMPL_NS_NET -Wno-multichar -DFORCE_PR_LOG
--- a/netwerk/protocol/rtsp/controller/RtspController.cpp
+++ b/netwerk/protocol/rtsp/controller/RtspController.cpp
@@ -297,40 +297,40 @@ RtspController::OnConnected(uint8_t inde
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 class SendOnDisconnectedTask : public nsRunnable
 {
 public:
   SendOnDisconnectedTask(nsIStreamingProtocolListener *listener,
                          uint8_t index,
-                         uint32_t reason)
+                         nsresult reason)
     : mListener(listener)
     , mIndex(index)
     , mReason(reason)
   { }
 
   NS_IMETHOD Run()
   {
     MOZ_ASSERT(NS_IsMainThread());
     mListener->OnDisconnected(mIndex, mReason);
     return NS_OK;
   }
 
 private:
   nsCOMPtr<nsIStreamingProtocolListener> mListener;
   uint8_t mIndex;
-  uint32_t mReason;
+  nsresult mReason;
 };
 
 NS_IMETHODIMP
 RtspController::OnDisconnected(uint8_t index,
-                               uint32_t reason)
+                               nsresult reason)
 {
-  LOG(("RtspController::OnDisconnected()"));
+  LOG(("RtspController::OnDisconnected() for track %d reason = 0x%x", index, reason));
   mState = DISCONNECTED;
   if (mListener) {
     nsRefPtr<SendOnDisconnectedTask> task =
       new SendOnDisconnectedTask(mListener, index, reason);
     return NS_DispatchToMainThread(task);
   }
   return NS_ERROR_NOT_AVAILABLE;
 }
--- a/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp
+++ b/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp
@@ -79,17 +79,17 @@ RtspControllerChild::RecvOnMediaDataAvai
                        const uint8_t& index,
                        const nsCString& data,
                        const uint32_t& length,
                        const uint32_t& offset,
                        const InfallibleTArray<RtspMetadataParam>& metaArray)
 {
   nsRefPtr<RtspMetaData> meta = new RtspMetaData();
   nsresult rv = meta->DeserializeRtspMetaData(metaArray);
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
 
   if (mListener) {
     mListener->OnMediaDataAvailable(index, data, length, offset, meta.get());
   }
   return true;
 }
 
 void
@@ -110,17 +110,17 @@ RtspControllerChild::RecvOnConnected(
                        const uint8_t& index,
                        const InfallibleTArray<RtspMetadataParam>& metaArray)
 {
   uint32_t tracks;
 
   // Deserialize meta data.
   nsRefPtr<RtspMetaData> meta = new RtspMetaData();
   nsresult rv = meta->DeserializeRtspMetaData(metaArray);
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   meta->GetTotalTracks(&tracks);
   if (tracks <= 0) {
     LOG(("RtspControllerChild::RecvOnConnected invalid tracks %d", tracks));
     // Set the default value.
     tracks = kRtspTotalTracks;
   }
   mTotalTracks = tracks;
   AddMetaData(meta.forget());
@@ -133,29 +133,29 @@ RtspControllerChild::RecvOnConnected(
     }
   }
   return true;
 }
 
 bool
 RtspControllerChild::RecvOnDisconnected(
                        const uint8_t& index,
-                       const uint32_t& reason)
+                       const nsresult& reason)
 {
-  LOG(("RtspControllerChild::RecvOnDisconnected %d %d", index, reason));
+  LOG(("RtspControllerChild::RecvOnDisconnected for track %d reason = 0x%x", index, reason));
   if (mListener) {
     mListener->OnDisconnected(index, reason);
   }
   return true;
 }
 
 bool
-RtspControllerChild::RecvAsyncOpenFailed(const uint8_t& reason)
+RtspControllerChild::RecvAsyncOpenFailed(const nsresult& reason)
 {
-  LOG(("RtspControllerChild::RecvAsyncOpenFailed %d", reason));
+  LOG(("RtspControllerChild::RecvAsyncOpenFailed reason = 0x%x", reason));
   if (mListener) {
     mListener->OnDisconnected(0, NS_ERROR_CONNECTION_REFUSED);
   }
   return true;
 }
 
 void
 RtspControllerChild::AddIPDLReference()
@@ -244,17 +244,17 @@ private:
   IPCEvent mEvent;
   uint64_t mSeekTime;
 };
 
 NS_IMETHODIMP
 RtspControllerChild::Play(void)
 {
   LOG(("RtspControllerChild::Play()"));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
 
   if (NS_IsMainThread()) {
     if (!SendPlay())
       return NS_ERROR_FAILURE;
   } else {
     nsresult rv = NS_DispatchToMainThread(
                     new SendIPCEvent(this, SendPlayEvent));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -262,17 +262,17 @@ RtspControllerChild::Play(void)
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Pause(void)
 {
   LOG(("RtspControllerChild::Pause()"));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
 
   if (NS_IsMainThread()) {
     if (!SendPause())
       return NS_ERROR_FAILURE;
   } else {
     nsresult rv = NS_DispatchToMainThread(
                     new SendIPCEvent(this, SendPauseEvent));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -280,17 +280,17 @@ RtspControllerChild::Pause(void)
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Resume(void)
 {
   LOG(("RtspControllerChild::Resume()"));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
   NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED);
 
   if (!--mSuspendCount) {
     if (NS_IsMainThread()) {
       if (!SendResume())
         return NS_ERROR_FAILURE;
     } else {
       nsresult rv = NS_DispatchToMainThread(
@@ -301,17 +301,17 @@ RtspControllerChild::Resume(void)
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Suspend(void)
 {
   LOG(("RtspControllerChild::Suspend()"));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
 
   if (!mSuspendCount++) {
     if (NS_IsMainThread()) {
       if (!SendSuspend())
         return NS_ERROR_FAILURE;
     } else {
       nsresult rv = NS_DispatchToMainThread(
                       new SendIPCEvent(this, SendSuspendEvent));
@@ -321,17 +321,17 @@ RtspControllerChild::Suspend(void)
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Seek(uint64_t seekTimeUs)
 {
   LOG(("RtspControllerChild::Seek() %llu", seekTimeUs));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
 
   if (NS_IsMainThread()) {
     if (!SendSeek(seekTimeUs))
       return NS_ERROR_FAILURE;
   } else {
     nsresult rv = NS_DispatchToMainThread(
                     new SendIPCEvent(this, SendSeekEvent, seekTimeUs));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -339,17 +339,17 @@ RtspControllerChild::Seek(uint64_t seekT
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Stop()
 {
   LOG(("RtspControllerChild::Stop()"));
-  NS_ENSURE_SUCCESS(mIPCOpen, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_FAILURE);
 
   if (NS_IsMainThread()) {
     if (!SendStop())
       return NS_ERROR_FAILURE;
   } else {
     nsresult rv = NS_DispatchToMainThread(
                     new SendIPCEvent(this, SendStopEvent));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -387,19 +387,19 @@ RtspControllerChild::OnConnected(uint8_t
 
 {
   LOG(("RtspControllerChild::OnConnected()"));
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::OnDisconnected(uint8_t index,
-                                    uint32_t reason)
+                                    nsresult reason)
 {
-  LOG(("RtspControllerChild::OnDisconnected()"));
+  LOG(("RtspControllerChild::OnDisconnected() reason = 0x%x", reason));
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 RtspControllerChild::Init(nsIURI *aURI)
 {
   nsresult rv;
 
--- a/netwerk/protocol/rtsp/controller/RtspControllerChild.h
+++ b/netwerk/protocol/rtsp/controller/RtspControllerChild.h
@@ -35,19 +35,19 @@ class RtspControllerChild : public nsISt
   bool RecvOnMediaDataAvailable(
          const uint8_t& index,
          const nsCString& data,
          const uint32_t& length,
          const uint32_t& offset,
          const InfallibleTArray<RtspMetadataParam>& meta);
 
   bool RecvOnDisconnected(const uint8_t& index,
-                          const uint32_t& reason);
+                          const nsresult& reason);
 
-  bool RecvAsyncOpenFailed(const uint8_t& reason);
+  bool RecvAsyncOpenFailed(const nsresult& reason);
   void AddIPDLReference();
   void ReleaseIPDLReference();
   void AddMetaData(already_AddRefed<nsIStreamingProtocolMetaData> meta);
   int  GetMetaDataLength();
 
  private:
   bool mIPCOpen;
   // Dummy channel used to aid MediaResource creation in HTMLMediaElement.
--- a/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp
+++ b/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp
@@ -67,75 +67,75 @@ RtspControllerParent::RecvAsyncOpen(cons
   mController = nullptr;
   return SendAsyncOpenFailed(rv);
 }
 
 bool
 RtspControllerParent::RecvPlay()
 {
   LOG(("RtspControllerParent::RecvPlay()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Play();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 bool
 RtspControllerParent::RecvPause()
 {
   LOG(("RtspControllerParent::RecvPause()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Pause();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 bool
 RtspControllerParent::RecvResume()
 {
   LOG(("RtspControllerParent::RecvResume()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Resume();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 bool
 RtspControllerParent::RecvSuspend()
 {
   LOG(("RtspControllerParent::RecvSuspend()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Suspend();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 bool
 RtspControllerParent::RecvSeek(const uint64_t& offset)
 {
   LOG(("RtspControllerParent::RecvSeek()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Seek(offset);
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 bool
 RtspControllerParent::RecvStop()
 {
   LOG(("RtspControllerParent::RecvStop()"));
-  NS_ENSURE_TRUE(mController, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mController, true);
 
   nsresult rv = mController->Stop();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, true);
   return true;
 }
 
 NS_IMETHODIMP
 RtspControllerParent::OnMediaDataAvailable(uint8_t index,
                                            const nsACString & data,
                                            uint32_t length,
                                            uint32_t offset,
@@ -239,19 +239,19 @@ RtspControllerParent::OnConnected(uint8_
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerParent::OnDisconnected(uint8_t index,
-                                     uint32_t reason)
+                                     nsresult reason)
 {
-  LOG(("RtspControllerParent::OnDisconnected()"));
+  LOG(("RtspControllerParent::OnDisconnected() for track %d reason = 0x%x", index, reason));
   if (!mIPCOpen || !SendOnDisconnected(index, reason)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RtspControllerParent::GetInterface(const nsIID & iid, void **result)
--- a/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp
+++ b/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "AAMRAssembler"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "AAMRAssembler.h"
 
 #include "ARTPSource.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp
+++ b/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "AAVCAssembler"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "AAVCAssembler.h"
 
 #include "ARTPSource.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp
+++ b/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp
@@ -9,18 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "AMPEG4AudioAssembler"
+#include "RtspPrlog.h"
 
 #include "AMPEG4AudioAssembler.h"
 
 #include "ARTPSource.h"
 
 #include <media/stagefright/foundation/hexdump.h>
 #include <media/stagefright/foundation/ABitReader.h>
 #include <media/stagefright/foundation/ABuffer.h>
--- a/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp
+++ b/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "AMPEG4ElementaryAssembler"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "AMPEG4ElementaryAssembler.h"
 
 #include "ARTPSource.h"
 
 #include <media/stagefright/foundation/ABitReader.h>
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
--- a/netwerk/protocol/rtsp/rtsp/APacketSource.cpp
+++ b/netwerk/protocol/rtsp/rtsp/APacketSource.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "APacketSource"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "APacketSource.h"
 
 #include "ARawAudioAssembler.h"
 #include "ASessionDescription.h"
 
 #include "avc_utils.h"
 
--- a/netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARTPConnection"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ARTPConnection.h"
 
 #include "ARTPSource.h"
 #include "ASessionDescription.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
--- a/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp
@@ -9,17 +9,16 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARTPSession"
 #include <utils/Log.h>
 
 #include "ARTPSession.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/ARTPSource.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTPSource.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARTPSource"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ARTPSource.h"
 
 #include "AAMRAssembler.h"
 #include "AAVCAssembler.h"
 #include "AH263Assembler.h"
 #include "AMPEG4AudioAssembler.h"
 #include "AMPEG4ElementaryAssembler.h"
--- a/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARTPWriter"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ARTPWriter.h"
 
 #include <fcntl.h>
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARTSPConnection"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ARTSPConnection.h"
 
 #include <cutils/properties.h>
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ARawAudioAssembler"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ARawAudioAssembler.h"
 
 #include "ARTPSource.h"
 #include "ASessionDescription.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
--- a/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp
@@ -9,19 +9,18 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "ASessionDescription"
-#include <utils/Log.h>
+#include "RtspPrlog.h"
 
 #include "ASessionDescription.h"
 
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AString.h>
 
 #include <stdlib.h>
 
--- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
+++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp
@@ -9,37 +9,31 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
+#include "RtspPrlog.h"
 #include "RTSPSource.h"
 #include "ARTPConnection.h"
 #include "RTSPConnectionHandler.h"
 #include "RtspMetaData.h"
 #include <AnotherPacketSource.h>
 #include <media/stagefright/MetaData.h>
 #include <media/stagefright/foundation/AString.h>
 #include <media/stagefright/foundation/ALooper.h>
 #include <media/stagefright/foundation/AMessage.h>
 
 #include "nsDebug.h"
 #include "nsString.h"
 #include "nsStringStream.h"
 #include "nsAutoPtr.h"
-#include "prlog.h"
-
-extern PRLogModuleInfo* gRtspLog;
-#define LOGI(msg, ...) PR_LOG(gRtspLog, PR_LOG_ALWAYS, (msg, ##__VA_ARGS__))
-#define LOGV(msg, ...) PR_LOG(gRtspLog, PR_LOG_DEBUG, (msg, ##__VA_ARGS__))
-#define LOGE(msg, ...) PR_LOG(gRtspLog, PR_LOG_ERROR, (msg, ##__VA_ARGS__))
-#define LOGW(msg, ...) PR_LOG(gRtspLog, PR_LOG_WARNING, (msg, ##__VA_ARGS__))
 
 using namespace mozilla;
 using namespace mozilla::net;
 
 namespace android {
 
 RTSPSource::RTSPSource(
         nsIStreamingProtocolListener *aListener,
new file mode 100644
--- /dev/null
+++ b/netwerk/protocol/rtsp/rtsp/RtspPrlog.h
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set sw=2 ts=8 et tw=80 : */
+
+/* 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/. */
+#ifndef RTSPPRLOG_H
+#define RTSPPRLOG_H
+
+#include "prlog.h"
+
+extern PRLogModuleInfo* gRtspLog;
+
+#define LOGI(msg, ...) PR_LOG(gRtspLog, PR_LOG_ALWAYS, (msg, ##__VA_ARGS__))
+#define LOGV(msg, ...) PR_LOG(gRtspLog, PR_LOG_DEBUG, (msg, ##__VA_ARGS__))
+#define LOGE(msg, ...) PR_LOG(gRtspLog, PR_LOG_ERROR, (msg, ##__VA_ARGS__))
+#define LOGW(msg, ...) PR_LOG(gRtspLog, PR_LOG_WARNING, (msg, ##__VA_ARGS__))
+
+#endif  // RTSPPRLOG_H
--- a/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp
+++ b/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp
@@ -9,17 +9,16 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "UDPPusher"
 #include <utils/Log.h>
 
 #include "UDPPusher.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
--- a/netwerk/protocol/rtsp/rtsp/rtp_test.cpp
+++ b/netwerk/protocol/rtsp/rtsp/rtp_test.cpp
@@ -9,17 +9,16 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
-//#define LOG_NDEBUG 0
 #define LOG_TAG "rtp_test"
 #include <utils/Log.h>
 
 #include <binder/ProcessState.h>
 
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/ALooper.h>
 #include <media/stagefright/DataSource.h>