Bug 921963 - [RTSP] Support RTSP in Android JB build. r=sworkman

This commit is contained in:
Vincent Chang 2013-11-13 16:03:26 +08:00
parent 95f2bb6150
commit 45db1e1423
25 changed files with 80 additions and 72 deletions

View File

@ -240,6 +240,7 @@ if test -n "$gonkdir" ; then
MOZ_B2G_BT_BLUEDROID=1
fi
MOZ_RTSP=1
MOZ_NFC=1
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1

View File

@ -393,7 +393,7 @@ RtspMediaResource::Listener::OnConnected(uint8_t aTrackIdx,
}
nsresult
RtspMediaResource::Listener::OnDisconnected(uint8_t aTrackIdx, uint32_t reason)
RtspMediaResource::Listener::OnDisconnected(uint8_t aTrackIdx, nsresult reason)
{
if (!mResource)
return NS_OK;
@ -514,7 +514,7 @@ RtspMediaResource::OnConnected(uint8_t aTrackIdx,
}
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");
@ -523,7 +523,7 @@ RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, uint32_t aReason)
mTrackBuffer[i]->Reset();
}
if (aReason == (uint32_t)NS_ERROR_CONNECTION_REFUSED) {
if (aReason == NS_ERROR_CONNECTION_REFUSED) {
mDecoder->NetworkError();
}
return NS_OK;

View File

@ -108,7 +108,7 @@ interface nsIStreamingProtocolListener : nsISupports
* @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);
};
/**

View File

@ -55,8 +55,8 @@ child:
OnConnected(uint8_t index,
RtspMetadataParam[] meta);
OnDisconnected(uint8_t index,
uint32_t reason);
AsyncOpenFailed(uint8_t reason);
nsresult reason);
AsyncOpenFailed(nsresult reason);
};
} //namespace net

View File

@ -16,9 +16,16 @@ LOCAL_INCLUDES = \
-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

View File

@ -302,7 +302,7 @@ class SendOnDisconnectedTask : public nsRunnable
public:
SendOnDisconnectedTask(nsIStreamingProtocolListener *listener,
uint8_t index,
uint32_t reason)
nsresult reason)
: mListener(listener)
, mIndex(index)
, mReason(reason)
@ -318,14 +318,14 @@ public:
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 =

View File

@ -84,7 +84,7 @@ RtspControllerChild::RecvOnMediaDataAvailable(
{
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());
@ -115,7 +115,7 @@ RtspControllerChild::RecvOnConnected(
// 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));
@ -138,9 +138,9 @@ RtspControllerChild::RecvOnConnected(
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);
}
@ -148,9 +148,9 @@ RtspControllerChild::RecvOnDisconnected(
}
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);
}
@ -249,7 +249,7 @@ 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())
@ -267,7 +267,7 @@ 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())
@ -285,7 +285,7 @@ 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) {
@ -306,7 +306,7 @@ 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()) {
@ -326,7 +326,7 @@ 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))
@ -344,7 +344,7 @@ 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())
@ -392,9 +392,9 @@ RtspControllerChild::OnConnected(uint8_t index,
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;
}

View File

@ -40,9 +40,9 @@ class RtspControllerChild : public nsIStreamingProtocolController
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);

View File

@ -72,10 +72,10 @@ 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;
}
@ -83,10 +83,10 @@ 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;
}
@ -94,10 +94,10 @@ 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;
}
@ -105,10 +105,10 @@ 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;
}
@ -116,10 +116,10 @@ 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;
}
@ -127,10 +127,10 @@ 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;
}
@ -244,9 +244,9 @@ RtspControllerParent::OnConnected(uint8_t index,
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;
}

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "AAMRAssembler"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "AAMRAssembler.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "AAVCAssembler"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "AAVCAssembler.h"

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "AMPEG4AudioAssembler"
#include "RtspPrlog.h"
#include "AMPEG4AudioAssembler.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "AMPEG4ElementaryAssembler"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "AMPEG4ElementaryAssembler.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "APacketSource"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "APacketSource.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARTPConnection"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ARTPConnection.h"

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARTPSession"
#include <utils/Log.h>

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARTPSource"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ARTPSource.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARTPWriter"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ARTPWriter.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARTSPConnection"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ARTSPConnection.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ARawAudioAssembler"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ARawAudioAssembler.h"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ASessionDescription"
#include <utils/Log.h>
#include "RtspPrlog.h"
#include "ASessionDescription.h"

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "RtspPrlog.h"
#include "RTSPSource.h"
#include "ARTPConnection.h"
#include "RTSPConnectionHandler.h"
@ -28,13 +29,6 @@
#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;

View File

@ -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

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "UDPPusher"
#include <utils/Log.h>

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "rtp_test"
#include <utils/Log.h>