libstagefright: Fix potential blocking in finishSetDataSource_l.

BZ: 102648

It may be blocked when creating MediaExtractor with HTTP stream datasource.
We should do this work out of lock space.

Change-Id: I9f80253ef6b290b7878cc2c524cc61bde7c246c1
Orig-Change-Id: I76fad543f387ed24d3530a6d69512d544e12a9f2
Signed-off-by: lwan89x <liangx.wang@intel.com>
Signed-off-by: Dan Liang <dan.liang@intel.com>
OMX: avoid illegal access to NULL pointer in callback.

BZ: 81944

When OMX client gone with exception, in binderDied function it will
remove the corresponding node from mDispatchers array. Callback function
will still go on even if the dispatcher is not found, and causes crash.
Add NULL check to avoid such crash issue.

Category: aosp improvement
Domain: Video.Media-framework
Origin: internal
Upstream-Candidate: yes

Change-Id: I433ebbd0171e7a858b89d12d0c0824471a4b0986
Orig-Change-Id: I43bc25981c8ee9ea30452a9498148be4bd4cc487
Signed-off-by: Dan Liang <dan.liang@intel.com>
Enable video cross process buffer sharing

BZ: 147281

Setup service "media.IntelBufferSharing" for sharing peers

Category: Feature Differentiation
Domain: Video.Media-Framework
Origin: Internal
Upstream-Candidate: No

Change-Id: I217dc10cd7a37e0aacf93a887eb0397c3a1abbe3
Orig-Change-Id: Id787bc6f9892738b66523bf4c7cfe2a79d61857d
Signed-off-by: Zhao Liang <leo.zhao@intel.com>
Reviewed-on: http://android.intel.com:8080/133545
Reviewed-by: Yuan, Shengquan <shengquan.yuan@intel.com>
Tested-by: Post, DavidX J <davidx.j.post@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
Adding free heap when start encode fail.

BZ: 56455

we should hanlde error occur in initialization that calling
MediaSource::stop()when mState equals to LOADED_TO_IDLE,
it means OMXComponet is initializing only in initialization stage.
In addition, we not only stop mediasource, but also free buffer for
OMXCodec ports avoid memory leak.Modifying code style.

Category: aosp improvement
Domain: Video.Media-Framework
Origin: Internal
Upstream-Candidate: Yes

Change-Id: I1fe805721cc9ed65d80432faf034328be0725843
Orig-Change-Id: Ia7869bfd8f01da82d07502fab7956152350fd650
Signed-off-by: Liu Bolun <bolunx.liu@intel.com>
Signed-off-by: Dan Liang <dan.liang@intel.com>
Add two components to MPEG4Extractor

BZ: 113980

The original MPEG4Extractor is lacking the udta components: "titl"
and "perf." Add the two components.
borqsbtx: 22836

Category: aosp improvement
Domain: local playback
Origin: internal
Upstream-Candidate: yes

Change-Id: I765fc100f8882cee6f2b056dc546ec7df36f5996
Orig-Change-Id: Idef8ec9c8ee661da75e13762f6e70a28a50035d9
Signed-off-by: Dan Liang <dan.liang@intel.com>
libmediaplayerservice: postpone seek action if decoders are not established

BZ: 141647

postpone seek action if decoders are not established, or else if client only
parse one track TS packet when seek happened, discontinuity will queue to only one track,
which will cause the audio, video track mismatch and anr happens

Category: aosp improvement
Domain: Video.Media-streaming
Origin: internal
Upstream-Candidate: yes

Change-Id: I0f196a6efacf49d765f3a8e5b89ec44d60746bcc
Orig-Change-Id: Ifbb0b1fe8be32ffbb8c75fe5e8d052acffce9dc3
Signed-off-by: ywan171 <yi.a.wang@intel.com>
Reviewed-on: http://android.intel.com:8080/137463
Reviewed-by: Huang, Yuanjun <yuanjun.huang@intel.com>
Reviewed-by: Shi, PingX <pingx.shi@intel.com>
Tested-by: Shi, PingX <pingx.shi@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
Camera service: fix deadlock

BZ: 104720

Release lock before return from CameraService::dump().

Category: aosp improvement
Domain: camera
Origin: internal
Upstream-Candidate: yes

Change-Id: Ia20b0921fc675a284f3b7f8d26e0e3596b5a8774
Orig-Change-Id: I89d75f13bf82490929eafa1da9e88e7023abfb49
Signed-off-by: Kalle Lampila <kallex.lampila@intel.com>
Change max width and height supported by H.263 decoder.

Currently this is set to CIF PAL resolution (352x288) which
won't calculate the actual output buffer size for higher resolutions

The h.263 decoder needs the max width and height supported to be able
to decode

H.263 decoders supports: QCIF, CIF, D1 and 16CIF; all PAL.

Change-Id: I38664f1fcfbda2b73f3fdc5aca719cbaee803f0e
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
FLACExtractor: Add more sample rates support

In FLACExtractor.cpp, it has function to check file's sample rate.
If the input sample rate is not in its list, it will return "unsupported
sample rate" issue. Modify code to make other sample rates (100,1k,42k,46k)
pass the check

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Issue: AXIA-1441
Change-Id: I48f91119275560ec6d00feb0dedc70d10aa55262
Signed-off-by: Xiaobing Feng <xiaobing.feng@windriver.com>
Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Bugfix for video editor output artifacts caused by improper frame drops.

In the original comparison,
1. pC->pC1->VideoAU.m_CTS is got from metadata of mediabuffer as below
mMediaBuffer->meta_data()->findInt64(kKeyTime,(int64_t*)&tempTime64) /1000
since the kKeyTime is of the us unit so we need do a us to ms conversion, this will lead to a bottom egde align.
2. iCts is got through ((M4OSA_Int32)pC->ewc.dInputVidCts) - pC->pC1->iVoffset - 1;
This needs a double to int conversion.
So in some cases, this compare need at most 1ms adjustment.

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: I4eb0e01423b8f98fd0a39bde42f53a0f4334f84e
Signed-off-by: nluo <ning.luo@intel.com>
Set output filter for all video codecs

It need to set output filter for all kind of video codecs so that render
can get correct resized yuv buffer.

HSD:5179207
Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: Ic488178ae4862bbc9a30e75ddd9984e76bc90066
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
Enable SW Codecs in VideoEditor's PreviewPlayer

fallback to SW codec When there's no related HW codec support and render
the buffer decoded by SW codec into NativeWindowRenderer as external
buffer so that Renderer can do I420->YV12 conversion and get it
rendered by SurfaceFlinger.

HSD:5179207
Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: Ia105f800debf0f768e09a61e1effbec25cbeeee1
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
color issue fixed in VideoEditor

ColorConvert is only needed if OMX Decoder output color format is NOT
I420.

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: Iab7f80f12b32b9de252d5feef7fdddb13eae8394
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
buffer processing logic fix in MPEG4/H263 OMX component

It should immediately start to process in/out buffers if both of
them are available. The original logic will only start to process
in/out buffers if all of output buffers are available, it will cause
OMXCodec read timeout if OMX Client don't release previous decoded
buffer and wait for next decoded buffer.

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: Id637614f103fbe7cd8bbb24baee4eeccb97d42df
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
Fixed Scaling defect in BlackBorder rendering in VideoEditor

In blackborder rendering, when do scaling from 1280x720 to 176x144 or
352x288, the last two interested lines don't contain UV data. Since
Y/U/V width/height need to be even when do scaling, the output height of
AIR need to be multiple of 4 so that it can ensure YUV in area of
interest meet U/V height = 1/2 Y height.

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: I69518fb3cc3e0a5ec45aa1755f3e35b320d9dc03
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
Enable video software decoder render for NuPlayer

CTS verifier test, video cannot display for RTSP streaming when using h263 software decoder.
Integrate SoftwareRender in NuplayerRender, check native window handle in ACodec, if NULL, create
SoftwareRender and send the render object pointer to ACodec. In ACodec, if native window is NULL,
try to get software render to render the decoded buffer directly.

HSD: 5180613
Issue: AXIA-3793

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: I56c1f28767454c88986241bfedcec2c1de836952
Signed-off-by: chenchunbo <chunbo.chen@intel.com>
fix for SW video decoder OMX profile/level query

get the correct profile index from the input param and pass it to
profileLevel array to get the corresponding profile/level

Category: AOSP Enhancement
Domain: MEDIA
Upstream-Candidate: yes

Change-Id: I582961c0afb53c1781af7fb94226a23e5fdb96cf
Signed-off-by: Xiaosong Wei <xiaosong.wei@intel.com>
audioflinger: Implement input nonBT - BT routing

The audio system expects routing to be done in HAL. The
problem is that we have a separate HAL for bluetooth hsp
and we cannot connect the intel HSB audio HAL with
the BT hsp HAL. We overcome this issue by invalidating
the tracks when we change from a nonBT device to a BT device
or from a BT device to a nonBT device. All the audio record
data structures will be created again with the new input.

Issue: APDEV-891
Category: AOSP Improvement
Domain: AOSP-audio
Origin: internal
Upstream-Candidate: No
Depends-Change-Id: Id93c6c3723dc433d4bc1dee4f6123d9bcb37565d
Change-Id: I3c6a66ba43e651f532455d5a054ddd1ceebfb592
Signed-off-by: Constantin Musca <constantin.musca@intel.com>
Add WiDiService trigger point in mediaserver

Instantiating Intel WiDi service from mediaserver. Required
only for Intel Miracast solution.

Category: Feature Differentiation
Upstream-Candidate: No
Domain: WIDI
Issue: APDEV-991
Change-Id: I1f4843df3cbe9240641ce2ab77b1ad6cbee5d77b
Signed-off-by: Sanjay Aghara <sanjay.r.aghara@intel.com>
Signed-off-by: Muralidhar Dixit <muralidhar.m.dixit@intel.com>
Adding Intel WiDiService hook into libmediaplayerservice

Required only for Intel Miracast solution.

Category: Feature Differentiation
Upstream-Candidate: No
Domain: WIDI
Issue: APDEV-991
Change-Id: I0311be659fb205408f5f7210a92c8ca9e0ce6097
Signed-off-by: Sanjay Aghara <sanjay.r.aghara@intel.com>
Signed-off-by: Muralidhar Dixit <muralidhar.m.dixit@intel.com>