summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp12
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp23
2 files changed, 23 insertions, 12 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index b5eef94..3ebe989 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -374,11 +374,13 @@ status_t MediaPlayerService::dump(int fd, const Vector<String16>& args)
} else {
for (int i = 0, n = mMediaRecorderClients.size(); i < n; ++i) {
sp<MediaRecorderClient> c = mMediaRecorderClients[i].promote();
- snprintf(buffer, 255, " MediaRecorderClient pid(%d)\n", c->mPid);
- result.append(buffer);
- write(fd, result.string(), result.size());
- result = "\n";
- c->dump(fd, args);
+ if (c != 0) {
+ snprintf(buffer, 255, " MediaRecorderClient pid(%d)\n", c->mPid);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+ result = "\n";
+ c->dump(fd, args);
+ }
}
}
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 1128771..00d414c 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -52,6 +52,13 @@ namespace android {
// buffers after 3 seconds.
const static int64_t kBufferFilledEventTimeOutNs = 3000000000LL;
+// OMX Spec defines less than 50 color formats. If the query for
+// color format is executed for more than kMaxColorFormatSupported,
+// the query will fail to avoid looping forever.
+// 1000 is more than enough for us to tell whether the omx
+// component in question is buggy or not.
+const static uint32_t kMaxColorFormatSupported = 1000;
+
struct CodecInfo {
const char *mime;
const char *codec;
@@ -818,6 +825,11 @@ status_t OMXCodec::setVideoPortFormatType(
}
++index;
+ if (index >= kMaxColorFormatSupported) {
+ CODEC_LOGE("color format %d or compression format %d is not supported",
+ colorFormat, compressionFormat);
+ return UNKNOWN_ERROR;
+ }
}
if (!found) {
@@ -901,22 +913,19 @@ status_t OMXCodec::isColorFormatSupported(
// the incremented index (bug 2897413).
CHECK_EQ(index, portFormat.nIndex);
if (portFormat.eColorFormat == colorFormat) {
- LOGV("Found supported color format: %d", portFormat.eColorFormat);
+ CODEC_LOGV("Found supported color format: %d", portFormat.eColorFormat);
return OK; // colorFormat is supported!
}
++index;
portFormat.nIndex = index;
- // OMX Spec defines less than 50 color formats
- // 1000 is more than enough for us to tell whether the omx
- // component in question is buggy or not.
- if (index >= 1000) {
- LOGE("More than %ld color formats are supported???", index);
+ if (index >= kMaxColorFormatSupported) {
+ CODEC_LOGE("More than %ld color formats are supported???", index);
break;
}
}
- LOGE("color format %d is not supported", colorFormat);
+ CODEC_LOGE("color format %d is not supported", colorFormat);
return UNKNOWN_ERROR;
}