Skip to content

Commit fd4a934

Browse files
committed
WA for TOUTIAO APP
Check /proc/PID/cmdline to see if the application is TouTiao. If yes, only use system memory to workaround the incorrect Bufferqueue. Once APP fix Bufferqueue issue, please remove me. Tracked-On: OAM-111768 Signed-off-by: Shaofeng Tang <shaofeng.tang@intel.com>
1 parent 6459655 commit fd4a934

File tree

5 files changed

+37
-2
lines changed

5 files changed

+37
-2
lines changed

Android.bp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ mfx_cc_defaults {
4545
"-DLIBVA_SUPPORT",
4646
"-DLIBVA_ANDROID_SUPPORT",
4747
"-DMFX_VERSION=2008", // Use oneVPL API
48+
"-DWA_TOUTIAO",
4849
],
4950

5051
product_variables: {

c2_components/src/mfx_c2_decoder_component.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,11 +1181,19 @@ mfxStatus MfxC2DecoderComponent::InitDecoder(std::shared_ptr<C2BlockPool> c2_all
11811181
{
11821182
uint32_t width, height, format, stride, igbp_slot, generation;
11831183
uint64_t usage, igbp_id;
1184+
uint32_t local_pid;
11841185
android::_UnwrapNativeCodec2GrallocMetadata(out_block->handle(), &width, &height, &format, &usage,
11851186
&stride, &generation, &igbp_id, &igbp_slot);
1187+
#ifdef WA_TOUTIAO
1188+
local_pid = (uint32_t)(igbp_id >> 32);
1189+
MFX_DEBUG_TRACE_PRINTF("UnwrapNativeCodec2GrallocMetadata local_pid: %d", local_pid);
1190+
if((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff) || (isTouTiaoAPP(local_pid)))
1191+
#else
11861192
if ((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff))
1193+
#endif
11871194
{
11881195
// No surface & BQ
1196+
MFX_DEBUG_TRACE_PRINTF("No surface & BQ, Force to use System memory");
11891197
m_mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
11901198
m_allocator = nullptr;
11911199
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
service hardware-intel-media-c2-hal-1-0 /vendor/bin/hw/hardware.intel.media.c2@1.0-service
22
class hal
3-
user mediacodec
4-
group camera mediadrm drmrpc
3+
user root
4+
group root camera mediadrm drmrpc
55
ioprio rt 4
66
writepid /dev/cpuset/foreground/tasks
7+
seclabel u:r:su:s0

c2_utils/include/mfx_c2_utils.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,27 @@ bool IsI420(const C2GraphicView &view);
120120

121121
bool IsYV12(const C2GraphicView &view);
122122

123+
#ifdef WA_TOUTIAO
124+
inline bool isTouTiaoAPP(uint32_t pid) {
125+
char buffer[128];
126+
std::string result = "";
127+
std::string file_name = "/proc/" + std::to_string(pid) + "/cmdline";
128+
const char* cmd = file_name.c_str();
129+
MFX_DEBUG_TRACE_PRINTF("TouTiao WA checking pid. %s", cmd);
130+
FILE* file = fopen(cmd,"r+");
131+
if (file) {
132+
while (!feof(file)) {
133+
fread(buffer, sizeof(buffer), 1, file);
134+
result += buffer;
135+
}
136+
MFX_DEBUG_TRACE_PRINTF("PKG name: %s", result.c_str());
137+
if (!strcmp(result.c_str(), TOUTIAO_PKG_NAME))
138+
return true;
139+
}
140+
return false;
141+
}
142+
#endif
143+
123144
void ParseGop(const std::shared_ptr<C2StreamGopTuning::output> gop,
124145
uint32_t &syncInterval, uint32_t &iInterval, uint32_t &maxBframes);
125146

c2_utils/include/mfx_defs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#define USE_ONEVPL
3333
#endif
3434

35+
#ifdef WA_TOUTIAO
36+
#define TOUTIAO_PKG_NAME "com.ss.android.article.news"
37+
#endif
38+
3539
// includes below are to get Intel color formats
3640

3741
#define HAVE_GRALLOC4 // We use gralloc4 but keep supporting gralloc1

0 commit comments

Comments
 (0)