am 67738486: Merge "Remove stagefright foundation\'s incompatible logging interface and update callsites." into gingerbread
Merge commit '67738486d9d1bdc2e6fb0c04698fd74de689acbc' into gingerbread-plus-aosp * commit '67738486d9d1bdc2e6fb0c04698fd74de689acbc': Remove stagefright foundation's incompatible logging interface and update callsites.
This commit is contained in:
@@ -22,45 +22,18 @@
|
||||
|
||||
#include <media/stagefright/foundation/ABase.h>
|
||||
#include <media/stagefright/foundation/AString.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
enum LogType {
|
||||
VERBOSE,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
FATAL,
|
||||
};
|
||||
|
||||
struct Logger {
|
||||
Logger(LogType type);
|
||||
virtual ~Logger();
|
||||
|
||||
template<class T> Logger &operator<<(const T &x) {
|
||||
mMessage.append(x);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
android::AString mMessage;
|
||||
LogType mLogType;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(Logger);
|
||||
};
|
||||
|
||||
const char *LeafName(const char *s);
|
||||
|
||||
#undef LOG
|
||||
#define LOG(type) Logger(type) << LeafName(__FILE__) << ":" << __LINE__ << " "
|
||||
#define LITERAL_TO_STRING_INTERNAL(x) #x
|
||||
#define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x)
|
||||
|
||||
#define CHECK(condition) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
LOG(FATAL) << "CHECK(" #condition ") failed."; \
|
||||
} \
|
||||
} while (false)
|
||||
LOG_ALWAYS_FATAL_IF( \
|
||||
!(condition), \
|
||||
__FILE__ ":" LITERAL_TO_STRING(__LINE__) \
|
||||
" CHECK(" #condition ") failed.")
|
||||
|
||||
#define MAKE_COMPARATOR(suffix,op) \
|
||||
template<class A, class B> \
|
||||
@@ -85,8 +58,10 @@ MAKE_COMPARATOR(GT,>)
|
||||
do { \
|
||||
AString ___res = Compare_##suffix(x, y); \
|
||||
if (!___res.empty()) { \
|
||||
LOG(FATAL) << "CHECK_" #suffix "(" #x "," #y ") failed: " \
|
||||
<< ___res; \
|
||||
LOG_ALWAYS_FATAL( \
|
||||
__FILE__ ":" LITERAL_TO_STRING(__LINE__) \
|
||||
" CHECK_" #suffix "( " #x "," #y ") failed: %s", \
|
||||
___res.c_str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
@@ -97,7 +72,7 @@ MAKE_COMPARATOR(GT,>)
|
||||
#define CHECK_GE(x,y) CHECK_OP(x,y,GE,>=)
|
||||
#define CHECK_GT(x,y) CHECK_OP(x,y,GT,>)
|
||||
|
||||
#define TRESPASS() LOG(FATAL) << "Should not be here."
|
||||
#define TRESPASS() LOG_ALWAYS_FATAL("Should not be here.")
|
||||
|
||||
} // namespace android
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ size_t PageCache::releaseFromStart(size_t maxBytes) {
|
||||
}
|
||||
|
||||
void PageCache::copy(size_t from, void *data, size_t size) {
|
||||
LOG(VERBOSE) << "copy from " << from << " size " << size;
|
||||
LOGV("copy from %d size %d", from, size);
|
||||
|
||||
CHECK_LE(from + size, mTotalSize);
|
||||
|
||||
@@ -228,7 +228,7 @@ void NuCachedSource2::onMessageReceived(const sp<AMessage> &msg) {
|
||||
}
|
||||
|
||||
void NuCachedSource2::fetchInternal() {
|
||||
LOG(VERBOSE) << "fetchInternal";
|
||||
LOGV("fetchInternal");
|
||||
|
||||
CHECK_EQ(mFinalStatus, (status_t)OK);
|
||||
|
||||
@@ -240,11 +240,11 @@ void NuCachedSource2::fetchInternal() {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
if (n < 0) {
|
||||
LOG(ERROR) << "source returned error " << n;
|
||||
LOGE("source returned error %ld", n);
|
||||
mFinalStatus = n;
|
||||
mCache->releasePage(page);
|
||||
} else if (n == 0) {
|
||||
LOG(INFO) << "ERROR_END_OF_STREAM";
|
||||
LOGI("ERROR_END_OF_STREAM");
|
||||
mFinalStatus = ERROR_END_OF_STREAM;
|
||||
mCache->releasePage(page);
|
||||
} else {
|
||||
@@ -254,10 +254,10 @@ void NuCachedSource2::fetchInternal() {
|
||||
}
|
||||
|
||||
void NuCachedSource2::onFetch() {
|
||||
LOG(VERBOSE) << "onFetch";
|
||||
LOGV("onFetch");
|
||||
|
||||
if (mFinalStatus != OK) {
|
||||
LOG(VERBOSE) << "EOS reached, done prefetching for now";
|
||||
LOGV("EOS reached, done prefetching for now");
|
||||
mFetching = false;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ void NuCachedSource2::onFetch() {
|
||||
|
||||
if (mFetching || keepAlive) {
|
||||
if (keepAlive) {
|
||||
LOG(INFO) << "Keep alive";
|
||||
LOGI("Keep alive");
|
||||
}
|
||||
|
||||
fetchInternal();
|
||||
@@ -276,7 +276,7 @@ void NuCachedSource2::onFetch() {
|
||||
mLastFetchTimeUs = ALooper::GetNowUs();
|
||||
|
||||
if (mFetching && mCache->totalSize() >= kHighWaterThreshold) {
|
||||
LOG(INFO) << "Cache full, done prefetching for now";
|
||||
LOGI("Cache full, done prefetching for now");
|
||||
mFetching = false;
|
||||
}
|
||||
} else {
|
||||
@@ -289,7 +289,7 @@ void NuCachedSource2::onFetch() {
|
||||
}
|
||||
|
||||
void NuCachedSource2::onRead(const sp<AMessage> &msg) {
|
||||
LOG(VERBOSE) << "onRead";
|
||||
LOGV("onRead");
|
||||
|
||||
int64_t offset;
|
||||
CHECK(msg->findInt64("offset", &offset));
|
||||
@@ -339,14 +339,14 @@ void NuCachedSource2::restartPrefetcherIfNecessary_l() {
|
||||
size_t actualBytes = mCache->releaseFromStart(maxBytes);
|
||||
mCacheOffset += actualBytes;
|
||||
|
||||
LOG(INFO) << "restarting prefetcher, totalSize = " << mCache->totalSize();
|
||||
LOGI("restarting prefetcher, totalSize = %d", mCache->totalSize());
|
||||
mFetching = true;
|
||||
}
|
||||
|
||||
ssize_t NuCachedSource2::readAt(off_t offset, void *data, size_t size) {
|
||||
Mutex::Autolock autoSerializer(mSerializer);
|
||||
|
||||
LOG(VERBOSE) << "readAt offset " << offset << " size " << size;
|
||||
LOGV("readAt offset %ld, size %d", offset, size);
|
||||
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
@@ -406,7 +406,7 @@ size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
|
||||
}
|
||||
|
||||
ssize_t NuCachedSource2::readInternal(off_t offset, void *data, size_t size) {
|
||||
LOG(VERBOSE) << "readInternal offset " << offset << " size " << size;
|
||||
LOGV("readInternal offset %ld size %d", offset, size);
|
||||
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
@@ -442,7 +442,7 @@ ssize_t NuCachedSource2::readInternal(off_t offset, void *data, size_t size) {
|
||||
return size;
|
||||
}
|
||||
|
||||
LOG(VERBOSE) << "deferring read";
|
||||
LOGV("deferring read");
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
@@ -455,7 +455,7 @@ status_t NuCachedSource2::seekInternal_l(off_t offset) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOG(INFO) << "new range: offset= " << offset;
|
||||
LOGI("new range: offset= %ld", offset);
|
||||
|
||||
mCacheOffset = offset;
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "ThreadedSource"
|
||||
//#define LOG_NDEBUG 0
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "include/ThreadedSource.h"
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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 "ADebug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <cutils/log.h>
|
||||
#endif
|
||||
|
||||
namespace android {
|
||||
|
||||
Logger::Logger(LogType type)
|
||||
: mLogType(type) {
|
||||
switch (mLogType) {
|
||||
case VERBOSE:
|
||||
mMessage = "V ";
|
||||
break;
|
||||
case INFO:
|
||||
mMessage = "I ";
|
||||
break;
|
||||
case WARNING:
|
||||
mMessage = "W ";
|
||||
break;
|
||||
case ERROR:
|
||||
mMessage = "E ";
|
||||
break;
|
||||
case FATAL:
|
||||
mMessage = "F ";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Logger::~Logger() {
|
||||
if (mLogType == VERBOSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
mMessage.append("\n");
|
||||
|
||||
#if defined(ANDROID) && 1
|
||||
LOG_PRI(ANDROID_LOG_INFO, "ADebug", "%s", mMessage.c_str());
|
||||
#else
|
||||
fprintf(stderr, mMessage.c_str());
|
||||
fflush(stderr);
|
||||
#endif
|
||||
|
||||
if (mLogType == FATAL) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
const char *LeafName(const char *s) {
|
||||
const char *lastSlash = strrchr(s, '/');
|
||||
return lastSlash != NULL ? lastSlash + 1 : s;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -74,7 +74,7 @@ void ALooperRoster::postMessage(
|
||||
ssize_t index = mHandlers.indexOfKey(msg->target());
|
||||
|
||||
if (index < 0) {
|
||||
LOG(WARNING) << "failed to post message. Target handler not registered.";
|
||||
LOGW("failed to post message. Target handler not registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ void ALooperRoster::postMessage(
|
||||
sp<ALooper> looper = info.mLooper.promote();
|
||||
|
||||
if (looper == NULL) {
|
||||
LOG(WARNING) << "failed to post message. "
|
||||
"Target handler still registered, but object gone.";
|
||||
LOGW("failed to post message. "
|
||||
"Target handler still registered, but object gone.");
|
||||
|
||||
mHandlers.removeItemsAt(index);
|
||||
return;
|
||||
@@ -102,8 +102,7 @@ void ALooperRoster::deliverMessage(const sp<AMessage> &msg) {
|
||||
ssize_t index = mHandlers.indexOfKey(msg->target());
|
||||
|
||||
if (index < 0) {
|
||||
LOG(WARNING) << "failed to deliver message. "
|
||||
<< "Target handler not registered.";
|
||||
LOGW("failed to deliver message. Target handler not registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,8 +110,8 @@ void ALooperRoster::deliverMessage(const sp<AMessage> &msg) {
|
||||
handler = info.mHandler.promote();
|
||||
|
||||
if (handler == NULL) {
|
||||
LOG(WARNING) << "failed to deliver message. "
|
||||
"Target handler registered, but object gone.";
|
||||
LOGW("failed to deliver message. "
|
||||
"Target handler registered, but object gone.");
|
||||
|
||||
mHandlers.removeItemsAt(index);
|
||||
return;
|
||||
|
||||
@@ -5,7 +5,6 @@ LOCAL_SRC_FILES:= \
|
||||
AAtomizer.cpp \
|
||||
ABitReader.cpp \
|
||||
ABuffer.cpp \
|
||||
ADebug.cpp \
|
||||
AHandler.cpp \
|
||||
ALooper.cpp \
|
||||
ALooperRoster.cpp \
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "hexdump"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "hexdump.h"
|
||||
|
||||
#include "ADebug.h"
|
||||
@@ -63,7 +67,7 @@ void hexdump(const void *_data, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << line;
|
||||
LOGI("%s", line.c_str());
|
||||
|
||||
offset += 16;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "ATSParser"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "ATSParser.h"
|
||||
|
||||
#include "AnotherPacketSource.h"
|
||||
@@ -31,6 +35,10 @@
|
||||
|
||||
namespace android {
|
||||
|
||||
// I want the expression "y" evaluated even if verbose logging is off.
|
||||
#define MY_LOGV(x, y) \
|
||||
do { unsigned tmp = y; LOGV(x, tmp); } while (0)
|
||||
|
||||
static const size_t kTSPacketSize = 188;
|
||||
|
||||
struct ATSParser::Program : public RefBase {
|
||||
@@ -115,36 +123,33 @@ bool ATSParser::Program::parsePID(
|
||||
|
||||
void ATSParser::Program::parseProgramMap(ABitReader *br) {
|
||||
unsigned table_id = br->getBits(8);
|
||||
LOG(VERBOSE) << " table_id = " << table_id;
|
||||
LOGV(" table_id = %u", table_id);
|
||||
CHECK_EQ(table_id, 0x02u);
|
||||
|
||||
unsigned section_syntax_indictor = br->getBits(1);
|
||||
LOG(VERBOSE) << " section_syntax_indictor = " << section_syntax_indictor;
|
||||
CHECK_EQ(section_syntax_indictor, 1u);
|
||||
unsigned section_syntax_indicator = br->getBits(1);
|
||||
LOGV(" section_syntax_indicator = %u", section_syntax_indicator);
|
||||
CHECK_EQ(section_syntax_indicator, 1u);
|
||||
|
||||
CHECK_EQ(br->getBits(1), 0u);
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(2);
|
||||
MY_LOGV(" reserved = %u", br->getBits(2));
|
||||
|
||||
unsigned section_length = br->getBits(12);
|
||||
LOG(VERBOSE) << " section_length = " << section_length;
|
||||
LOGV(" section_length = %u", section_length);
|
||||
CHECK((section_length & 0xc00) == 0);
|
||||
CHECK_LE(section_length, 1021u);
|
||||
|
||||
LOG(VERBOSE) << " program_number = " << br->getBits(16);
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(2);
|
||||
LOG(VERBOSE) << " version_number = " << br->getBits(5);
|
||||
LOG(VERBOSE) << " current_next_indicator = " << br->getBits(1);
|
||||
LOG(VERBOSE) << " section_number = " << br->getBits(8);
|
||||
LOG(VERBOSE) << " last_section_number = " << br->getBits(8);
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(3);
|
||||
|
||||
LOG(VERBOSE) << " PCR_PID = "
|
||||
<< StringPrintf("0x%04x", br->getBits(13));
|
||||
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(4);
|
||||
MY_LOGV(" program_number = %u", br->getBits(16));
|
||||
MY_LOGV(" reserved = %u", br->getBits(2));
|
||||
MY_LOGV(" version_number = %u", br->getBits(5));
|
||||
MY_LOGV(" current_next_indicator = %u", br->getBits(1));
|
||||
MY_LOGV(" section_number = %u", br->getBits(8));
|
||||
MY_LOGV(" last_section_number = %u", br->getBits(8));
|
||||
MY_LOGV(" reserved = %u", br->getBits(3));
|
||||
MY_LOGV(" PCR_PID = 0x%04x", br->getBits(13));
|
||||
MY_LOGV(" reserved = %u", br->getBits(4));
|
||||
|
||||
unsigned program_info_length = br->getBits(12);
|
||||
LOG(VERBOSE) << " program_info_length = " << program_info_length;
|
||||
LOGV(" program_info_length = %u", program_info_length);
|
||||
CHECK((program_info_length & 0xc00) == 0);
|
||||
|
||||
br->skipBits(program_info_length * 8); // skip descriptors
|
||||
@@ -158,19 +163,17 @@ void ATSParser::Program::parseProgramMap(ABitReader *br) {
|
||||
CHECK_GE(infoBytesRemaining, 5u);
|
||||
|
||||
unsigned streamType = br->getBits(8);
|
||||
LOG(VERBOSE) << " stream_type = "
|
||||
<< StringPrintf("0x%02x", streamType);
|
||||
LOGV(" stream_type = 0x%02x", streamType);
|
||||
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(3);
|
||||
MY_LOGV(" reserved = %u", br->getBits(3));
|
||||
|
||||
unsigned elementaryPID = br->getBits(13);
|
||||
LOG(VERBOSE) << " elementary_PID = "
|
||||
<< StringPrintf("0x%04x", elementaryPID);
|
||||
LOGV(" elementary_PID = 0x%04x", elementaryPID);
|
||||
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(4);
|
||||
MY_LOGV(" reserved = %u", br->getBits(4));
|
||||
|
||||
unsigned ES_info_length = br->getBits(12);
|
||||
LOG(VERBOSE) << " ES_info_length = " << ES_info_length;
|
||||
LOGV(" ES_info_length = %u", ES_info_length);
|
||||
CHECK((ES_info_length & 0xc00) == 0);
|
||||
|
||||
CHECK_GE(infoBytesRemaining - 5, ES_info_length);
|
||||
@@ -180,10 +183,10 @@ void ATSParser::Program::parseProgramMap(ABitReader *br) {
|
||||
#else
|
||||
unsigned info_bytes_remaining = ES_info_length;
|
||||
while (info_bytes_remaining >= 2) {
|
||||
LOG(VERBOSE) << " tag = " << StringPrintf("0x%02x", br->getBits(8));
|
||||
MY_LOGV(" tag = 0x%02x", br->getBits(8));
|
||||
|
||||
unsigned descLength = br->getBits(8);
|
||||
LOG(VERBOSE) << " len = " << descLength;
|
||||
LOGV(" len = %u", descLength);
|
||||
|
||||
CHECK_GE(info_bytes_remaining, 2 + descLength);
|
||||
|
||||
@@ -209,7 +212,7 @@ void ATSParser::Program::parseProgramMap(ABitReader *br) {
|
||||
|
||||
CHECK_EQ(infoBytesRemaining, 0u);
|
||||
|
||||
LOG(VERBOSE) << " CRC = " << StringPrintf("0x%08x", br->getBits(32));
|
||||
MY_LOGV(" CRC = 0x%08x", br->getBits(32));
|
||||
}
|
||||
|
||||
sp<MediaSource> ATSParser::Program::getSource(SourceType type) {
|
||||
@@ -255,7 +258,7 @@ void ATSParser::Stream::parse(
|
||||
}
|
||||
|
||||
size_t payloadSizeBits = br->numBitsLeft();
|
||||
CHECK_EQ(payloadSizeBits % 8, 0u);
|
||||
CHECK((payloadSizeBits % 8) == 0);
|
||||
|
||||
CHECK_LE(mBuffer->size() + payloadSizeBits / 8, mBuffer->capacity());
|
||||
|
||||
@@ -266,16 +269,15 @@ void ATSParser::Stream::parse(
|
||||
void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
unsigned packet_startcode_prefix = br->getBits(24);
|
||||
|
||||
LOG(VERBOSE) << "packet_startcode_prefix = "
|
||||
<< StringPrintf("0x%08x", packet_startcode_prefix);
|
||||
LOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
|
||||
|
||||
CHECK_EQ(packet_startcode_prefix, 0x000001u);
|
||||
|
||||
unsigned stream_id = br->getBits(8);
|
||||
LOG(VERBOSE) << "stream_id = " << StringPrintf("0x%02x", stream_id);
|
||||
LOGV("stream_id = 0x%02x", stream_id);
|
||||
|
||||
unsigned PES_packet_length = br->getBits(16);
|
||||
LOG(VERBOSE) << "PES_packet_length = " << PES_packet_length;
|
||||
LOGV("PES_packet_length = %u", PES_packet_length);
|
||||
|
||||
if (stream_id != 0xbc // program_stream_map
|
||||
&& stream_id != 0xbe // padding_stream
|
||||
@@ -287,33 +289,32 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
&& stream_id != 0xf8) { // H.222.1 type E
|
||||
CHECK_EQ(br->getBits(2), 2u);
|
||||
|
||||
LOG(VERBOSE) << "PES_scrambling_control = " << br->getBits(2);
|
||||
LOG(VERBOSE) << "PES_priority = " << br->getBits(1);
|
||||
LOG(VERBOSE) << "data_alignment_indicator = " << br->getBits(1);
|
||||
LOG(VERBOSE) << "copyright = " << br->getBits(1);
|
||||
LOG(VERBOSE) << "original_or_copy = " << br->getBits(1);
|
||||
MY_LOGV("PES_scrambling_control = %u", br->getBits(2));
|
||||
MY_LOGV("PES_priority = %u", br->getBits(1));
|
||||
MY_LOGV("data_alignment_indicator = %u", br->getBits(1));
|
||||
MY_LOGV("copyright = %u", br->getBits(1));
|
||||
MY_LOGV("original_or_copy = %u", br->getBits(1));
|
||||
|
||||
unsigned PTS_DTS_flags = br->getBits(2);
|
||||
LOG(VERBOSE) << "PTS_DTS_flags = " << PTS_DTS_flags;
|
||||
LOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
|
||||
|
||||
unsigned ESCR_flag = br->getBits(1);
|
||||
LOG(VERBOSE) << "ESCR_flag = " << ESCR_flag;
|
||||
LOGV("ESCR_flag = %u", ESCR_flag);
|
||||
|
||||
unsigned ES_rate_flag = br->getBits(1);
|
||||
LOG(VERBOSE) << "ES_rate_flag = " << ES_rate_flag;
|
||||
LOGV("ES_rate_flag = %u", ES_rate_flag);
|
||||
|
||||
unsigned DSM_trick_mode_flag = br->getBits(1);
|
||||
LOG(VERBOSE) << "DSM_trick_mode_flag = " << DSM_trick_mode_flag;
|
||||
LOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
|
||||
|
||||
unsigned additional_copy_info_flag = br->getBits(1);
|
||||
LOG(VERBOSE) << "additional_copy_info_flag = "
|
||||
<< additional_copy_info_flag;
|
||||
LOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
|
||||
|
||||
LOG(VERBOSE) << "PES_CRC_flag = " << br->getBits(1);
|
||||
LOG(VERBOSE) << "PES_extension_flag = " << br->getBits(1);
|
||||
MY_LOGV("PES_CRC_flag = %u", br->getBits(1));
|
||||
MY_LOGV("PES_extension_flag = %u", br->getBits(1));
|
||||
|
||||
unsigned PES_header_data_length = br->getBits(8);
|
||||
LOG(VERBOSE) << "PES_header_data_length = " << PES_header_data_length;
|
||||
LOGV("PES_header_data_length = %u", PES_header_data_length);
|
||||
|
||||
unsigned optional_bytes_remaining = PES_header_data_length;
|
||||
|
||||
@@ -331,8 +332,8 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
PTS |= br->getBits(15);
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
|
||||
LOG(VERBOSE) << "PTS = " << PTS;
|
||||
// LOG(INFO) << "PTS = " << PTS / 90000.0f << " secs";
|
||||
LOGV("PTS = %llu", PTS);
|
||||
// LOGI("PTS = %.2f secs", PTS / 90000.0f);
|
||||
|
||||
optional_bytes_remaining -= 5;
|
||||
|
||||
@@ -348,7 +349,7 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
DTS |= br->getBits(15);
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
|
||||
LOG(VERBOSE) << "DTS = " << DTS;
|
||||
LOGV("DTS = %llu", DTS);
|
||||
|
||||
optional_bytes_remaining -= 5;
|
||||
}
|
||||
@@ -366,8 +367,8 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
ESCR |= br->getBits(15);
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
|
||||
LOG(VERBOSE) << "ESCR = " << ESCR;
|
||||
LOG(VERBOSE) << "ESCR_extension = " << br->getBits(9);
|
||||
LOGV("ESCR = %llu", ESCR);
|
||||
MY_LOGV("ESCR_extension = %u", br->getBits(9));
|
||||
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
|
||||
@@ -378,7 +379,7 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
CHECK_GE(optional_bytes_remaining, 3u);
|
||||
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
LOG(VERBOSE) << "ES_rate = " << br->getBits(22);
|
||||
MY_LOGV("ES_rate = %u", br->getBits(22));
|
||||
CHECK_EQ(br->getBits(1), 1u);
|
||||
|
||||
optional_bytes_remaining -= 3;
|
||||
@@ -405,8 +406,7 @@ void ATSParser::Stream::parsePES(ABitReader *br) {
|
||||
size_t payloadSizeBits = br->numBitsLeft();
|
||||
CHECK((payloadSizeBits % 8) == 0);
|
||||
|
||||
LOG(VERBOSE) << "There's " << (payloadSizeBits / 8)
|
||||
<< " bytes of payload.";
|
||||
LOGV("There's %d bytes of payload.", payloadSizeBits / 8);
|
||||
}
|
||||
} else if (stream_id == 0xbe) { // padding_stream
|
||||
CHECK_NE(PES_packet_length, 0u);
|
||||
@@ -422,9 +422,7 @@ void ATSParser::Stream::flush() {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(VERBOSE) << "flushing stream "
|
||||
<< StringPrintf("0x%04x", mElementaryPID)
|
||||
<< " size = " << mBuffer->size();
|
||||
LOGV("flushing stream 0x%04x size = %d", mElementaryPID, mBuffer->size());
|
||||
|
||||
ABitReader br(mBuffer->data(), mBuffer->size());
|
||||
parsePES(&br);
|
||||
@@ -493,7 +491,7 @@ static sp<ABuffer> MakeAVCCodecSpecificData(
|
||||
CHECK(picParamSet != NULL);
|
||||
|
||||
buffer->setRange(stopOffset, size - stopOffset);
|
||||
LOG(INFO) << "buffer has " << buffer->size() << " bytes left.";
|
||||
LOGI("buffer has %d bytes left.", buffer->size());
|
||||
|
||||
size_t csdSize =
|
||||
1 + 3 + 1 + 1
|
||||
@@ -617,15 +615,15 @@ static sp<ABuffer> FindMPEG2ADTSConfig(
|
||||
CHECK_EQ(br.getBits(2), 0u);
|
||||
br.getBits(1); // protection_absent
|
||||
unsigned profile = br.getBits(2);
|
||||
LOG(INFO) << "profile = " << profile;
|
||||
LOGI("profile = %u", profile);
|
||||
CHECK_NE(profile, 3u);
|
||||
unsigned sampling_freq_index = br.getBits(4);
|
||||
br.getBits(1); // private_bit
|
||||
unsigned channel_configuration = br.getBits(3);
|
||||
CHECK_NE(channel_configuration, 0u);
|
||||
|
||||
LOG(INFO) << "sampling_freq_index = " << sampling_freq_index;
|
||||
LOG(INFO) << "channel_configuration = " << channel_configuration;
|
||||
LOGI("sampling_freq_index = %u", sampling_freq_index);
|
||||
LOGI("channel_configuration = %u", channel_configuration);
|
||||
|
||||
CHECK_LE(sampling_freq_index, 11u);
|
||||
static const int32_t kSamplingFreq[] = {
|
||||
@@ -671,8 +669,7 @@ static sp<ABuffer> FindMPEG2ADTSConfig(
|
||||
void ATSParser::Stream::onPayloadData(
|
||||
unsigned PTS_DTS_flags, uint64_t PTS, uint64_t DTS,
|
||||
const uint8_t *data, size_t size) {
|
||||
LOG(VERBOSE) << "onPayloadData mStreamType="
|
||||
<< StringPrintf("0x%02x", mStreamType);
|
||||
LOGV("onPayloadData mStreamType=0x%02x", mStreamType);
|
||||
|
||||
sp<ABuffer> buffer;
|
||||
|
||||
@@ -710,8 +707,8 @@ void ATSParser::Stream::onPayloadData(
|
||||
sp<ABuffer> csd =
|
||||
FindMPEG2ADTSConfig(buffer, &sampleRate, &channelCount);
|
||||
|
||||
LOG(INFO) << "sampleRate = " << sampleRate;
|
||||
LOG(INFO) << "channelCount = " << channelCount;
|
||||
LOGI("sampleRate = %d", sampleRate);
|
||||
LOGI("channelCount = %d", channelCount);
|
||||
|
||||
meta->setInt32(kKeySampleRate, sampleRate);
|
||||
meta->setInt32(kKeyChannelCount, channelCount);
|
||||
@@ -719,7 +716,7 @@ void ATSParser::Stream::onPayloadData(
|
||||
meta->setData(kKeyESDS, 0, csd->data(), csd->size());
|
||||
}
|
||||
|
||||
LOG(INFO) << "created source!";
|
||||
LOGI("created source!");
|
||||
mSource = new AnotherPacketSource(meta);
|
||||
|
||||
// fall through
|
||||
@@ -777,12 +774,7 @@ void ATSParser::Stream::extractAACFrames(const sp<ABuffer> &buffer) {
|
||||
|
||||
CHECK_LE(scan, buffer->size());
|
||||
|
||||
LOG(VERBOSE)
|
||||
<< "found aac raw data block at ["
|
||||
<< StringPrintf("0x%08x", offset)
|
||||
<< " ; "
|
||||
<< StringPrintf("0x%08x", scan)
|
||||
<< ")";
|
||||
LOGV("found aac raw data block at [0x%08x ; 0x%08x)", offset, scan);
|
||||
|
||||
memmove(&buffer->data()[dstOffset], &buffer->data()[offset],
|
||||
scan - offset);
|
||||
@@ -825,50 +817,48 @@ void ATSParser::feedTSPacket(const void *data, size_t size) {
|
||||
|
||||
void ATSParser::parseProgramAssociationTable(ABitReader *br) {
|
||||
unsigned table_id = br->getBits(8);
|
||||
LOG(VERBOSE) << " table_id = " << table_id;
|
||||
LOGV(" table_id = %u", table_id);
|
||||
CHECK_EQ(table_id, 0x00u);
|
||||
|
||||
unsigned section_syntax_indictor = br->getBits(1);
|
||||
LOG(VERBOSE) << " section_syntax_indictor = " << section_syntax_indictor;
|
||||
LOGV(" section_syntax_indictor = %u", section_syntax_indictor);
|
||||
CHECK_EQ(section_syntax_indictor, 1u);
|
||||
|
||||
CHECK_EQ(br->getBits(1), 0u);
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(2);
|
||||
MY_LOGV(" reserved = %u", br->getBits(2));
|
||||
|
||||
unsigned section_length = br->getBits(12);
|
||||
LOG(VERBOSE) << " section_length = " << section_length;
|
||||
LOGV(" section_length = %u", section_length);
|
||||
CHECK((section_length & 0xc00) == 0);
|
||||
|
||||
LOG(VERBOSE) << " transport_stream_id = " << br->getBits(16);
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(2);
|
||||
LOG(VERBOSE) << " version_number = " << br->getBits(5);
|
||||
LOG(VERBOSE) << " current_next_indicator = " << br->getBits(1);
|
||||
LOG(VERBOSE) << " section_number = " << br->getBits(8);
|
||||
LOG(VERBOSE) << " last_section_number = " << br->getBits(8);
|
||||
MY_LOGV(" transport_stream_id = %u", br->getBits(16));
|
||||
MY_LOGV(" reserved = %u", br->getBits(2));
|
||||
MY_LOGV(" version_number = %u", br->getBits(5));
|
||||
MY_LOGV(" current_next_indicator = %u", br->getBits(1));
|
||||
MY_LOGV(" section_number = %u", br->getBits(8));
|
||||
MY_LOGV(" last_section_number = %u", br->getBits(8));
|
||||
|
||||
size_t numProgramBytes = (section_length - 5 /* header */ - 4 /* crc */);
|
||||
CHECK_EQ((numProgramBytes % 4), 0u);
|
||||
|
||||
for (size_t i = 0; i < numProgramBytes / 4; ++i) {
|
||||
unsigned program_number = br->getBits(16);
|
||||
LOG(VERBOSE) << " program_number = " << program_number;
|
||||
LOGV(" program_number = %u", program_number);
|
||||
|
||||
LOG(VERBOSE) << " reserved = " << br->getBits(3);
|
||||
MY_LOGV(" reserved = %u", br->getBits(3));
|
||||
|
||||
if (program_number == 0) {
|
||||
LOG(VERBOSE) << " network_PID = "
|
||||
<< StringPrintf("0x%04x", br->getBits(13));
|
||||
MY_LOGV(" network_PID = 0x%04x", br->getBits(13));
|
||||
} else {
|
||||
unsigned programMapPID = br->getBits(13);
|
||||
|
||||
LOG(VERBOSE) << " program_map_PID = "
|
||||
<< StringPrintf("0x%04x", programMapPID);
|
||||
LOGV(" program_map_PID = 0x%04x", programMapPID);
|
||||
|
||||
mPrograms.push(new Program(programMapPID));
|
||||
}
|
||||
}
|
||||
|
||||
LOG(VERBOSE) << " CRC = " << StringPrintf("0x%08x", br->getBits(32));
|
||||
MY_LOGV(" CRC = 0x%08x", br->getBits(32));
|
||||
}
|
||||
|
||||
void ATSParser::parsePID(
|
||||
@@ -893,8 +883,7 @@ void ATSParser::parsePID(
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
LOG(WARNING) << "PID " << StringPrintf("0x%04x", PID)
|
||||
<< " not handled.";
|
||||
LOGV("PID 0x%04x not handled.", PID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,28 +895,27 @@ void ATSParser::parseAdaptationField(ABitReader *br) {
|
||||
}
|
||||
|
||||
void ATSParser::parseTS(ABitReader *br) {
|
||||
LOG(VERBOSE) << "---";
|
||||
LOGV("---");
|
||||
|
||||
unsigned sync_byte = br->getBits(8);
|
||||
CHECK_EQ(sync_byte, 0x47u);
|
||||
|
||||
LOG(VERBOSE) << "transport_error_indicator = " << br->getBits(1);
|
||||
MY_LOGV("transport_error_indicator = %u", br->getBits(1));
|
||||
|
||||
unsigned payload_unit_start_indicator = br->getBits(1);
|
||||
LOG(VERBOSE) << "payload_unit_start_indicator = "
|
||||
<< payload_unit_start_indicator;
|
||||
LOGV("payload_unit_start_indicator = %u", payload_unit_start_indicator);
|
||||
|
||||
LOG(VERBOSE) << "transport_priority = " << br->getBits(1);
|
||||
MY_LOGV("transport_priority = %u", br->getBits(1));
|
||||
|
||||
unsigned PID = br->getBits(13);
|
||||
LOG(VERBOSE) << "PID = " << StringPrintf("0x%04x", PID);
|
||||
LOGV("PID = 0x%04x", PID);
|
||||
|
||||
LOG(VERBOSE) << "transport_scrambling_control = " << br->getBits(2);
|
||||
MY_LOGV("transport_scrambling_control = %u", br->getBits(2));
|
||||
|
||||
unsigned adaptation_field_control = br->getBits(2);
|
||||
LOG(VERBOSE) << "adaptation_field_control = " << adaptation_field_control;
|
||||
LOGV("adaptation_field_control = %u", adaptation_field_control);
|
||||
|
||||
LOG(VERBOSE) << "continuity_counter = " << br->getBits(4);
|
||||
MY_LOGV("continuity_counter = %u", br->getBits(4));
|
||||
|
||||
if (adaptation_field_control == 2 || adaptation_field_control == 3) {
|
||||
parseAdaptationField(br);
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "AAMRAssembler"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "AAMRAssembler.h"
|
||||
|
||||
#include "ARTPSource.h"
|
||||
@@ -119,9 +123,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket(
|
||||
mNextExpectedSeqNoValid = true;
|
||||
mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
|
||||
} else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
|
||||
#if VERBOSE
|
||||
LOG(VERBOSE) << "Not the sequence number I expected";
|
||||
#endif
|
||||
LOGV("Not the sequence number I expected");
|
||||
|
||||
return WRONG_SEQUENCE_NUMBER;
|
||||
}
|
||||
@@ -132,7 +134,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket(
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
LOG(VERBOSE) << "AMR packet too short.";
|
||||
LOGV("AMR packet too short.");
|
||||
|
||||
return MALFORMED_PACKET;
|
||||
}
|
||||
@@ -150,7 +152,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket(
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
LOG(VERBOSE) << "Unable to parse TOC.";
|
||||
LOGV("Unable to parse TOC.");
|
||||
|
||||
return MALFORMED_PACKET;
|
||||
}
|
||||
@@ -164,7 +166,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket(
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
LOG(VERBOSE) << "Illegal TOC entry.";
|
||||
LOGV("Illegal TOC entry.");
|
||||
|
||||
return MALFORMED_PACKET;
|
||||
}
|
||||
@@ -191,7 +193,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket(
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
LOG(VERBOSE) << "AMR packet too short.";
|
||||
LOGV("AMR packet too short.");
|
||||
|
||||
return MALFORMED_PACKET;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "AAVCAssembler"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "AAVCAssembler.h"
|
||||
|
||||
#include "ARTPSource.h"
|
||||
@@ -25,8 +29,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define BE_VERBOSE 0
|
||||
|
||||
namespace android {
|
||||
|
||||
// static
|
||||
@@ -70,9 +72,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
|
||||
mNextExpectedSeqNoValid = true;
|
||||
mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
|
||||
} else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "Not the sequence number I expected";
|
||||
#endif
|
||||
LOGV("Not the sequence number I expected");
|
||||
|
||||
return WRONG_SEQUENCE_NUMBER;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
|
||||
if (size < 1 || (data[0] & 0x80)) {
|
||||
// Corrupt.
|
||||
|
||||
LOG(ERROR) << "Ignoring corrupt buffer.";
|
||||
LOGV("Ignoring corrupt buffer.");
|
||||
queue->erase(queue->begin());
|
||||
|
||||
++mNextExpectedSeqNo;
|
||||
@@ -107,7 +107,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
|
||||
|
||||
return success ? OK : MALFORMED_PACKET;
|
||||
} else {
|
||||
LOG(ERROR) << "Ignoring unsupported buffer (nalType=" << nalType << ")";
|
||||
LOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
|
||||
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
@@ -117,8 +117,8 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit(
|
||||
}
|
||||
|
||||
void AAVCAssembler::addSingleNALUnit(const sp<ABuffer> &buffer) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "addSingleNALUnit of size " << buffer->size();
|
||||
LOGV("addSingleNALUnit of size %d", buffer->size());
|
||||
#if !LOG_NDEBUG
|
||||
hexdump(buffer->data(), buffer->size());
|
||||
#endif
|
||||
|
||||
@@ -138,7 +138,7 @@ bool AAVCAssembler::addSingleTimeAggregationPacket(const sp<ABuffer> &buffer) {
|
||||
size_t size = buffer->size();
|
||||
|
||||
if (size < 3) {
|
||||
LOG(ERROR) << "Discarding too small STAP-A packet.";
|
||||
LOGV("Discarding too small STAP-A packet.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ bool AAVCAssembler::addSingleTimeAggregationPacket(const sp<ABuffer> &buffer) {
|
||||
size_t nalSize = (data[0] << 8) | data[1];
|
||||
|
||||
if (size < nalSize + 2) {
|
||||
LOG(ERROR) << "Discarding malformed STAP-A packet.";
|
||||
LOGV("Discarding malformed STAP-A packet.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ bool AAVCAssembler::addSingleTimeAggregationPacket(const sp<ABuffer> &buffer) {
|
||||
}
|
||||
|
||||
if (size != 0) {
|
||||
LOG(WARNING) << "Unexpected padding at end of STAP-A packet.";
|
||||
LOGV("Unexpected padding at end of STAP-A packet.");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -184,7 +184,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
CHECK((indicator & 0x1f) == 28);
|
||||
|
||||
if (size < 2) {
|
||||
LOG(ERROR) << "Ignoring malformed FU buffer (size = " << size << ")";
|
||||
LOGV("Ignoring malformed FU buffer (size = %d)", size);
|
||||
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
@@ -194,9 +194,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
if (!(data[1] & 0x80)) {
|
||||
// Start bit not set on the first buffer.
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(ERROR) << "Start bit not set on first buffer";
|
||||
#endif
|
||||
LOGV("Start bit not set on first buffer");
|
||||
|
||||
queue->erase(queue->begin());
|
||||
++mNextExpectedSeqNo;
|
||||
@@ -214,17 +212,13 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
if (data[1] & 0x40) {
|
||||
// Huh? End bit also set on the first buffer.
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(WARNING) << "Grrr. This isn't fragmented at all.";
|
||||
#endif
|
||||
LOGV("Grrr. This isn't fragmented at all.");
|
||||
|
||||
complete = true;
|
||||
} else {
|
||||
List<sp<ABuffer> >::iterator it = ++queue->begin();
|
||||
while (it != queue->end()) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "sequence length " << totalCount;
|
||||
#endif
|
||||
LOGV("sequence length %d", totalCount);
|
||||
|
||||
const sp<ABuffer> &buffer = *it;
|
||||
|
||||
@@ -232,11 +226,8 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
size_t size = buffer->size();
|
||||
|
||||
if ((uint32_t)buffer->int32Data() != expectedSeqNo) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "sequence not complete, expected seqNo "
|
||||
<< expectedSeqNo << ", got "
|
||||
<< (uint32_t)buffer->int32Data();
|
||||
#endif
|
||||
LOGV("sequence not complete, expected seqNo %d, got %d",
|
||||
expectedSeqNo, (uint32_t)buffer->int32Data());
|
||||
|
||||
return WRONG_SEQUENCE_NUMBER;
|
||||
}
|
||||
@@ -245,7 +236,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
|| data[0] != indicator
|
||||
|| (data[1] & 0x1f) != nalType
|
||||
|| (data[1] & 0x80)) {
|
||||
LOG(ERROR) << "Ignoring malformed FU buffer.\n";
|
||||
LOGV("Ignoring malformed FU buffer.");
|
||||
|
||||
// Delete the whole start of the FU.
|
||||
|
||||
@@ -296,8 +287,8 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
for (size_t i = 0; i < totalCount; ++i) {
|
||||
const sp<ABuffer> &buffer = *it;
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "piece #" << (i + 1) << "/" << totalCount;
|
||||
LOGV("piece #%d/%d", i + 1, totalCount);
|
||||
#if !LOG_NDEBUG
|
||||
hexdump(buffer->data(), buffer->size());
|
||||
#endif
|
||||
|
||||
@@ -311,9 +302,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
|
||||
addSingleNALUnit(unit);
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "successfully assembled a NAL unit from fragments.";
|
||||
#endif
|
||||
LOGV("successfully assembled a NAL unit from fragments.");
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -321,9 +310,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit(
|
||||
void AAVCAssembler::submitAccessUnit() {
|
||||
CHECK(!mNALUnits.empty());
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "Access unit complete (" << mNALUnits.size() << " nal units)";
|
||||
#endif
|
||||
LOGV("Access unit complete (%d nal units)", mNALUnits.size());
|
||||
|
||||
size_t totalSize = 0;
|
||||
for (List<sp<ABuffer> >::iterator it = mNALUnits.begin();
|
||||
@@ -373,7 +360,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::assembleMore(
|
||||
|
||||
void AAVCAssembler::packetLost() {
|
||||
CHECK(mNextExpectedSeqNoValid);
|
||||
LOG(VERBOSE) << "packetLost (expected " << mNextExpectedSeqNo << ")";
|
||||
LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
|
||||
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "AMPEG4ElementaryAssembler"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "AMPEG4ElementaryAssembler.h"
|
||||
|
||||
#include "ARTPSource.h"
|
||||
@@ -28,8 +32,6 @@
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BE_VERBOSE 0
|
||||
|
||||
namespace android {
|
||||
|
||||
static bool GetAttribute(const char *s, const char *key, AString *value) {
|
||||
@@ -201,9 +203,7 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
|
||||
mNextExpectedSeqNoValid = true;
|
||||
mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
|
||||
} else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "Not the sequence number I expected";
|
||||
#endif
|
||||
LOGV("Not the sequence number I expected");
|
||||
|
||||
return WRONG_SEQUENCE_NUMBER;
|
||||
}
|
||||
@@ -336,9 +336,7 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
|
||||
void AMPEG4ElementaryAssembler::submitAccessUnit() {
|
||||
CHECK(!mPackets.empty());
|
||||
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "Access unit complete (" << mPackets.size() << " nal units)";
|
||||
#endif
|
||||
LOGV("Access unit complete (%d nal units)", mPackets.size());
|
||||
|
||||
size_t totalSize = 0;
|
||||
for (List<sp<ABuffer> >::iterator it = mPackets.begin();
|
||||
@@ -385,7 +383,7 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::assembleMore(
|
||||
|
||||
void AMPEG4ElementaryAssembler::packetLost() {
|
||||
CHECK(mNextExpectedSeqNoValid);
|
||||
LOG(VERBOSE) << "packetLost (expected " << mNextExpectedSeqNo << ")";
|
||||
LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
|
||||
|
||||
++mNextExpectedSeqNo;
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "APacketSource"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "APacketSource.h"
|
||||
|
||||
#include "ASessionDescription.h"
|
||||
@@ -188,7 +192,7 @@ static sp<ABuffer> MakeAVCCodecSpecificData(
|
||||
|
||||
if (i == 0) {
|
||||
FindAVCDimensions(nal, width, height);
|
||||
LOG(INFO) << "dimensions " << *width << "x" << *height;
|
||||
LOGI("dimensions %dx%d", *width, *height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +416,7 @@ static bool ExtractDimensionsFromVOLHeader(
|
||||
*width = video_object_layer_width;
|
||||
*height = video_object_layer_height;
|
||||
|
||||
LOG(INFO) << "VOL dimensions = " << *width << "x" << *height;
|
||||
LOGI("VOL dimensions = %dx%d", *width, *height);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -711,7 +715,7 @@ void APacketSource::updateNormalPlayTime_l(const sp<ABuffer> &buffer) {
|
||||
void APacketSource::queueAccessUnit(const sp<ABuffer> &buffer) {
|
||||
int32_t damaged;
|
||||
if (buffer->meta()->findInt32("damaged", &damaged) && damaged) {
|
||||
LOG(VERBOSE) << "discarding damaged AU";
|
||||
LOGV("discarding damaged AU");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -765,8 +769,9 @@ int64_t APacketSource::getQueueDurationUs(bool *eos) {
|
||||
CHECK(last->meta()->findInt64("timeUs", &lastTimeUs));
|
||||
|
||||
if (lastTimeUs < firstTimeUs) {
|
||||
LOG(ERROR) << "Huh? Time moving backwards? "
|
||||
<< firstTimeUs << " > " << lastTimeUs;
|
||||
LOGE("Huh? Time moving backwards? %lld > %lld",
|
||||
firstTimeUs, lastTimeUs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "ARTPConnection"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "ARTPConnection.h"
|
||||
|
||||
#include "ARTPSource.h"
|
||||
@@ -319,7 +323,7 @@ void ARTPConnection::onPollStreams() {
|
||||
}
|
||||
|
||||
if (buffer->size() > 0) {
|
||||
LOG(VERBOSE) << "Sending RR...";
|
||||
LOGV("Sending RR...");
|
||||
|
||||
ssize_t n = sendto(
|
||||
s->mRTCPSocket, buffer->data(), buffer->size(), 0,
|
||||
@@ -356,7 +360,7 @@ status_t ARTPConnection::receive(StreamInfo *s, bool receiveRTP) {
|
||||
|
||||
buffer->setRange(0, nbytes);
|
||||
|
||||
// LOG(INFO) << "received " << buffer->size() << " bytes.";
|
||||
// LOGI("received %d bytes.", buffer->size());
|
||||
|
||||
status_t err;
|
||||
if (receiveRTP) {
|
||||
@@ -521,9 +525,8 @@ status_t ARTPConnection::parseRTCP(StreamInfo *s, const sp<ABuffer> &buffer) {
|
||||
|
||||
default:
|
||||
{
|
||||
LOG(WARNING) << "Unknown RTCP packet type "
|
||||
<< (unsigned)data[1]
|
||||
<< " of size " << headerLength;
|
||||
LOGW("Unknown RTCP packet type %u of size %d",
|
||||
(unsigned)data[1], headerLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -567,10 +570,10 @@ status_t ARTPConnection::parseSR(
|
||||
uint32_t rtpTime = u32at(&data[16]);
|
||||
|
||||
#if 0
|
||||
LOG(INFO) << StringPrintf(
|
||||
"XXX timeUpdate: ssrc=0x%08x, rtpTime %u == ntpTime %.3f",
|
||||
id,
|
||||
rtpTime, (ntpTime >> 32) + (double)(ntpTime & 0xffffffff) / (1ll << 32));
|
||||
LOGI("XXX timeUpdate: ssrc=0x%08x, rtpTime %u == ntpTime %.3f",
|
||||
id,
|
||||
rtpTime,
|
||||
(ntpTime >> 32) + (double)(ntpTime & 0xffffffff) / (1ll << 32));
|
||||
#endif
|
||||
|
||||
sp<ARTPSource> source = findSource(s, id);
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* 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>
|
||||
@@ -51,24 +55,24 @@ status_t ARTPSession::setup(const sp<ASessionDescription> &desc) {
|
||||
if (!mDesc->findAttribute(i, "c=", &connection)) {
|
||||
// No per-stream connection information, try global fallback.
|
||||
if (!mDesc->findAttribute(0, "c=", &connection)) {
|
||||
LOG(ERROR) << "Unable to find connection attribtue.";
|
||||
LOGE("Unable to find connection attribute.");
|
||||
return mInitCheck;
|
||||
}
|
||||
}
|
||||
if (!(connection == "IN IP4 127.0.0.1")) {
|
||||
LOG(ERROR) << "We only support localhost connections for now.";
|
||||
LOGE("We only support localhost connections for now.");
|
||||
return mInitCheck;
|
||||
}
|
||||
|
||||
unsigned port;
|
||||
if (!validateMediaFormat(i, &port) || (port & 1) != 0) {
|
||||
LOG(ERROR) << "Invalid media format.";
|
||||
LOGE("Invalid media format.");
|
||||
return mInitCheck;
|
||||
}
|
||||
|
||||
sp<APacketSource> source = new APacketSource(mDesc, i);
|
||||
if (source->initCheck() != OK) {
|
||||
LOG(ERROR) << "Unsupported format.";
|
||||
LOGE("Unsupported format.");
|
||||
return mInitCheck;
|
||||
}
|
||||
|
||||
@@ -157,9 +161,8 @@ void ARTPSession::onMessageReceived(const sp<AMessage> &msg) {
|
||||
printf("access unit complete size=%d\tntp-time=0x%016llx\n",
|
||||
accessUnit->size(), ntpTime);
|
||||
#else
|
||||
LOG(INFO) << "access unit complete, "
|
||||
<< "size=" << accessUnit->size() << ", "
|
||||
<< "ntp-time=" << ntpTime;
|
||||
LOGI("access unit complete, size=%d, ntp-time=%llu",
|
||||
accessUnit->size(), ntpTime);
|
||||
hexdump(accessUnit->data(), accessUnit->size());
|
||||
#endif
|
||||
#endif
|
||||
@@ -169,9 +172,8 @@ void ARTPSession::onMessageReceived(const sp<AMessage> &msg) {
|
||||
CHECK(!memcmp("\x00\x00\x00\x01", accessUnit->data(), 4));
|
||||
unsigned x = accessUnit->data()[4];
|
||||
|
||||
LOG(INFO) << "access unit complete: "
|
||||
<< StringPrintf("nalType=0x%02x, nalRefIdc=0x%02x",
|
||||
x & 0x1f, (x & 0x60) >> 5);
|
||||
LOGI("access unit complete: nalType=0x%02x, nalRefIdc=0x%02x",
|
||||
x & 0x1f, (x & 0x60) >> 5);
|
||||
#endif
|
||||
|
||||
accessUnit->meta()->setInt64("ntp-time", ntpTime);
|
||||
@@ -181,7 +183,7 @@ void ARTPSession::onMessageReceived(const sp<AMessage> &msg) {
|
||||
int32_t damaged;
|
||||
if (accessUnit->meta()->findInt32("damaged", &damaged)
|
||||
&& damaged != 0) {
|
||||
LOG(INFO) << "ignoring damaged AU";
|
||||
LOGI("ignoring damaged AU");
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "ARTPSource"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "ARTPSource.h"
|
||||
|
||||
#include "AAMRAssembler.h"
|
||||
@@ -27,8 +31,6 @@
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/AMessage.h>
|
||||
|
||||
#define BE_VERBOSE 0
|
||||
|
||||
namespace android {
|
||||
|
||||
static const uint32_t kSourceID = 0xdeadbeef;
|
||||
@@ -83,14 +85,10 @@ void ARTPSource::processRTPPacket(const sp<ABuffer> &buffer) {
|
||||
&& mAssembler != NULL) {
|
||||
mAssembler->onPacketReceived(this);
|
||||
}
|
||||
|
||||
dump();
|
||||
}
|
||||
|
||||
void ARTPSource::timeUpdate(uint32_t rtpTime, uint64_t ntpTime) {
|
||||
#if BE_VERBOSE
|
||||
LOG(VERBOSE) << "timeUpdate";
|
||||
#endif
|
||||
LOGV("timeUpdate");
|
||||
|
||||
mLastNTPTime = ntpTime;
|
||||
mLastNTPTimeUpdateUs = ALooper::GetNowUs();
|
||||
@@ -173,7 +171,7 @@ bool ARTPSource::queuePacket(const sp<ABuffer> &buffer) {
|
||||
}
|
||||
|
||||
if (it != mQueue.end() && (uint32_t)(*it)->int32Data() == seqNum) {
|
||||
LOG(WARNING) << "Discarding duplicate buffer";
|
||||
LOGW("Discarding duplicate buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -182,89 +180,6 @@ bool ARTPSource::queuePacket(const sp<ABuffer> &buffer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ARTPSource::dump() const {
|
||||
if ((mNumBuffersReceived % 128) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (mAssembler == NULL) {
|
||||
char tmp[20];
|
||||
sprintf(tmp, "0x%08x", mID);
|
||||
|
||||
int32_t numMissing = 0;
|
||||
|
||||
if (!mQueue.empty()) {
|
||||
List<sp<ABuffer> >::const_iterator it = mQueue.begin();
|
||||
uint32_t expectedSeqNum = (uint32_t)(*it)->int32Data();
|
||||
++expectedSeqNum;
|
||||
++it;
|
||||
|
||||
for (; it != mQueue.end(); ++it) {
|
||||
uint32_t seqNum = (uint32_t)(*it)->int32Data();
|
||||
CHECK_GE(seqNum, expectedSeqNum);
|
||||
|
||||
if (seqNum != expectedSeqNum) {
|
||||
numMissing += seqNum - expectedSeqNum;
|
||||
expectedSeqNum = seqNum;
|
||||
}
|
||||
|
||||
++expectedSeqNum;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(VERBOSE) << "[" << tmp << "] Missing " << numMissing
|
||||
<< " / " << (mNumBuffersReceived + numMissing) << " packets. ("
|
||||
<< (100.0 * numMissing / (mNumBuffersReceived + numMissing))
|
||||
<< " %%)";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
AString out;
|
||||
|
||||
out.append(tmp);
|
||||
out.append(" [");
|
||||
|
||||
List<sp<ABuffer> >::const_iterator it = mQueue.begin();
|
||||
while (it != mQueue.end()) {
|
||||
uint32_t start = (uint32_t)(*it)->int32Data();
|
||||
|
||||
out.append(start);
|
||||
|
||||
++it;
|
||||
uint32_t expected = start + 1;
|
||||
|
||||
while (it != mQueue.end()) {
|
||||
uint32_t seqNum = (uint32_t)(*it)->int32Data();
|
||||
|
||||
if (seqNum != expected) {
|
||||
if (expected > start + 1) {
|
||||
out.append("-");
|
||||
out.append(expected - 1);
|
||||
}
|
||||
out.append(", ");
|
||||
break;
|
||||
}
|
||||
|
||||
++it;
|
||||
++expected;
|
||||
}
|
||||
|
||||
if (it == mQueue.end()) {
|
||||
if (expected > start + 1) {
|
||||
out.append("-");
|
||||
out.append(expected - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out.append("]");
|
||||
|
||||
LOG(VERBOSE) << out;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t ARTPSource::RTP2NTP(uint32_t rtpTime) const {
|
||||
CHECK_EQ(mNumTimes, 2u);
|
||||
|
||||
@@ -291,7 +206,7 @@ void ARTPSource::addFIR(const sp<ABuffer> &buffer) {
|
||||
mLastFIRRequestUs = nowUs;
|
||||
|
||||
if (buffer->size() + 20 > buffer->capacity()) {
|
||||
LOG(WARNING) << "RTCP buffer too small to accomodate FIR.";
|
||||
LOGW("RTCP buffer too small to accomodate FIR.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -324,12 +239,12 @@ void ARTPSource::addFIR(const sp<ABuffer> &buffer) {
|
||||
|
||||
buffer->setRange(buffer->offset(), buffer->size() + 20);
|
||||
|
||||
LOG(VERBOSE) << "Added FIR request.";
|
||||
LOGV("Added FIR request.");
|
||||
}
|
||||
|
||||
void ARTPSource::addReceiverReport(const sp<ABuffer> &buffer) {
|
||||
if (buffer->size() + 32 > buffer->capacity()) {
|
||||
LOG(WARNING) << "RTCP buffer too small to accomodate RR.";
|
||||
LOGW("RTCP buffer too small to accomodate RR.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ private:
|
||||
uint64_t RTP2NTP(uint32_t rtpTime) const;
|
||||
|
||||
bool queuePacket(const sp<ABuffer> &buffer);
|
||||
void dump() const;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ARTPSource);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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 "ARTPWriter.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -249,7 +269,7 @@ void ARTPWriter::onRead(const sp<AMessage> &msg) {
|
||||
status_t err = mSource->read(&mediaBuf);
|
||||
|
||||
if (err != OK) {
|
||||
LOG(INFO) << "reached EOS.";
|
||||
LOGI("reached EOS.");
|
||||
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
mFlags |= kFlagEOS;
|
||||
@@ -257,7 +277,7 @@ void ARTPWriter::onRead(const sp<AMessage> &msg) {
|
||||
}
|
||||
|
||||
if (mediaBuf->range_length() > 0) {
|
||||
LOG(VERBOSE) << "read buffer of size " << mediaBuf->range_length();
|
||||
LOGV("read buffer of size %d", mediaBuf->range_length());
|
||||
|
||||
if (mMode == H264) {
|
||||
StripStartcode(mediaBuf);
|
||||
@@ -500,7 +520,7 @@ void ARTPWriter::dumpSessionDesc() {
|
||||
sdp.append("a=fmtp:" PT_STR " octed-align\r\n");
|
||||
}
|
||||
|
||||
LOG(INFO) << sdp;
|
||||
LOGI("%s", sdp.c_str());
|
||||
}
|
||||
|
||||
void ARTPWriter::makeH264SPropParamSets(MediaBuffer *buffer) {
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "ARTSPConnection"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "ARTSPConnection.h"
|
||||
|
||||
#include <media/stagefright/foundation/ABuffer.h>
|
||||
@@ -41,7 +45,7 @@ ARTSPConnection::ARTSPConnection()
|
||||
|
||||
ARTSPConnection::~ARTSPConnection() {
|
||||
if (mSocket >= 0) {
|
||||
LOG(ERROR) << "Connection is still open, closing the socket.";
|
||||
LOGE("Connection is still open, closing the socket.");
|
||||
close(mSocket);
|
||||
mSocket = -1;
|
||||
}
|
||||
@@ -184,7 +188,7 @@ void ARTSPConnection::onConnect(const sp<AMessage> &msg) {
|
||||
AString host, path;
|
||||
unsigned port;
|
||||
if (!ParseURL(url.c_str(), &host, &port, &path)) {
|
||||
LOG(ERROR) << "Malformed rtsp url " << url;
|
||||
LOGE("Malformed rtsp url %s", url.c_str());
|
||||
|
||||
reply->setInt32("result", ERROR_MALFORMED);
|
||||
reply->post();
|
||||
@@ -195,7 +199,7 @@ void ARTSPConnection::onConnect(const sp<AMessage> &msg) {
|
||||
|
||||
struct hostent *ent = gethostbyname(host.c_str());
|
||||
if (ent == NULL) {
|
||||
LOG(ERROR) << "Unknown host " << host;
|
||||
LOGE("Unknown host %s", host.c_str());
|
||||
|
||||
reply->setInt32("result", -ENOENT);
|
||||
reply->post();
|
||||
@@ -300,7 +304,7 @@ void ARTSPConnection::onCompleteConnection(const sp<AMessage> &msg) {
|
||||
CHECK_EQ(optionLen, (socklen_t)sizeof(err));
|
||||
|
||||
if (err != 0) {
|
||||
LOG(ERROR) << "err = " << err << " (" << strerror(err) << ")";
|
||||
LOGE("err = %d (%s)", err, strerror(err));
|
||||
|
||||
reply->setInt32("result", -err);
|
||||
|
||||
@@ -343,7 +347,7 @@ void ARTSPConnection::onSendRequest(const sp<AMessage> &msg) {
|
||||
|
||||
request.insert(cseqHeader, i + 2);
|
||||
|
||||
LOG(VERBOSE) << request;
|
||||
LOGV("%s", request.c_str());
|
||||
|
||||
size_t numBytesSent = 0;
|
||||
while (numBytesSent < request.size()) {
|
||||
@@ -353,7 +357,7 @@ void ARTSPConnection::onSendRequest(const sp<AMessage> &msg) {
|
||||
|
||||
if (n == 0) {
|
||||
// Server closed the connection.
|
||||
LOG(ERROR) << "Server unexpectedly closed the connection.";
|
||||
LOGE("Server unexpectedly closed the connection.");
|
||||
|
||||
reply->setInt32("result", ERROR_IO);
|
||||
reply->post();
|
||||
@@ -363,7 +367,7 @@ void ARTSPConnection::onSendRequest(const sp<AMessage> &msg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Error sending rtsp request.";
|
||||
LOGE("Error sending rtsp request.");
|
||||
reply->setInt32("result", -errno);
|
||||
reply->post();
|
||||
return;
|
||||
@@ -438,14 +442,14 @@ status_t ARTSPConnection::receive(void *data, size_t size) {
|
||||
ssize_t n = recv(mSocket, (uint8_t *)data + offset, size - offset, 0);
|
||||
if (n == 0) {
|
||||
// Server closed the connection.
|
||||
LOG(ERROR) << "Server unexpectedly closed the connection.";
|
||||
LOGE("Server unexpectedly closed the connection.");
|
||||
return ERROR_IO;
|
||||
} else if (n < 0) {
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Error reading rtsp response.";
|
||||
LOGE("Error reading rtsp response.");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -516,7 +520,7 @@ bool ARTSPConnection::receiveRTSPReponse() {
|
||||
notify->setObject("buffer", buffer);
|
||||
notify->post();
|
||||
} else {
|
||||
LOG(WARNING) << "received binary data, but no one cares.";
|
||||
LOGW("received binary data, but no one cares.");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -525,7 +529,7 @@ bool ARTSPConnection::receiveRTSPReponse() {
|
||||
sp<ARTSPResponse> response = new ARTSPResponse;
|
||||
response->mStatusLine = statusLine;
|
||||
|
||||
LOG(INFO) << "status: " << response->mStatusLine;
|
||||
LOGI("status: %s", response->mStatusLine.c_str());
|
||||
|
||||
ssize_t space1 = response->mStatusLine.find(" ");
|
||||
if (space1 < 0) {
|
||||
@@ -555,7 +559,7 @@ bool ARTSPConnection::receiveRTSPReponse() {
|
||||
break;
|
||||
}
|
||||
|
||||
LOG(VERBOSE) << "line: " << line;
|
||||
LOGV("line: %s", line.c_str());
|
||||
|
||||
ssize_t colonPos = line.find(":");
|
||||
if (colonPos < 0) {
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "ASessionDescription"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "ASessionDescription.h"
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
@@ -49,7 +53,7 @@ bool ASessionDescription::parse(const void *data, size_t size) {
|
||||
mFormats.push(AString("[root]"));
|
||||
|
||||
AString desc((const char *)data, size);
|
||||
LOG(INFO) << desc;
|
||||
LOGI("%s", desc.c_str());
|
||||
|
||||
size_t i = 0;
|
||||
for (;;) {
|
||||
@@ -102,7 +106,7 @@ bool ASessionDescription::parse(const void *data, size_t size) {
|
||||
key.trim();
|
||||
value.trim();
|
||||
|
||||
LOG(VERBOSE) << "adding '" << key << "' => '" << value << "'";
|
||||
LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
|
||||
|
||||
mTracks.editItemAt(mTracks.size() - 1).add(key, value);
|
||||
break;
|
||||
@@ -110,7 +114,8 @@ bool ASessionDescription::parse(const void *data, size_t size) {
|
||||
|
||||
case 'm':
|
||||
{
|
||||
LOG(VERBOSE) << "new section '" << AString(line, 2, line.size() - 2) << "'";
|
||||
LOGV("new section '%s'",
|
||||
AString(line, 2, line.size() - 2).c_str());
|
||||
|
||||
mTracks.push(Attribs());
|
||||
mFormats.push(AString(line, 2, line.size() - 2));
|
||||
@@ -129,7 +134,7 @@ bool ASessionDescription::parse(const void *data, size_t size) {
|
||||
key.trim();
|
||||
value.trim();
|
||||
|
||||
LOG(VERBOSE) << "adding '" << key << "' => '" << value << "'";
|
||||
LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
|
||||
|
||||
mTracks.editItemAt(mTracks.size() - 1).add(key, value);
|
||||
break;
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
#define MY_HANDLER_H_
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "MyHandler"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "APacketSource.h"
|
||||
#include "ARTPConnection.h"
|
||||
#include "ARTSPConnection.h"
|
||||
@@ -137,8 +141,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "connection request completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("connection request completed with result %d (%s)",
|
||||
result, strerror(-result));
|
||||
|
||||
if (result == OK) {
|
||||
AString request;
|
||||
@@ -173,8 +177,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "DESCRIBE completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("DESCRIBE completed with result %d (%s)",
|
||||
result, strerror(-result));
|
||||
|
||||
if (result == OK) {
|
||||
sp<RefBase> obj;
|
||||
@@ -251,8 +255,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "SETUP(" << index << ") completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("SETUP(%d) completed with result %d (%s)",
|
||||
index, result, strerror(-result));
|
||||
|
||||
if (result == OK) {
|
||||
CHECK(track != NULL);
|
||||
@@ -326,8 +330,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "PLAY completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("PLAY completed with result %d (%s)",
|
||||
result, strerror(-result));
|
||||
|
||||
if (result == OK) {
|
||||
sp<RefBase> obj;
|
||||
@@ -404,8 +408,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "TEARDOWN completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("TEARDOWN completed with result %d (%s)",
|
||||
result, strerror(-result));
|
||||
|
||||
sp<AMessage> reply = new AMessage('disc', id());
|
||||
|
||||
@@ -431,7 +435,7 @@ struct MyHandler : public AHandler {
|
||||
case 'chek':
|
||||
{
|
||||
if (mNumAccessUnitsReceived == 0) {
|
||||
LOG(INFO) << "stream ended? aborting.";
|
||||
LOGI("stream ended? aborting.");
|
||||
(new AMessage('abor', id()))->post();
|
||||
break;
|
||||
}
|
||||
@@ -461,7 +465,7 @@ struct MyHandler : public AHandler {
|
||||
CHECK(msg->findSize("track-index", &trackIndex));
|
||||
|
||||
if (trackIndex >= mTracks.size()) {
|
||||
LOG(ERROR) << "late packets ignored.";
|
||||
LOGV("late packets ignored.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -469,7 +473,7 @@ struct MyHandler : public AHandler {
|
||||
|
||||
int32_t eos;
|
||||
if (msg->findInt32("eos", &eos)) {
|
||||
LOG(INFO) << "received BYE on track index " << trackIndex;
|
||||
LOGI("received BYE on track index %d", trackIndex);
|
||||
#if 0
|
||||
track->mPacketSource->signalEOS(ERROR_END_OF_STREAM);
|
||||
#endif
|
||||
@@ -484,14 +488,13 @@ struct MyHandler : public AHandler {
|
||||
uint32_t seqNum = (uint32_t)accessUnit->int32Data();
|
||||
|
||||
if (mSeekPending) {
|
||||
LOG(INFO) << "we're seeking, dropping stale packet.";
|
||||
LOGV("we're seeking, dropping stale packet.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (seqNum < track->mFirstSeqNumInSegment) {
|
||||
LOG(INFO) << "dropping stale access-unit "
|
||||
<< "(" << seqNum << " < "
|
||||
<< track->mFirstSeqNumInSegment << ")";
|
||||
LOGV("dropping stale access-unit (%d < %d)",
|
||||
seqNum, track->mFirstSeqNumInSegment);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -506,10 +509,8 @@ struct MyHandler : public AHandler {
|
||||
if (track->mNewSegment) {
|
||||
track->mNewSegment = false;
|
||||
|
||||
LOG(VERBOSE) << "first segment unit ntpTime="
|
||||
<< StringPrintf("0x%016llx", ntpTime)
|
||||
<< " rtpTime=" << rtpTime
|
||||
<< " seq=" << seqNum;
|
||||
LOGV("first segment unit ntpTime=0x%016llx rtpTime=%u seq=%d",
|
||||
ntpTime, rtpTime, seqNum);
|
||||
}
|
||||
|
||||
if (mFirstAccessUnit) {
|
||||
@@ -535,7 +536,7 @@ struct MyHandler : public AHandler {
|
||||
int32_t damaged;
|
||||
if (accessUnit->meta()->findInt32("damaged", &damaged)
|
||||
&& damaged != 0) {
|
||||
LOG(INFO) << "ignoring damaged AU";
|
||||
LOGI("ignoring damaged AU");
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -608,8 +609,8 @@ struct MyHandler : public AHandler {
|
||||
int32_t result;
|
||||
CHECK(msg->findInt32("result", &result));
|
||||
|
||||
LOG(INFO) << "PLAY completed with result "
|
||||
<< result << " (" << strerror(-result) << ")";
|
||||
LOGI("PLAY completed with result %d (%s)",
|
||||
result, strerror(-result));
|
||||
|
||||
if (result == OK) {
|
||||
sp<RefBase> obj;
|
||||
@@ -622,12 +623,12 @@ struct MyHandler : public AHandler {
|
||||
} else {
|
||||
parsePlayResponse(response);
|
||||
|
||||
LOG(INFO) << "seek completed.";
|
||||
LOGI("seek completed.");
|
||||
}
|
||||
}
|
||||
|
||||
if (result != OK) {
|
||||
LOG(ERROR) << "seek failed, aborting.";
|
||||
LOGE("seek failed, aborting.");
|
||||
(new AMessage('abor', id()))->post();
|
||||
}
|
||||
|
||||
@@ -652,11 +653,10 @@ struct MyHandler : public AHandler {
|
||||
{
|
||||
if (!mReceivedFirstRTCPPacket) {
|
||||
if (mTryTCPInterleaving) {
|
||||
LOG(WARNING) << "Never received any data, disconnecting.";
|
||||
LOGW("Never received any data, disconnecting.");
|
||||
(new AMessage('abor', id()))->post();
|
||||
} else {
|
||||
LOG(WARNING)
|
||||
<< "Never received any data, switching transports.";
|
||||
LOGW("Never received any data, switching transports.");
|
||||
|
||||
mTryTCPInterleaving = true;
|
||||
|
||||
@@ -700,7 +700,7 @@ struct MyHandler : public AHandler {
|
||||
}
|
||||
|
||||
AString range = response->mHeaders.valueAt(i);
|
||||
LOG(VERBOSE) << "Range: " << range;
|
||||
LOGV("Range: %s", range.c_str());
|
||||
|
||||
AString val;
|
||||
CHECK(GetAttribute(range.c_str(), "npt", &val));
|
||||
@@ -724,7 +724,7 @@ struct MyHandler : public AHandler {
|
||||
for (List<AString>::iterator it = streamInfos.begin();
|
||||
it != streamInfos.end(); ++it) {
|
||||
(*it).trim();
|
||||
LOG(VERBOSE) << "streamInfo[" << n << "] = " << *it;
|
||||
LOGV("streamInfo[%d] = %s", n, (*it).c_str());
|
||||
|
||||
CHECK(GetAttribute((*it).c_str(), "url", &val));
|
||||
|
||||
@@ -748,8 +748,7 @@ struct MyHandler : public AHandler {
|
||||
|
||||
uint32_t rtpTime = strtoul(val.c_str(), &end, 10);
|
||||
|
||||
LOG(VERBOSE) << "track #" << n
|
||||
<< ": rtpTime=" << rtpTime << " <=> npt=" << npt1;
|
||||
LOGV("track #%d: rtpTime=%u <=> ntp=%.2f", n, rtpTime, npt1);
|
||||
|
||||
info->mPacketSource->setNormalPlayTimeMapping(
|
||||
rtpTime, (int64_t)(npt1 * 1E6));
|
||||
@@ -806,8 +805,7 @@ private:
|
||||
new APacketSource(mSessionDesc, index);
|
||||
|
||||
if (source->initCheck() != OK) {
|
||||
LOG(WARNING) << "Unsupported format. Ignoring track #"
|
||||
<< index << ".";
|
||||
LOGW("Unsupported format. Ignoring track #%d.", index);
|
||||
|
||||
sp<AMessage> reply = new AMessage('setu', id());
|
||||
reply->setSize("index", index);
|
||||
@@ -830,7 +828,7 @@ private:
|
||||
info->mFirstSeqNumInSegment = 0;
|
||||
info->mNewSegment = true;
|
||||
|
||||
LOG(VERBOSE) << "track #" << mTracks.size() << " URL=" << trackURL;
|
||||
LOGV("track #%d URL=%s", mTracks.size(), trackURL.c_str());
|
||||
|
||||
AString request = "SETUP ";
|
||||
request.append(trackURL);
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* 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>
|
||||
@@ -67,7 +71,7 @@ void UDPPusher::start() {
|
||||
bool UDPPusher::onPush() {
|
||||
uint32_t length;
|
||||
if (fread(&length, 1, sizeof(length), mFile) < sizeof(length)) {
|
||||
LOG(INFO) << "No more data to push.";
|
||||
LOGI("No more data to push.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,7 +81,7 @@ bool UDPPusher::onPush() {
|
||||
|
||||
sp<ABuffer> buffer = new ABuffer(length);
|
||||
if (fread(buffer->data(), 1, length, mFile) < length) {
|
||||
LOG(ERROR) << "File truncated?.";
|
||||
LOGE("File truncated?.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,7 +93,7 @@ bool UDPPusher::onPush() {
|
||||
|
||||
uint32_t timeMs;
|
||||
if (fread(&timeMs, 1, sizeof(timeMs), mFile) < sizeof(timeMs)) {
|
||||
LOG(INFO) << "No more data to push.";
|
||||
LOGI("No more data to push.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,7 +113,7 @@ void UDPPusher::onMessageReceived(const sp<AMessage> &msg) {
|
||||
case kWhatPush:
|
||||
{
|
||||
if (!onPush() && !(ntohs(mRemoteAddr.sin_port) & 1)) {
|
||||
LOG(INFO) << "emulating BYE packet";
|
||||
LOGI("emulating BYE packet");
|
||||
|
||||
sp<ABuffer> buffer = new ABuffer(8);
|
||||
uint8_t *data = buffer->data();
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
* 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>
|
||||
@@ -200,8 +204,7 @@ int main(int argc, char **argv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "decoder returned error "
|
||||
<< StringPrintf("0x%08x", err);
|
||||
LOGE("decoder returned error 0x%08x", err);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user