get Decoder Stats
Retrieves decoder statistics for the current playback session.
This method sends a command to the remote player service to collect decoder performance data for both video and audio streams. The result includes statistics such as buffer usage and bitrate estimates, and is useful for diagnostics and performance monitoring.
If the operation is successful, the returned Bundle will contain:
- "videoStat" (Bundle): Video decoder metrics.
- "audioStat" (Bundle): Audio decoder metrics.
Each of these nested bundles may include keys such as:
- "input_buffer_count" - Number of input buffers queued to the decoder.
- "rendered_output_buffer_count" - Number of output buffers rendered.
- "dropped_buffer_count" - Number of output buffers dropped.
- "bitrate" - Estimated bitrate in bits per second.
- "elapsed_ms" - Total elapsed time in milliseconds for the data transfer, as measured by the bandwidth meter.
- "bytes_transferred" - Total number of bytes transferred during the session, as measured by the bandwidth meter.
If the service is not connected or if an error occurs (e.g., IPC failure or unsuccessful result), an empty Bundle is returned.
Example usage:
Bundle stats = player.getDecoderStats();
if (stats != null) {
Bundle video = stats.getBundle("videoStat");
if (video != null) {
int dropped = video.getInt("dropped_buffer_count", 0);
long bitrate = video.getLong("bitrate", 0L);
Log.d("Client", "Dropped frames: " + dropped + ", bitrate: " + bitrate);
}
}
Return
A Bundle containing decoder statistics for video and audio, or an empty bundle if retrieval fails or the service is unavailable.
Throws
if the player service is not connected.