Broadcast mastervolume intents regardless of whether the system changed the
volume. This fixes the bug where the volume LEDs stop getting updates.
TESTED = runs on Tungsten.
Change-Id: Id363da3f825934fd7785ed3d3e436f74e657b7e6
Stop ANR dialogs from appearing on devices where the ActivityManager dialogs
should not be shown. Instead, kill the process. This is preferable because the
user can't actually do anything on the device.
TESTED = runs on device with that config, simulated ANR using test app.
Change-Id: I6267000afd12ef929f0c625220184c6ab0139552
* commit 'bd26ba4871078aa85024320040de35995e90924b':
docs: update SDK and AVD Manager strings; update android tool doc and update another AVD manager screenshot and finally change "component" to "package" for SDK manager docs
Fix an issue with buffer lifecycle management which could cause audio
pops on timed outputs. There were two issues at work here.
1) During trim operations for the queued timed audio data, buffers
were being trimmed based on their starting PTS instead of when the
chunk of audio data actually ended. This means that if you have a
very large chunk of audio data (larger than the mixer lead time),
then a buffer at the head of the queue could be eligible to be
trimmed before its data had been completely mixed into the output
stream, even though the output stream was fully buffered and in no
danger of underflow.
2) The implementation of getNextBuffer and releaseBuffer for timed
audio tracks was not keeping anything like a reference to the data
that it handed out to the mixer. The original architecture here
seemed to be expecting a ring buffer design, but timed audio tracks
use a packet based design. Pieces of packets are handed out to the
mixer which then frequently will hold onto that chunk of data
across two mix operations, using the first part of the chunk to
finish a mix buffer and then using the end of the chunk for the
start of the next mix buffer. If the buffer that the mixer is
holding a piece of got trimmed before the start of the next mix
operation, it would return to its heap and could be filled with who
knows what by the time it actually got mixed. On debug builds,
they seem to get zero'ed out as they go back to the heap causing
obvious pops in presentation.
This change addresses both issues. Trim operations are now based on
ending presentation time for a chunk of audio, not the start. Also,
when the head of the queue is in flight to the mixer, it can no longer
be trimmed immediately, merely flagged for trim by the mixer when the
mixer finally does call releaseBuffer.
Signed-off-by: John Grossman <johngro@google.com>
Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe
and update another AVD manager screenshot
and finally change "component" to "package" for SDK manager docs
Change-Id: Iae7de7c0264d0cdff4fba0920e50e4637bcf90e0
Immedately release any TX group a player is holding upon entering the
error state. Once in the error state, the only way out for a media
player it to be completely reset (destroying the player at the
tx_player level of things). There is really no point in holding on to
a tx group once the player is in the error state.
Change-Id: If5442a32e012b5596789078b0790ed73fa842629
When an audio decoder signals a format change, we were destroying our
renderer so that a new one could be created with the new format, but
we were not updating our internal format state variables with the new
format information.
This fixes issues with AAC audio with SBR extensions; in particular
content coming from Pandora. Pandora audio is currently being
delivered as AAC-LC decoding to 22.05 KHz, but with an SBR layer which
gives 44.1 KHz. Whether or not you are going to get 22.05 or 44.1
depends on if your decoder supports SBR ("High Efficiency" profile).
Stagefright does not parse the extension sample rate present in the
ESDS; instead it reports the sample rate of the base stream (22050 in
this case). Its only when the decoder decides it can handle SBR that
you get a chance to discover that the content is actually 44.1,
information it delivers via a format change status code during read.
Signed-off-by: John Grossman <johngro@google.com>
Change-Id: I78fb89b4356004d7834629ccc82ca99c4cc7954a
Fix a mistake which came in as part of a merge conflict resolution
during code review of the recent unicast mode refactor of LibAAH_RTP.
Nop packet which were supposed to carry TS transformations for the
pause state accidentally got flagged as Flush operations. The flush
packet successfully carried the TS transformation, but also had the
undesired side effect of constantly flushing the stream.
Change-Id: I4c6aa0043fc274a1d7e880ed1d19cf277f22194b
Signed-off-by: John Grossman <johngro@google.com>
EOS was being treated as a flush operation which was causing problems.
In particular, the transmitter was delcaring that playback was
complete early (by the clock lead time of the system, which was 1
second in this case). Also, the receiver was treating the EOS message
just like the flush message, immediately destroying the substreams
associated with the program without letting them play out first.
Change the transmitter to send the EOS message like it always does,
but have it wait until the media time of the last sample has arrived
before reporting playback complete to the app level of things.
On the receiver side of things, don't treat the EOS message like the
flush message. Instead, have the EOS message simply put the substream
into EOS mode, allowing it to signal EOS to its decoder and shut off
the isAboutToUnderflow hack.
Change-Id: Ibe3ac01044373f83edb7a5f4b70478bd78c16d11
Bionic/Android support eventfd, so there is really no reason to have
PipeEvent around any more. This change gets rid of it in LibAAH_RTP
and replaces it with eventfds.
Change-Id: I841fcb71bf5015d521d7517c69f44eac0ea92278
Signed-off-by: John Grossman <johngro@google.com>
Add support for unicast mode to the AAH RXPlayer. At the API level,
things should be pretty simple. To use unicast mode, instead of
passing the multicast address and port in the data source URL, just
pass the unicast address and port of the transmitters command and
control port. For example, instead of
aahRX://224.128.60.5:8867
one might instead pass
aahRX://192.168.63.5:55476
Change-Id: I7b40716983d7a91def86dcf40f093dda4255aae3
Signed-off-by: John Grossman <johngro@google.com>
Fix a bug discovered while working on adding unicast mode to the TX/RX
players. Also some general cleanup/consolidation regarding timeout
code.
The bug went like this. When a TX player had hit EOS, it would send
an EOS command payload to its receivers. Later, when application
level code shutdown and cleaned up the player, it would send another.
In situations where there is massive packet loss, there is a chance
that not only did both of the EOS packets get dropped, but that they
never got filled in by the retry algorithm because the receiver gave
up on the RTP gap due to an aboutToUnderflow situation in at least one
of its active substreams.
When this happens, there are two major problems. First, all of the
substreams associated with the TX player which has now gone away have
become effectively leaked. They will only get cleaned up if the
entire RTP stream (the TX Group) goes away for 10 seconds or more, or
when the RX Player itself is reset by application level code or a
fatal error. These substreams are holding decoder and renderer
resources which are probably in very short supply, which is a Bad
Thing.
Second, there is now at least one substream in the RX player which is
never going to receive another payload (its TX player source is gone),
but is still considered to be active by the rx player. Assuming that
this substream's program was in the play state when the track ended,
there is now at least one substream which is always
"aboutToUnderflow". From here on out, when the retry algorithm is
attempting to decide whether or not it has the time to attempt to fill
in a gap in the muxed RTP sequence, it always decides that it does not
have the time because of the orphaned substream which is stuck in its
about to underflow state. This effectively means that the retry
algorithm is completely shut off until the rx player gets reset
somehow (something which does not happen during normal operation).
Since the environment had to be extremely lossy to trigger this chain
of events in the first place, and its probably no better now, your
playback is just going to be chock full of gaps which produces
horrible stuttering in the presentation stage of the system.
Two new failsafes have been introduced to keep the double EOS drop
from causing this. First, a timeout has been introduced on the
substream level, in addition to the already existing RTP level
timeout. If a substream fails to receive an activity for 10 seconds
(same timeout as the master RTP timeout), it will be automatically
flushed and purged.
Second, the nature of the master RTP timeout on the transmitter side
has been changed. Instead of just sending an empty NOP command packet
to indicate that the main RTP stream is still alive, the transmitter
now sends a new time of command packet; the Active Program Update
packet. This packet contains a list of all the active program ID
attached to this TX group. Upon receiving one of these APU packets,
RX players reset the inactivity timers for all substreams which are
members of the programs listed in the packet, but they also
immediately purge any substreams associated with programs not present
in the APU.
Between the two of these, no matter how nasty and selective the packet
smashing gremlins in your system happen to be, substreams will always
eventually clean up and avoid getting stuck in a perma-stutter
situation.
Also in this CL:
+ Extract some common utility code into a utils.cpp file so that it
can be shared across the library.
+ Stop using custom timeout logic in the RXPlayer. Instead, use the
common Timeout helper class in utils.cpp.
Signed-off-by: John Grossman <johngro@google.com>
Change-Id: I350869942074f2cae020f719c2911d9092ba8055
Significantly refactor the TXGroup code to allow transmit groups to
operate in a unicast fanout mode in addition to the traditional pure
multicast mode. Important changes include...
+ Each transmit group active in the system now has its own socket to
send and receive traffic on. In the past, this socket was used to
listen for retry requests from clients. Now it is also used to
listen for group membership reports (IGMPv3 style) from unicast
clients. Having an individual socket per transmit group allows
unicast clients to join the group needing only the IP address and
port of the transmitters socket, and not needing any additional
"group id" to be sent to the client beforehand.
+ Setup for the transmitter is now slightly different. As before, to
setup for multicast mode, a user can call setRetransmitEndpoint
passing an IPv4 multicast address and specific port to transmit to.
It used to also be the case that a user could pass a specific
unicast address and port to transmit to as well. This is no longer
allowed. Instead, to operate in unicast mode, a user passes 0.0.0.0
(IPADDR_ANY) as the IP address. In addition, they need to pass
either 0 for a port to create a new unicast mode TX group, or they
need to pass a specific port to cause the player to attempt to use
an existing unicast mode TX group. The specific port should be the
command and control port of the TX group which was bound to when the
group was originally created.
+ A magic invoke was added to allow clients to fetch the command and
control port on which a TX Player's TX Group is listening.
The API described above is most likely temporary and should eventually
be replaced with one where TX groups are formal top level objects with
their own independent interface and life-cycle management.
Signed-off-by: John Grossman <johngro@google.com>
Change-Id: Ib4e9737c10660d36c50f1825c9824fff5390b1c7