Adds a histogram metric tracking for how long audio RTP packets are sent

through streams related to a call object.

The Call object does not know directly when packets pass through it, only which
AudioSendStreams are used. Each AudioSendStream has a pointer to the Transport
object through which its packets are send.

This CL:
By registering an internal wrapper class, TimedTransport, the AudioSendStream
can stay up-to-date on when packets have passed through its Transport. This
lifetime (as an interval) is then queried by the Call when the AudioSendStream
is destroyed. When Call is destroyed, all streams are guaranteed to have been
destroyed and hence Call is up-to-date on packet activity.

The class TimeInterval keeps the code in Call and AudioSendStream smaller, with
fewer get methods in their APIs and less code for updating values.

Also modifies the unit test for AudioSendStream: it previously enforced that
the stream registers (with its channel proxy) the same transport that it was
constructed with.

BUG=webrtc:7882

Review-Url: https://codereview.webrtc.org/2979833002
Cr-Commit-Position: refs/heads/master@{#19087}
This commit is contained in:
saza
2017-07-19 00:39:19 -07:00
committed by Commit Bot
parent e1d4dcaaa9
commit c58f8c0962
7 changed files with 223 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include "webrtc/audio/time_interval.h"
#include "webrtc/call/audio_send_stream.h"
#include "webrtc/call/audio_state.h"
#include "webrtc/call/bitrate_allocator.h"
@ -76,8 +77,11 @@ class AudioSendStream final : public webrtc::AudioSendStream,
void SetTransportOverhead(int transport_overhead_per_packet);
RtpState GetRtpState() const;
const TimeInterval& GetActiveLifetime() const;
private:
class TimedTransport;
VoiceEngine* voice_engine() const;
// These are all static to make it less likely that (the old) config_ is
@ -117,6 +121,9 @@ class AudioSendStream final : public webrtc::AudioSendStream,
RtpRtcp* rtp_rtcp_module_;
rtc::Optional<RtpState> const suspended_rtp_state_;
std::unique_ptr<TimedTransport> timed_send_transport_adapter_;
TimeInterval active_lifetime_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
};
} // namespace internal