Transcoder: Send more granular heartbeats on transcoder start up.
The transcoder watchdog timer starts when a request is sent to
the transcoder. But configuring and starting the transcoder may
delay the first heartbeat under high load. This CL mitigates this
in three ways:
- Send heartbeat during transcoder configuration.
- Send heartbeat when track produce output formats during start.
- Count samples written to the muxer from all track as progress.
Fixes: 183388518
Test: Transcoding unit tests.
Change-Id: I0fe935b33bc0601a0671e6ba39e1e3f528d1132b
diff --git a/media/libmediatranscoding/transcoder/MediaTranscoder.cpp b/media/libmediatranscoding/transcoder/MediaTranscoder.cpp
index 413f049..879241e 100644
--- a/media/libmediatranscoding/transcoder/MediaTranscoder.cpp
+++ b/media/libmediatranscoding/transcoder/MediaTranscoder.cpp
@@ -158,6 +158,11 @@
return;
}
+ // The sample writer is not yet started so notify the caller that progress is still made.
+ if (mHeartBeatIntervalUs > 0) {
+ mCallbacks->onHeartBeat(this);
+ }
+
MediaTrackTranscoder* mutableTranscoder = const_cast<MediaTrackTranscoder*>(transcoder);
mutableTranscoder->setSampleConsumer(consumer);