2013-08-15 23:38:54 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/source/rtp_receiver_impl.h"
|
2013-08-15 23:38:54 +00:00
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
#include <set>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 13:58:09 +02:00
|
|
|
#include "common_types.h" // NOLINT(build/include)
|
2017-10-04 12:38:53 +02:00
|
|
|
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
2017-10-05 08:39:15 +02:00
|
|
|
#include "modules/include/module_common_types.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_payload_registry.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_receiver_strategy.h"
|
|
|
|
|
#include "rtc_base/logging.h"
|
2013-08-15 23:38:54 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-10-05 08:39:15 +02:00
|
|
|
namespace {
|
2018-06-14 12:59:38 +02:00
|
|
|
bool InOrderPacket(absl::optional<uint16_t> latest_sequence_number,
|
2017-10-05 08:39:15 +02:00
|
|
|
uint16_t current_sequence_number) {
|
|
|
|
|
if (!latest_sequence_number)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// We need to distinguish between a late or retransmitted packet,
|
|
|
|
|
// and a sequence number discontinuity.
|
|
|
|
|
if (IsNewerSequenceNumber(current_sequence_number, *latest_sequence_number)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
// If we have a restart of the remote side this packet is still in order.
|
|
|
|
|
return !IsNewerSequenceNumber(
|
|
|
|
|
current_sequence_number,
|
|
|
|
|
*latest_sequence_number - kDefaultMaxReorderingThreshold);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2014-07-08 12:10:51 +00:00
|
|
|
using RtpUtility::Payload;
|
2013-08-15 23:38:54 +00:00
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
// Only return the sources in the last 10 seconds.
|
|
|
|
|
const int64_t kGetSourcesTimeoutMs = 10000;
|
|
|
|
|
|
2013-08-15 23:38:54 +00:00
|
|
|
RtpReceiver* RtpReceiver::CreateVideoReceiver(
|
2015-09-17 23:03:57 +02:00
|
|
|
Clock* clock,
|
2013-08-15 23:38:54 +00:00
|
|
|
RtpData* incoming_payload_callback,
|
|
|
|
|
RTPPayloadRegistry* rtp_payload_registry) {
|
2017-06-01 00:30:55 -07:00
|
|
|
RTC_DCHECK(incoming_payload_callback != nullptr);
|
2013-08-15 23:38:54 +00:00
|
|
|
return new RtpReceiverImpl(
|
2018-05-25 13:41:10 +02:00
|
|
|
clock, rtp_payload_registry,
|
2014-04-08 11:06:12 +00:00
|
|
|
RTPReceiverStrategy::CreateVideoStrategy(incoming_payload_callback));
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RtpReceiver* RtpReceiver::CreateAudioReceiver(
|
2015-09-17 23:03:57 +02:00
|
|
|
Clock* clock,
|
2013-08-15 23:38:54 +00:00
|
|
|
RtpData* incoming_payload_callback,
|
|
|
|
|
RTPPayloadRegistry* rtp_payload_registry) {
|
2017-06-01 00:30:55 -07:00
|
|
|
RTC_DCHECK(incoming_payload_callback != nullptr);
|
2013-08-15 23:38:54 +00:00
|
|
|
return new RtpReceiverImpl(
|
2018-05-25 13:41:10 +02:00
|
|
|
clock, rtp_payload_registry,
|
2016-03-30 02:42:32 -07:00
|
|
|
RTPReceiverStrategy::CreateAudioStrategy(incoming_payload_callback));
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-04 12:38:53 +02:00
|
|
|
int32_t RtpReceiver::RegisterReceivePayload(const CodecInst& audio_codec) {
|
|
|
|
|
return RegisterReceivePayload(audio_codec.pltype,
|
|
|
|
|
CodecInstToSdp(audio_codec));
|
|
|
|
|
}
|
|
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
RtpReceiverImpl::RtpReceiverImpl(Clock* clock,
|
|
|
|
|
RTPPayloadRegistry* rtp_payload_registry,
|
|
|
|
|
RTPReceiverStrategy* rtp_media_receiver)
|
2013-08-15 23:38:54 +00:00
|
|
|
: clock_(clock),
|
|
|
|
|
rtp_payload_registry_(rtp_payload_registry),
|
|
|
|
|
rtp_media_receiver_(rtp_media_receiver),
|
|
|
|
|
ssrc_(0),
|
|
|
|
|
num_csrcs_(0),
|
|
|
|
|
current_remote_csrc_(),
|
|
|
|
|
last_received_timestamp_(0),
|
2017-09-26 14:05:05 +02:00
|
|
|
last_received_frame_time_ms_(-1) {
|
2013-08-15 23:38:54 +00:00
|
|
|
memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_));
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-23 08:54:34 +01:00
|
|
|
RtpReceiverImpl::~RtpReceiverImpl() {}
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2017-10-04 12:38:53 +02:00
|
|
|
int32_t RtpReceiverImpl::RegisterReceivePayload(
|
|
|
|
|
int payload_type,
|
|
|
|
|
const SdpAudioFormat& audio_format) {
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
|
|
|
|
// TODO(phoglund): Try to streamline handling of the RED codec and some other
|
|
|
|
|
// cases which makes it necessary to keep track of whether we created a
|
|
|
|
|
// payload or not.
|
|
|
|
|
bool created_new_payload = false;
|
|
|
|
|
int32_t result = rtp_payload_registry_->RegisterReceivePayload(
|
2017-10-04 12:38:53 +02:00
|
|
|
payload_type, audio_format, &created_new_payload);
|
2013-08-15 23:38:54 +00:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-25 02:29:39 -08:00
|
|
|
int32_t RtpReceiverImpl::RegisterReceivePayload(const VideoCodec& video_codec) {
|
|
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
|
|
|
|
return rtp_payload_registry_->RegisterReceivePayload(video_codec);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 23:38:54 +00:00
|
|
|
int32_t RtpReceiverImpl::DeRegisterReceivePayload(const int8_t payload_type) {
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2013-08-15 23:38:54 +00:00
|
|
|
return rtp_payload_registry_->DeRegisterReceivePayload(payload_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t RtpReceiverImpl::SSRC() const {
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2013-08-15 23:38:54 +00:00
|
|
|
return ssrc_;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 08:39:15 +02:00
|
|
|
bool RtpReceiverImpl::IncomingRtpPacket(const RTPHeader& rtp_header,
|
|
|
|
|
const uint8_t* payload,
|
|
|
|
|
size_t payload_length,
|
|
|
|
|
PayloadUnion payload_specific) {
|
2013-08-15 23:38:54 +00:00
|
|
|
// Trigger our callbacks.
|
|
|
|
|
CheckSSRCChanged(rtp_header);
|
|
|
|
|
|
2018-08-06 12:40:58 +02:00
|
|
|
if (payload_length == 0) {
|
|
|
|
|
// OK, keep-alive packet.
|
|
|
|
|
return true;
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
2018-07-09 15:52:29 +02:00
|
|
|
WebRtcRTPHeader webrtc_rtp_header{};
|
2013-09-06 13:40:11 +00:00
|
|
|
webrtc_rtp_header.header = rtp_header;
|
|
|
|
|
CheckCSRC(webrtc_rtp_header);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2017-08-24 14:52:17 -07:00
|
|
|
auto audio_level =
|
|
|
|
|
rtp_header.extension.hasAudioLevel
|
2018-06-14 12:59:38 +02:00
|
|
|
? absl::optional<uint8_t>(rtp_header.extension.audioLevel)
|
|
|
|
|
: absl::nullopt;
|
2017-08-24 14:52:17 -07:00
|
|
|
UpdateSources(audio_level);
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
|
2013-08-15 23:38:54 +00:00
|
|
|
int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
|
2018-03-14 11:27:26 +01:00
|
|
|
&webrtc_rtp_header, payload_specific, payload, payload_length,
|
2017-09-26 14:05:05 +02:00
|
|
|
clock_->TimeInMilliseconds());
|
2013-08-15 23:38:54 +00:00
|
|
|
|
|
|
|
|
if (ret_val < 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2017-10-05 08:39:15 +02:00
|
|
|
// TODO(nisse): Do not rely on InOrderPacket for recovered packets, when
|
|
|
|
|
// packet is passed as RtpPacketReceived and that information is available.
|
|
|
|
|
// We should ideally never record timestamps for retransmitted or recovered
|
|
|
|
|
// packets.
|
|
|
|
|
if (InOrderPacket(last_received_sequence_number_,
|
|
|
|
|
rtp_header.sequenceNumber)) {
|
|
|
|
|
last_received_sequence_number_.emplace(rtp_header.sequenceNumber);
|
|
|
|
|
last_received_timestamp_ = rtp_header.timestamp;
|
|
|
|
|
last_received_frame_time_ms_ = clock_->TimeInMilliseconds();
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
2017-10-05 08:39:15 +02:00
|
|
|
|
2013-08-15 23:38:54 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
std::vector<RtpSource> RtpReceiverImpl::GetSources() const {
|
2017-04-11 11:28:10 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
|
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
int64_t now_ms = clock_->TimeInMilliseconds();
|
|
|
|
|
std::vector<RtpSource> sources;
|
|
|
|
|
|
2017-04-11 11:28:10 -07:00
|
|
|
RTC_DCHECK(std::is_sorted(ssrc_sources_.begin(), ssrc_sources_.end(),
|
|
|
|
|
[](const RtpSource& lhs, const RtpSource& rhs) {
|
|
|
|
|
return lhs.timestamp_ms() < rhs.timestamp_ms();
|
|
|
|
|
}));
|
|
|
|
|
RTC_DCHECK(std::is_sorted(csrc_sources_.begin(), csrc_sources_.end(),
|
|
|
|
|
[](const RtpSource& lhs, const RtpSource& rhs) {
|
|
|
|
|
return lhs.timestamp_ms() < rhs.timestamp_ms();
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
std::set<uint32_t> selected_ssrcs;
|
|
|
|
|
for (auto rit = ssrc_sources_.rbegin(); rit != ssrc_sources_.rend(); ++rit) {
|
|
|
|
|
if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
|
|
|
|
|
break;
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
}
|
2017-04-11 11:28:10 -07:00
|
|
|
if (selected_ssrcs.insert(rit->source_id()).second) {
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
sources.push_back(*rit);
|
|
|
|
|
}
|
2017-04-11 11:28:10 -07:00
|
|
|
}
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
|
2017-04-11 11:28:10 -07:00
|
|
|
for (auto rit = csrc_sources_.rbegin(); rit != csrc_sources_.rend(); ++rit) {
|
|
|
|
|
if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
sources.push_back(*rit);
|
|
|
|
|
}
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
return sources;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-03 15:28:26 +02:00
|
|
|
bool RtpReceiverImpl::GetLatestTimestamps(uint32_t* timestamp,
|
|
|
|
|
int64_t* receive_time_ms) const {
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2017-10-05 08:39:15 +02:00
|
|
|
if (!last_received_sequence_number_)
|
2013-11-08 15:18:52 +00:00
|
|
|
return false;
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2017-10-03 15:28:26 +02:00
|
|
|
*timestamp = last_received_timestamp_;
|
2013-11-08 15:18:52 +00:00
|
|
|
*receive_time_ms = last_received_frame_time_ms_;
|
|
|
|
|
|
2017-10-03 15:28:26 +02:00
|
|
|
return true;
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
2018-05-25 13:41:10 +02:00
|
|
|
// TODO(nisse): Delete.
|
2013-08-15 23:38:54 +00:00
|
|
|
// Implementation note: must not hold critsect when called.
|
2013-09-06 13:40:11 +00:00
|
|
|
void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
|
2018-05-25 13:41:10 +02:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
|
|
|
|
ssrc_ = rtp_header.ssrc;
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Implementation note: must not hold critsect when called.
|
2013-09-06 13:40:11 +00:00
|
|
|
void RtpReceiverImpl::CheckCSRC(const WebRtcRTPHeader& rtp_header) {
|
2018-03-23 08:54:34 +01:00
|
|
|
const uint8_t num_csrcs = rtp_header.header.numCSRCs;
|
|
|
|
|
if (num_csrcs > kRtpCsrcSize) {
|
|
|
|
|
// Ignore.
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-08-15 23:38:54 +00:00
|
|
|
{
|
2016-04-14 03:05:31 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2018-03-23 08:54:34 +01:00
|
|
|
// Copy new.
|
|
|
|
|
memcpy(current_remote_csrc_, rtp_header.header.arrOfCSRCs,
|
|
|
|
|
num_csrcs * sizeof(uint32_t));
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2018-03-23 08:54:34 +01:00
|
|
|
num_csrcs_ = num_csrcs;
|
|
|
|
|
} // End critsect.
|
2013-08-15 23:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
2017-08-24 14:52:17 -07:00
|
|
|
void RtpReceiverImpl::UpdateSources(
|
2018-06-14 12:59:38 +02:00
|
|
|
const absl::optional<uint8_t>& ssrc_audio_level) {
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
|
|
|
|
int64_t now_ms = clock_->TimeInMilliseconds();
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < num_csrcs_; ++i) {
|
|
|
|
|
auto map_it = iterator_by_csrc_.find(current_remote_csrc_[i]);
|
|
|
|
|
if (map_it == iterator_by_csrc_.end()) {
|
|
|
|
|
// If it is a new CSRC, append a new object to the end of the list.
|
|
|
|
|
csrc_sources_.emplace_back(now_ms, current_remote_csrc_[i],
|
|
|
|
|
RtpSourceType::CSRC);
|
|
|
|
|
} else {
|
|
|
|
|
// If it is an existing CSRC, move the object to the end of the list.
|
|
|
|
|
map_it->second->update_timestamp_ms(now_ms);
|
|
|
|
|
csrc_sources_.splice(csrc_sources_.end(), csrc_sources_, map_it->second);
|
|
|
|
|
}
|
|
|
|
|
// Update the unordered_map.
|
|
|
|
|
iterator_by_csrc_[current_remote_csrc_[i]] = std::prev(csrc_sources_.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If this is the first packet or the SSRC is changed, insert a new
|
|
|
|
|
// contributing source that uses the SSRC.
|
|
|
|
|
if (ssrc_sources_.empty() || ssrc_sources_.rbegin()->source_id() != ssrc_) {
|
|
|
|
|
ssrc_sources_.emplace_back(now_ms, ssrc_, RtpSourceType::SSRC);
|
|
|
|
|
} else {
|
|
|
|
|
ssrc_sources_.rbegin()->update_timestamp_ms(now_ms);
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-24 14:52:17 -07:00
|
|
|
ssrc_sources_.back().set_audio_level(ssrc_audio_level);
|
|
|
|
|
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
RemoveOutdatedSources(now_ms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RtpReceiverImpl::RemoveOutdatedSources(int64_t now_ms) {
|
|
|
|
|
std::list<RtpSource>::iterator it;
|
|
|
|
|
for (it = csrc_sources_.begin(); it != csrc_sources_.end(); ++it) {
|
|
|
|
|
if ((now_ms - it->timestamp_ms()) <= kGetSourcesTimeoutMs) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
iterator_by_csrc_.erase(it->source_id());
|
|
|
|
|
}
|
|
|
|
|
csrc_sources_.erase(csrc_sources_.begin(), it);
|
|
|
|
|
|
|
|
|
|
std::vector<RtpSource>::iterator vec_it;
|
|
|
|
|
for (vec_it = ssrc_sources_.begin(); vec_it != ssrc_sources_.end();
|
|
|
|
|
++vec_it) {
|
|
|
|
|
if ((now_ms - vec_it->timestamp_ms()) <= kGetSourcesTimeoutMs) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ssrc_sources_.erase(ssrc_sources_.begin(), vec_it);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 23:38:54 +00:00
|
|
|
} // namespace webrtc
|