From 9be07ef6a1d4dc591a25b3364a6ca0ad6f524ab9 Mon Sep 17 00:00:00 2001 From: Haynes Mathew George Date: Fri, 1 Feb 2013 18:49:00 -0800 Subject: libstagefright: Squashed commit of LPA/tunnel updates from CAF libstagefright: Exceptions in using Tunnel mode decode - Accumulate all known exceptions to a separate function Change-Id: I61bbc288c9a087559db210e76141b8c57e67fff0 CRs-Fixed: 432080 libstagefright : Stability fixes for Tunnel Player (part 2) - Synchronize b/w reset() and onPauseTimeout - Synchronize b/w seekTo() and onPauseTimeout Change-Id: Ia5cfc6b4dcc326ead440fba35d809d4f3f1b5a81 CRs-Fixed: 449122 Revert "Revert "libstagefright: Convert mono to stereo for LPA clips"" This reverts commit 0db8a19fb3216a8a83d5d6cbd5f1ccbf997a20d8. libstagefright: Port Tunnel mode fixes to LPA - Miscellaneous fixes for seek, pause/resume, EOS handling - Miscellaneous fixes for synchronization between the decoder thread, TimedEventQueue and the player thread. - This change is a port of a similar set of changes made for TunnelPlayer Change-Id: I82c2904f7aedfb9c4f03200419fcba8b038e3d54 libstagefright: Avoid use of extra bytes to signal seek processed - A few bytes were reserved in the buffer sent by Tunnel/LPA player to audio HAL to indicate a seek has been processed and there is no need to skip it. - We won't need this method anymore as this can be fixed instead by synchronizing seekTo() and the extractor/decoder threads. Change-Id: Ic02ae1699bb59e2f6b8d9fb599d0fa43fd3f19e3 libstagefright: LPAPlayer synchronization fixes - synchronize b/w seekTo() and onPauseTimeout() - synchronize b/w reset() and onPauseTimeout() Change-Id: I29a4ccf02e28fe7b7c00e35a679ff2b5271ffb6f libstagefright: TunnelPlayer performance tweaks Some tweaks when TunnelPlayer is used for audio/video playback - Keep the extractor thread at ANDROID_PRIORITY_NORMAL - sched_yield() after reading a frame to give the video thread(s) (CallbackDispatcher and/or TimedEventQueue) to be scheduled Change-Id: If0d86d629fd0e15aff917af8589472578cd28bf4 CRs-Fixed: 444041 --- media/libstagefright/AwesomePlayer.cpp | 53 +++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) (limited to 'media/libstagefright/AwesomePlayer.cpp') diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 6dc18f8..6c1f4c5 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1537,9 +1537,10 @@ status_t AwesomePlayer::initAudioDecoder() { int32_t isADTS = 0; meta->findInt32( kKeyChannelCount, &nchannels ); meta->findInt32(kKeyIsADTS, &isADTS); - if(isADTS == 1){ + if (isADTS == 1) { ALOGV("Widevine content\n"); } + ALOGV("nchannels %d;LPA will be skipped if nchannels is > 2 or nchannels == 0", nchannels); #endif @@ -1555,7 +1556,7 @@ status_t AwesomePlayer::initAudioDecoder() { //widevine will fallback to software decoder if (sys_prop_enabled && (TunnelPlayer::mTunnelObjectsAlive == 0) && - mTunnelAliveAP == 0 && (isADTS == 0) && + (mTunnelAliveAP == 0) && (isADTS == 0) && mAudioSink->realtime() && inSupportedTunnelFormats(mime)) { @@ -1576,10 +1577,7 @@ status_t AwesomePlayer::initAudioDecoder() { else ALOGD("Normal Audio Playback"); - if (isStreamingHTTP()) { - ALOGV("Streaming, force disable tunnel mode playback"); - mIsTunnelAudio = false; - } + checkTunnelExceptions(); if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW) || (mIsTunnelAudio && (mTunnelAliveAP == 0))) { @@ -2050,8 +2048,8 @@ void AwesomePlayer::onVideoEvent() { if (latenessUs > 40000) { // We're more than 40ms late. - ALOGV("we're late by %lld us (%.2f secs)", - latenessUs, latenessUs / 1E6); + ALOGE("we're late by %lld us nowUs %lld, timeUs %lld", + latenessUs, nowUs, timeUs); if (!(mFlags & SLOW_DECODER_HACK) || mSinceLastDropped > FRAME_DROP_FREQ) @@ -3056,6 +3054,45 @@ bool AwesomePlayer::inSupportedTunnelFormats(const char * mime) { ALOGW("Tunnel playback unsupported for %s", mime); return false; } + +void AwesomePlayer::checkTunnelExceptions() +{ + /* exception 1: No streaming */ + if (isStreamingHTTP()) { + ALOGV("Streaming, force disable tunnel mode playback"); + mIsTunnelAudio = false; + return; + } + + /* below exceptions are only for av content */ + if (mVideoTrack == NULL) return; + + /* exception 2: No avi having video + mp3 */ + if (mExtractor == NULL) return; + + sp metaData = mExtractor->getMetaData(); + const char * container; + + /*only proceed for avi content.*/ + if (!metaData->findCString(kKeyMIMEType, &container) || + strcmp(container, MEDIA_MIMETYPE_CONTAINER_AVI)) { + return; + } + + CHECK(mAudioTrack != NULL); + + const char * mime; + metaData = mAudioTrack->getFormat(); + /*disable for av content having mp3*/ + if (metaData->findCString(kKeyMIMEType, &mime) && + !strcmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) { + ALOGV("Clip has AVI extractor and mp3 content, disable tunnel mode"); + mIsTunnelAudio = false; + return; + } + + return; +} #endif } // namespace android -- cgit v1.1