Loading include/media/stagefright/ExtendedStats.h +10 −1 Original line number Original line Diff line number Diff line Loading @@ -61,6 +61,7 @@ namespace android { * and to report dropped frames etc. * and to report dropped frames etc. */ */ typedef int64_t statsDataType; typedef int64_t statsDataType; class MediaExtendedStats; class ExtendedStats : public RefBase { class ExtendedStats : public RefBase { Loading @@ -83,6 +84,12 @@ public: statsDataType mData; statsDataType mData; }; }; // Supported type of MediaExtendedStats enum StatsType { PLAYER, RECORDER, }; // Supported evaluations (and hence possible variants of 'LogEntry's) // Supported evaluations (and hence possible variants of 'LogEntry's) enum LogType { enum LogType { Loading Loading @@ -187,7 +194,7 @@ public: }; }; struct AutoProfile { struct AutoProfile { AutoProfile(const char* eventName, sp<ExtendedStats> stats = NULL, AutoProfile(const char* eventName, sp<MediaExtendedStats> mediaExtendedStats = NULL, bool condition = true, bool profileOnce = false); bool condition = true, bool profileOnce = false); ~AutoProfile(); ~AutoProfile(); Loading Loading @@ -226,6 +233,8 @@ public: log(PROFILE, name, PROFILE_STOP); log(PROFILE, name, PROFILE_STOP); } } static MediaExtendedStats* Create(enum StatsType statsType, const char* name, pid_t tid); protected: protected: KeyedVector<AString, sp<LogEntry> > mLogEntry; KeyedVector<AString, sp<LogEntry> > mLogEntry; Loading media/libmediaplayerservice/StagefrightRecorder.cpp +12 −13 Original line number Original line Diff line number Diff line Loading @@ -93,7 +93,8 @@ StagefrightRecorder::StagefrightRecorder() ALOGV("Constructor"); ALOGV("Constructor"); reset(); reset(); mRecorderExtendedStats = new RecorderExtendedStats("StagefrightRecorder", gettid()); mRecorderExtendedStats = (RecorderExtendedStats *)ExtendedStats::Create( ExtendedStats::RECORDER, "StagefrightRecorder", gettid()); } } StagefrightRecorder::~StagefrightRecorder() { StagefrightRecorder::~StagefrightRecorder() { Loading Loading @@ -866,8 +867,7 @@ status_t StagefrightRecorder::prepare() { status_t StagefrightRecorder::start() { status_t StagefrightRecorder::start() { ALOGV("start"); ALOGV("start"); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_START_LATENCY, ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_START_LATENCY, mRecorderExtendedStats); mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); if (mOutputFd < 0) { if (mOutputFd < 0) { ALOGE("Output file descriptor is invalid"); ALOGE("Output file descriptor is invalid"); Loading Loading @@ -1330,8 +1330,8 @@ status_t StagefrightRecorder::checkVideoEncoderCapabilities( Vector<CodecCapabilities> codecs; Vector<CodecCapabilities> codecs; OMXClient client; OMXClient client; CHECK_EQ(client.connect(), (status_t)OK); CHECK_EQ(client.connect(), (status_t)OK); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_ALLOCATE_NODE(true) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_ALLOCATE_NODE(true /* isVideo */), mRecorderExtendedStats); QueryCodecs( QueryCodecs( client.interface(), client.interface(), (mVideoEncoder == VIDEO_ENCODER_H263 ? MEDIA_MIMETYPE_VIDEO_H263 : (mVideoEncoder == VIDEO_ENCODER_H263 ? MEDIA_MIMETYPE_VIDEO_H263 : Loading Loading @@ -1551,8 +1551,8 @@ status_t StagefrightRecorder::setupMediaSource( status_t StagefrightRecorder::setupCameraSource( status_t StagefrightRecorder::setupCameraSource( sp<CameraSource> *cameraSource) { sp<CameraSource> *cameraSource) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_CAMERA_SOURCE, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_CAMERA_SOURCE, mRecorderExtendedStats); status_t err = OK; status_t err = OK; bool encoderSupportsCameraSourceMetaDataMode; bool encoderSupportsCameraSourceMetaDataMode; Loading Loading @@ -1616,8 +1616,8 @@ status_t StagefrightRecorder::setupCameraSource( status_t StagefrightRecorder::setupVideoEncoder( status_t StagefrightRecorder::setupVideoEncoder( sp<MediaSource> cameraSource, sp<MediaSource> cameraSource, sp<MediaSource> *source) { sp<MediaSource> *source) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_ENCODER(true) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_ENCODER(true /* isVideo */), mRecorderExtendedStats); source->clear(); source->clear(); Loading Loading @@ -1745,8 +1745,8 @@ status_t StagefrightRecorder::setupVideoEncoder( } } status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) { status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_ENCODER(false) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_ENCODER(false /* isVideo */), mRecorderExtendedStats); status_t status = BAD_VALUE; status_t status = BAD_VALUE; if (OK != (status = checkAudioEncoderCapabilities())) { if (OK != (status = checkAudioEncoderCapabilities())) { return status; return status; Loading Loading @@ -1872,8 +1872,7 @@ void StagefrightRecorder::setupMPEG4orWEBMMetaData(sp<MetaData> *meta) { } } status_t StagefrightRecorder::pause() { status_t StagefrightRecorder::pause() { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_PAUSE, ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_PAUSE, mRecorderExtendedStats); mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); ALOGV("pause"); ALOGV("pause"); status_t err = OK; status_t err = OK; if (mWriter == NULL) { if (mWriter == NULL) { Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -174,7 +174,8 @@ NuPlayer::NuPlayer() mStarted(false) { mStarted(false) { clearFlushComplete(); clearFlushComplete(); mPlayerExtendedStats = new PlayerExtendedStats("NuPlayer", gettid()); mPlayerExtendedStats = (PlayerExtendedStats *)ExtendedStats::Create( ExtendedStats::PLAYER, "NuPlayer", gettid()); } } NuPlayer::~NuPlayer() { NuPlayer::~NuPlayer() { Loading media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -115,8 +115,8 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { format->findObject(MEDIA_EXTENDED_STATS, (sp<RefBase>*)&mPlayerExtendedStats); format->findObject(MEDIA_EXTENDED_STATS, (sp<RefBase>*)&mPlayerExtendedStats); } } int32_t isVideo = !strncasecmp(mime.c_str(), "video/", 6); int32_t isVideo = !strncasecmp(mime.c_str(), "video/", 6); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_ALLOCATE_NODE(isVideo), ExtendedStats::AutoProfile autoProfile( mPlayerExtendedStats == NULL ? NULL : mPlayerExtendedStats->getProfileTimes()); STATS_PROFILE_ALLOCATE_NODE(isVideo), mPlayerExtendedStats); mCodec = MediaCodec::CreateByType(mCodecLooper, mime.c_str(), false /* encoder */); mCodec = MediaCodec::CreateByType(mCodecLooper, mime.c_str(), false /* encoder */); } } Loading media/libstagefright/ACodec.cpp +3 −4 Original line number Original line Diff line number Diff line Loading @@ -537,8 +537,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { const char* portType = portIndex == kPortIndexInput ? const char* portType = portIndex == kPortIndexInput ? STATS_PROFILE_ALLOCATE_INPUT(isVideo) : STATS_PROFILE_ALLOCATE_INPUT(isVideo) : STATS_PROFILE_ALLOCATE_OUTPUT(isVideo); STATS_PROFILE_ALLOCATE_OUTPUT(isVideo); ExtendedStats::AutoProfile autoProfile(portType, ExtendedStats::AutoProfile autoProfile(portType, mMediaExtendedStats); mMediaExtendedStats == NULL ? NULL : mMediaExtendedStats->getProfileTimes()); CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput); CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput); Loading Loading @@ -1199,8 +1198,8 @@ status_t ACodec::configureCodec( } } bool isVideo = mComponentName.find("video") != -1; bool isVideo = mComponentName.find("video") != -1; ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_CONFIGURE_CODEC(isVideo), ExtendedStats::AutoProfile autoProfile( mMediaExtendedStats == NULL ? NULL : mMediaExtendedStats->getProfileTimes()); STATS_PROFILE_CONFIGURE_CODEC(isVideo), mMediaExtendedStats); sp<AMessage> inputFormat = new AMessage(); sp<AMessage> inputFormat = new AMessage(); sp<AMessage> outputFormat = new AMessage(); sp<AMessage> outputFormat = new AMessage(); Loading Loading
include/media/stagefright/ExtendedStats.h +10 −1 Original line number Original line Diff line number Diff line Loading @@ -61,6 +61,7 @@ namespace android { * and to report dropped frames etc. * and to report dropped frames etc. */ */ typedef int64_t statsDataType; typedef int64_t statsDataType; class MediaExtendedStats; class ExtendedStats : public RefBase { class ExtendedStats : public RefBase { Loading @@ -83,6 +84,12 @@ public: statsDataType mData; statsDataType mData; }; }; // Supported type of MediaExtendedStats enum StatsType { PLAYER, RECORDER, }; // Supported evaluations (and hence possible variants of 'LogEntry's) // Supported evaluations (and hence possible variants of 'LogEntry's) enum LogType { enum LogType { Loading Loading @@ -187,7 +194,7 @@ public: }; }; struct AutoProfile { struct AutoProfile { AutoProfile(const char* eventName, sp<ExtendedStats> stats = NULL, AutoProfile(const char* eventName, sp<MediaExtendedStats> mediaExtendedStats = NULL, bool condition = true, bool profileOnce = false); bool condition = true, bool profileOnce = false); ~AutoProfile(); ~AutoProfile(); Loading Loading @@ -226,6 +233,8 @@ public: log(PROFILE, name, PROFILE_STOP); log(PROFILE, name, PROFILE_STOP); } } static MediaExtendedStats* Create(enum StatsType statsType, const char* name, pid_t tid); protected: protected: KeyedVector<AString, sp<LogEntry> > mLogEntry; KeyedVector<AString, sp<LogEntry> > mLogEntry; Loading
media/libmediaplayerservice/StagefrightRecorder.cpp +12 −13 Original line number Original line Diff line number Diff line Loading @@ -93,7 +93,8 @@ StagefrightRecorder::StagefrightRecorder() ALOGV("Constructor"); ALOGV("Constructor"); reset(); reset(); mRecorderExtendedStats = new RecorderExtendedStats("StagefrightRecorder", gettid()); mRecorderExtendedStats = (RecorderExtendedStats *)ExtendedStats::Create( ExtendedStats::RECORDER, "StagefrightRecorder", gettid()); } } StagefrightRecorder::~StagefrightRecorder() { StagefrightRecorder::~StagefrightRecorder() { Loading Loading @@ -866,8 +867,7 @@ status_t StagefrightRecorder::prepare() { status_t StagefrightRecorder::start() { status_t StagefrightRecorder::start() { ALOGV("start"); ALOGV("start"); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_START_LATENCY, ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_START_LATENCY, mRecorderExtendedStats); mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); if (mOutputFd < 0) { if (mOutputFd < 0) { ALOGE("Output file descriptor is invalid"); ALOGE("Output file descriptor is invalid"); Loading Loading @@ -1330,8 +1330,8 @@ status_t StagefrightRecorder::checkVideoEncoderCapabilities( Vector<CodecCapabilities> codecs; Vector<CodecCapabilities> codecs; OMXClient client; OMXClient client; CHECK_EQ(client.connect(), (status_t)OK); CHECK_EQ(client.connect(), (status_t)OK); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_ALLOCATE_NODE(true) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_ALLOCATE_NODE(true /* isVideo */), mRecorderExtendedStats); QueryCodecs( QueryCodecs( client.interface(), client.interface(), (mVideoEncoder == VIDEO_ENCODER_H263 ? MEDIA_MIMETYPE_VIDEO_H263 : (mVideoEncoder == VIDEO_ENCODER_H263 ? MEDIA_MIMETYPE_VIDEO_H263 : Loading Loading @@ -1551,8 +1551,8 @@ status_t StagefrightRecorder::setupMediaSource( status_t StagefrightRecorder::setupCameraSource( status_t StagefrightRecorder::setupCameraSource( sp<CameraSource> *cameraSource) { sp<CameraSource> *cameraSource) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_CAMERA_SOURCE, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_CAMERA_SOURCE, mRecorderExtendedStats); status_t err = OK; status_t err = OK; bool encoderSupportsCameraSourceMetaDataMode; bool encoderSupportsCameraSourceMetaDataMode; Loading Loading @@ -1616,8 +1616,8 @@ status_t StagefrightRecorder::setupCameraSource( status_t StagefrightRecorder::setupVideoEncoder( status_t StagefrightRecorder::setupVideoEncoder( sp<MediaSource> cameraSource, sp<MediaSource> cameraSource, sp<MediaSource> *source) { sp<MediaSource> *source) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_ENCODER(true) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_ENCODER(true /* isVideo */), mRecorderExtendedStats); source->clear(); source->clear(); Loading Loading @@ -1745,8 +1745,8 @@ status_t StagefrightRecorder::setupVideoEncoder( } } status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) { status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_SET_ENCODER(false) /* isVideo */, ExtendedStats::AutoProfile autoProfile( mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); STATS_PROFILE_SET_ENCODER(false /* isVideo */), mRecorderExtendedStats); status_t status = BAD_VALUE; status_t status = BAD_VALUE; if (OK != (status = checkAudioEncoderCapabilities())) { if (OK != (status = checkAudioEncoderCapabilities())) { return status; return status; Loading Loading @@ -1872,8 +1872,7 @@ void StagefrightRecorder::setupMPEG4orWEBMMetaData(sp<MetaData> *meta) { } } status_t StagefrightRecorder::pause() { status_t StagefrightRecorder::pause() { ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_PAUSE, ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_PAUSE, mRecorderExtendedStats); mRecorderExtendedStats == NULL ? 0 : mRecorderExtendedStats->getProfileTimes()); ALOGV("pause"); ALOGV("pause"); status_t err = OK; status_t err = OK; if (mWriter == NULL) { if (mWriter == NULL) { Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -174,7 +174,8 @@ NuPlayer::NuPlayer() mStarted(false) { mStarted(false) { clearFlushComplete(); clearFlushComplete(); mPlayerExtendedStats = new PlayerExtendedStats("NuPlayer", gettid()); mPlayerExtendedStats = (PlayerExtendedStats *)ExtendedStats::Create( ExtendedStats::PLAYER, "NuPlayer", gettid()); } } NuPlayer::~NuPlayer() { NuPlayer::~NuPlayer() { Loading
media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -115,8 +115,8 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { format->findObject(MEDIA_EXTENDED_STATS, (sp<RefBase>*)&mPlayerExtendedStats); format->findObject(MEDIA_EXTENDED_STATS, (sp<RefBase>*)&mPlayerExtendedStats); } } int32_t isVideo = !strncasecmp(mime.c_str(), "video/", 6); int32_t isVideo = !strncasecmp(mime.c_str(), "video/", 6); ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_ALLOCATE_NODE(isVideo), ExtendedStats::AutoProfile autoProfile( mPlayerExtendedStats == NULL ? NULL : mPlayerExtendedStats->getProfileTimes()); STATS_PROFILE_ALLOCATE_NODE(isVideo), mPlayerExtendedStats); mCodec = MediaCodec::CreateByType(mCodecLooper, mime.c_str(), false /* encoder */); mCodec = MediaCodec::CreateByType(mCodecLooper, mime.c_str(), false /* encoder */); } } Loading
media/libstagefright/ACodec.cpp +3 −4 Original line number Original line Diff line number Diff line Loading @@ -537,8 +537,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { const char* portType = portIndex == kPortIndexInput ? const char* portType = portIndex == kPortIndexInput ? STATS_PROFILE_ALLOCATE_INPUT(isVideo) : STATS_PROFILE_ALLOCATE_INPUT(isVideo) : STATS_PROFILE_ALLOCATE_OUTPUT(isVideo); STATS_PROFILE_ALLOCATE_OUTPUT(isVideo); ExtendedStats::AutoProfile autoProfile(portType, ExtendedStats::AutoProfile autoProfile(portType, mMediaExtendedStats); mMediaExtendedStats == NULL ? NULL : mMediaExtendedStats->getProfileTimes()); CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput); CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput); Loading Loading @@ -1199,8 +1198,8 @@ status_t ACodec::configureCodec( } } bool isVideo = mComponentName.find("video") != -1; bool isVideo = mComponentName.find("video") != -1; ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_CONFIGURE_CODEC(isVideo), ExtendedStats::AutoProfile autoProfile( mMediaExtendedStats == NULL ? NULL : mMediaExtendedStats->getProfileTimes()); STATS_PROFILE_CONFIGURE_CODEC(isVideo), mMediaExtendedStats); sp<AMessage> inputFormat = new AMessage(); sp<AMessage> inputFormat = new AMessage(); sp<AMessage> outputFormat = new AMessage(); sp<AMessage> outputFormat = new AMessage(); Loading