am fb861523: Merge "Specification of codec specific data as part of the session description is now optional." into gingerbread

Merge commit 'fb861523318710b95c08110b9b2de28f7da74a40' into gingerbread-plus-aosp

* commit 'fb861523318710b95c08110b9b2de28f7da74a40':
  Specification of codec specific data as part of the session description is now optional.
This commit is contained in:
Andreas Huber
2010-08-05 09:25:25 -07:00
committed by Android Git Automerger
2 changed files with 14 additions and 59 deletions

View File

@@ -854,7 +854,7 @@ void AwesomePlayer::setVideoSource(sp<MediaSource> source) {
status_t AwesomePlayer::initVideoDecoder() {
uint32_t flags = 0;
#if 1
#if 0
if (mRTPSession != NULL) {
// XXX hack.
@@ -1240,39 +1240,6 @@ status_t AwesomePlayer::finishSetDataSource_l() {
mLooper->registerHandler(mRTPSession);
#if 0
// My H264 SDP
static const char *raw =
"v=0\r\n"
"o=- 64 233572944 IN IP4 127.0.0.0\r\n"
"s=QuickTime\r\n"
"t=0 0\r\n"
"a=range:npt=0-315\r\n"
"a=isma-compliance:2,2.0,2\r\n"
"m=video 5434 RTP/AVP 97\r\n"
"c=IN IP4 127.0.0.1\r\n"
"b=AS:30\r\n"
"a=rtpmap:97 H264/90000\r\n"
"a=fmtp:97 packetization-mode=1;profile-level-id=42000C;"
"sprop-parameter-sets=Z0IADJZUCg+I,aM44gA==\r\n"
"a=mpeg4-esid:201\r\n"
"a=cliprect:0,0,240,320\r\n"
"a=framesize:97 320-240\r\n";
#elif 0
// My H263 SDP
static const char *raw =
"v=0\r\n"
"o=- 64 233572944 IN IP4 127.0.0.0\r\n"
"s=QuickTime\r\n"
"t=0 0\r\n"
"a=range:npt=0-315\r\n"
"a=isma-compliance:2,2.0,2\r\n"
"m=video 5434 RTP/AVP 97\r\n"
"c=IN IP4 127.0.0.1\r\n"
"b=AS:30\r\n"
"a=rtpmap:97 H263-1998/90000\r\n"
"a=cliprect:0,0,240,320\r\n"
"a=framesize:97 320-240\r\n";
#elif 0
// My AMR SDP
static const char *raw =
"v=0\r\n"
@@ -1299,12 +1266,9 @@ status_t AwesomePlayer::finishSetDataSource_l() {
"c=IN IP4 127.0.0.1\r\n"
"b=AS:30\r\n"
"a=rtpmap:97 H264/90000\r\n"
"a=fmtp:97 packetization-mode=1;profile-level-id=42E00D;"
"sprop-parameter-sets=J0LgDZWgUG/lQA==,KM4DnoA=\r\n"
"a=mpeg4-esid:201\r\n"
"a=cliprect:0,0,200,320\r\n"
"a=framesize:97 320-200\r\n";
#elif 0
#else
// GTalk H263 SDP
static const char *raw =
"v=0\r\n"
@@ -1319,22 +1283,6 @@ status_t AwesomePlayer::finishSetDataSource_l() {
"a=rtpmap:98 H263-1998/90000\r\n"
"a=cliprect:0,0,200,320\r\n"
"a=framesize:98 320-200\r\n";
#else
// sholes H264 SDP
static const char *raw =
"v=0\r\n"
"o=- 64 233572944 IN IP4 127.0.0.0\r\n"
"s=QuickTime\r\n"
"t=0 0\r\n"
"a=range:npt=now-\r\n"
"m=video 5434 RTP/AVP 96\r\n"
"c=IN IP4 127.0.0.1\r\n"
"b=AS:320000\r\n"
"a=rtpmap:96 H264/90000\r\n"
"a=fmtp:96 packetization-mode=1;profile-level-id=42001E;"
"sprop-parameter-sets=Z0KACukCg+QgAAB9AAAOpgCA,aM48gA==\r\n"
"a=cliprect:0,0,240,320\r\n"
"a=framesize:96 320-240\r\n";
#endif
sp<ASessionDescription> desc = new ASessionDescription;

View File

@@ -92,7 +92,9 @@ static sp<ABuffer> decodeHex(const AString &s) {
static sp<ABuffer> MakeAVCCodecSpecificData(const char *params) {
AString val;
CHECK(GetAttribute(params, "profile-level-id", &val));
if (!GetAttribute(params, "profile-level-id", &val)) {
return NULL;
}
sp<ABuffer> profileLevelID = decodeHex(val);
CHECK(profileLevelID != NULL);
@@ -105,7 +107,10 @@ static sp<ABuffer> MakeAVCCodecSpecificData(const char *params) {
size_t numPicParameterSets = 0;
size_t totalPicParameterSetSize = 0;
CHECK(GetAttribute(params, "sprop-parameter-sets", &val));
if (!GetAttribute(params, "sprop-parameter-sets", &val)) {
return NULL;
}
size_t start = 0;
for (;;) {
ssize_t commaPos = val.find(",", start);
@@ -256,9 +261,11 @@ APacketSource::APacketSource(
sp<ABuffer> codecSpecificData =
MakeAVCCodecSpecificData(params.c_str());
mFormat->setData(
kKeyAVCC, 0,
codecSpecificData->data(), codecSpecificData->size());
if (codecSpecificData != NULL) {
mFormat->setData(
kKeyAVCC, 0,
codecSpecificData->data(), codecSpecificData->size());
}
} else if (!strncmp(desc.c_str(), "H263-2000/", 10)
|| !strncmp(desc.c_str(), "H263-1998/", 10)) {
mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_H263);