Mobile Development 11 min read

Youku Player Architecture Redesign Based on Pipeline Pattern

Youku’s player was rebuilt with a pipeline‑pattern architecture that unifies playback stages into a modular framework, enabling plug‑in customization, multi‑source support, reduced memory and startup overhead, clearer structure, and improved stability and extensibility for future business innovations.

Youku Technology
Youku Technology
Youku Technology
Youku Player Architecture Redesign Based on Pipeline Pattern

As the most frequently used and longest-staying window in Youku APP, the player has always carried users' most direct content consumption experience, product innovation, and business breakthrough capabilities. With long-term function iteration and business accumulation, the player architecture is becoming increasingly inadequate in facing existing experience optimization and business support, urgently requiring a comprehensive architecture upgrade.

After multiple trade-offs, the architecture design based on Pipeline pattern was finally determined to achieve easy-to-use, open, customizable goals with clear structure, low power consumption, and good stability.

Design Goals:

Reduce redundant logic in some playback chains, reduce function calls, reduce link layers, and improve startup speed;

Unify multiple copies of memory and file storage, improve decoding and rendering reuse, reduce player memory and thread resource consumption, and improve stability;

Open up and customize implementations of modules such as playback source, data download, and post-processing, allowing businesses to insert and implement functional logic in the playback chain according to needs;

From the perspective of overall playback center, optimize the architecture to support foreseeable multi-source and multi-stream business needs, expand quickly, and respond to business in a timely manner;

Realize atomization of functional modules such as downloader, decoder, rendering engine, PCDN, Netcache, and intelligent segments, reduce coupling between modules, facilitate external output, and gradually achieve unit test coverage.

Problems Identified:

Many layers, with some function and state code scattered in different layers, resulting in insufficient maintainability;

Core playback logic and business customization logic are heavily coupled, resulting in insufficient interface usability when supporting and opening to second and third parties, and insufficient configurability;

Insufficient openness and extensibility; for access parties requiring deep customization, there is no quick way to intervene in download and post-processing processes, and there is no unified open capability for specialized processing such as stream merging, stream switching, and frame mixing.

Solution Design:

1. Overall Design: Through analysis, a playback process can be abstracted into several main processes: "playback source request," "stream data download," "stream decoding," "post-processing and rendering," along with supporting facilities like "data埋点中心" (data tracking center) and "configuration center." In the overall architecture, the original multiple-layer implementations are merged into a unified playback framework, with playback capabilities and basic business atomized and plugin-based, managed uniformly by the playback framework with configurable capabilities.

2. Unified Playback Framework: The playback framework layer is responsible for unified management and coordination of various modules, while providing unified API interfaces to the outside. The framework includes: 1) Interface layer providing basic playback uplink/downlink messages, pipeline registration, and module configuration interfaces; 2) State management, context management, timeline management, and multi-instance management modules supporting multi-Period and multi-Source playback sequences; 3) Instance pool module for adaptive management of decoder instances based on device and available resources; 4) Pipeline management module for pipeline registration and binding; 5) Plugin management module supporting custom capability implementations with built-in Youku business capabilities and configurable capabilities.

3. Playback Source Management: The playback source management module abstracts a PlayList structure to support business parties in conveniently implementing playback source merging, playback sequence management, and stream switching for different formats and encoding methods. The main structure includes PlayList as the total playback sequence; each Period node represents a unified timeline playback sequence where all sources under it merge into one timeline; each Period can attach multiple sources supporting videos of the same or different formats and encoding parameters.

4. Cache Pipeline: Cache processing adopts multi-level pipeline processing. Business parties can meet targeted data download optimization through custom implementation of cache middleware and cache filters. In Youku playback scenarios, NetCache and PCDN are implemented as two cache filters for network requests and local storage: 1) Resource storage is divided into three-level cache management, scheduled by the cache pipeline; 2) Business can customize mixed-level cache usage through parameters; 3) The cache pipeline processes different resources by accessing NetCache or PCDN modules when reading or writing storage; 4) Future local disk storage, except for preview needs, will uniformly adopt PCDN storage to improve PCDN sharing rate and effectively reduce costs.

5. Rendering Pipeline: Post-processing and rendering also adopt multi-level pipeline processing. The rendering pipeline module provides multiple rendering Context supports, each binding a decoder and a rendering window, and automatically merges and displays rendering results from multiple Contexts for the same rendering window. Business parties can customize development by implementing rendering middleware and rendering filters for specialized development such as stream mixing, frame mixing, and video effects to meet business and innovation needs.

Thoughts and Summary:

The player and client-side playback chain is a large, complex, and highly comprehensive system, especially in Youku's video-heavy consumption products where player-carrying business continues to grow over time. Without a relatively reasonable and stable architecture design, the complexity of the entire system after long-term iteration is unimaginable. In this architecture transformation, we first extracted the core process of playback as the foundation of the entire architecture, modularized and atomized the capabilities accumulated in the playback center, organized them through a unified playback framework, and combined with future business innovation and development directions, externally opened unified customizable development capabilities, basically achieving the expected transformation goals.

Of course, the transformation of the playback framework is not accomplished overnight. Under the premise of stable core framework, it is necessary to continue promoting the construction of supporting infrastructure such as client-side data center, client-side AI, and full-link monitoring. At the same time, with the development of 5G technology, how to connect client-side and edge nodes, and how to maximize computing resource utilization on client, edge, and cloud, are also directions the playback framework needs to consider and try.

Mobile DevelopmentiOSAndroidvideo-playerrendering pipelineArchitecture DesignPipeline PatternYoukuCache Pipeline
Youku Technology
Written by

Youku Technology

Discover top-tier entertainment technology here.

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.