mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 11:58:55 +00:00
Bug 1225722 - Implement getters in the conduits for currently active payload types. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D135866
This commit is contained in:
parent
64bad5940a
commit
d78a1f4edd
@ -875,4 +875,34 @@ void WebrtcAudioConduit::DeliverPacket(rtc::CopyOnWriteBuffer packet,
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<int> WebrtcAudioConduit::ActiveSendPayloadType() const {
|
||||
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
|
||||
|
||||
auto stats = GetSenderStats();
|
||||
if (!stats) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
if (!stats->codec_payload_type) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
return Some(*stats->codec_payload_type);
|
||||
}
|
||||
|
||||
Maybe<int> WebrtcAudioConduit::ActiveRecvPayloadType() const {
|
||||
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
|
||||
|
||||
auto stats = GetReceiverStats();
|
||||
if (!stats) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
if (!stats->codec_payload_type) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
return Some(*stats->codec_payload_type);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -29,6 +29,9 @@ struct DtmfEvent;
|
||||
class WebrtcAudioConduit : public AudioSessionConduit,
|
||||
public webrtc::RtcpEventObserver {
|
||||
public:
|
||||
Maybe<int> ActiveSendPayloadType() const override;
|
||||
Maybe<int> ActiveRecvPayloadType() const override;
|
||||
|
||||
void OnRtpReceived(MediaPacket&& aPacket, webrtc::RTPHeader&& aHeader);
|
||||
void OnRtcpReceived(MediaPacket&& aPacket);
|
||||
|
||||
|
@ -115,6 +115,10 @@ class MediaSessionConduit {
|
||||
|
||||
virtual Type type() const = 0;
|
||||
|
||||
// Call thread only
|
||||
virtual Maybe<int> ActiveSendPayloadType() const = 0;
|
||||
virtual Maybe<int> ActiveRecvPayloadType() const = 0;
|
||||
|
||||
// Whether transport is currently sending and receiving packets
|
||||
virtual void SetTransportActive(bool aActive) = 0;
|
||||
|
||||
|
@ -1892,4 +1892,33 @@ bool WebrtcVideoConduit::HasH264Hardware() {
|
||||
status == nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
|
||||
Maybe<int> WebrtcVideoConduit::ActiveSendPayloadType() const {
|
||||
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
|
||||
|
||||
if (!mSendStream) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
if (mSendStreamConfig.rtp.payload_type == -1) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
return Some(mSendStreamConfig.rtp.payload_type);
|
||||
}
|
||||
|
||||
Maybe<int> WebrtcVideoConduit::ActiveRecvPayloadType() const {
|
||||
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
|
||||
|
||||
auto stats = GetReceiverStats();
|
||||
if (!stats) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
if (stats->current_payload_type == -1) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
return Some(stats->current_payload_type);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -71,6 +71,9 @@ class WebrtcVideoConduit
|
||||
// Returns true when both encoder and decoder are HW accelerated.
|
||||
static bool HasH264Hardware();
|
||||
|
||||
Maybe<int> ActiveSendPayloadType() const override;
|
||||
Maybe<int> ActiveRecvPayloadType() const override;
|
||||
|
||||
/**
|
||||
* Function to attach Renderer end-point for the Media-Video conduit.
|
||||
* @param aRenderer : Reference to the concrete mozilla Video renderer
|
||||
|
@ -24,6 +24,8 @@ class MockConduit : public MediaSessionConduit {
|
||||
MockConduit() = default;
|
||||
|
||||
MOCK_CONST_METHOD0(type, Type());
|
||||
MOCK_CONST_METHOD0(ActiveSendPayloadType, Maybe<int>());
|
||||
MOCK_CONST_METHOD0(ActiveRecvPayloadType, Maybe<int>());
|
||||
MOCK_METHOD1(SetTransportActive, void(bool));
|
||||
MOCK_METHOD0(SenderRtpSendEvent, MediaEventSourceExc<MediaPacket>&());
|
||||
MOCK_METHOD0(SenderRtcpSendEvent, MediaEventSourceExc<MediaPacket>&());
|
||||
|
Loading…
x
Reference in New Issue
Block a user