Mobile Development 18 min read

Baidu APP Android Live Streaming Startup Performance Optimization Practice

To cut Baidu APP Android’s live‑stream startup from over three seconds to about 1.3 seconds, engineers introduced fine‑grained monitoring, switched first‑entry to a lightweight level‑1 plugin, pre‑started the player, scattered initialization tasks, prioritized first‑frame delivery, and balanced plugin pre‑download with full‑load performance.

Baidu Geek Talk
Baidu Geek Talk
Baidu Geek Talk
Baidu APP Android Live Streaming Startup Performance Optimization Practice

This article details the optimization practice for live streaming playback startup time in Baidu APP Android version. Due to plugin-based architecture for package size management, the live streaming function uses a two-level plugin system: a smaller level-1 plugin with core capabilities (playback, IM) built-in, and a larger level-2 plugin for business features (widgets, gifts, likes). This special plugin logic and complex business scenarios caused poor startup performance metrics.

Background and Goals: In Q1 2022, the overall 80th percentile startup time was around 3 seconds, with second-entry (swiping within live room) at about 1 second. After plugin splitting, the first-entry scenario with stream address grew from 1.5s to 2.5s+ within two weeks. The target was set to 1.5 seconds for general scenarios and 1.1 seconds when stream address was pre-obtained.

Key Solutions Implemented:

1. New Monitoring Reports: Designed custom reporting to measure time between any two key nodes in the startup chain, enabling precise identification of time-consuming segments.

2. Level-1 Plugin for First Entry: Modified first-entry logic to use level-1 plugin entirely, reducing multi-layer call overhead from level-2 plugin. Also implemented a live room data request manager to parallelize interface requests with page creation.

3. Pre-starting Player Outside Activity: Created a pre-startup module that initiates player creation and buffering in parallel when user clicks, before the Activity launches. This achieved 450ms+ optimization in 80th percentile startup time.

4. Task Scattering for Live Room: Split large component initialization tasks into smaller individual tasks to avoid blocking the main thread, reducing level-2 plugin component loading time by 40%+.

5. Kernel Sub-thread First Frame Distribution: Implemented sub-thread notification for first frame events, using postAtFrontOfQueue() to prioritize first frame processing, reducing first frame distribution delay.

6. Balancing Startup and Full-load Metrics: Optimized plugin pre-download and component initialization prioritization to improve full-load metrics without degrading startup performance.

Results: After optimization, the overall startup time decreased from 3s+ to approximately 1.3s; first-entry with stream address dropped from 2.5s+ to under 1s; second-entry reduced from 1s+ to under 700ms.

Mobile DevelopmentLive StreamingPlugin Architectureperformance monitoringFirst Frame OptimizationAndroid Performance OptimizationBaidu AppStartup Time Optimization
Baidu Geek Talk
Written by

Baidu Geek Talk

Follow us to discover more Baidu tech insights.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.