Description[cast] Allow audio encoder implementations to specify the frame length.
The previous implementation hardcoded 100 audio frames per second, which
yielded 10ms frames. In this context, frame is understood as a grouping
of audio samples (across all channels) sent to the receiver in some
format (raw PCM or encoded/compressed) with an associated RTP timestamp.
The implementation accumulates samples submitted by the sender in a
buffer until it has |frame duration| samples, after which it encodes the
samples and sends the data.
10ms is conveniently one of the supported Opus frame lengths. It
obviously also worka for raw PCM. However, other codecs may have
different frame lengths. In particular, AAC uses 1024 or 960 samples
frames, regardless of the sampling rate.
This patch changes the audio encoder to allow implementations to specify
the number of samples per Cast audio frame. Existing implementations
specify |sampling_rate / 100|, which yields the same 10ms length
regardless of sampling rate. An AAC implementation could specify 1024 or
960 instead.
BUG=417861
Committed: https://crrev.com/488b1dc973220b5f529fa95955c14961502c0269
Cr-Commit-Position: refs/heads/master@{#301011}
Patch Set 1 #
Total comments: 10
Patch Set 2 : Derive the max_frame_rate of the audio sender from the encoder and address review feedback. #Patch Set 3 : Query the frame duration and samples per frame from the encoder in the audio encoder unit tests. #
Total comments: 1
Patch Set 4 : Remove '(or packet)' from comment and rebase. #Patch Set 5 : Move inline namespace back inside media::cast to better match original file. #
Messages
Total messages: 11 (2 generated)
|