2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-24 17:16:59 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_AUDIO_H_
|
|
|
|
|
#define MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_AUDIO_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2012-01-19 15:53:59 +00:00
|
|
|
#include <set>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_receiver.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_receiver_strategy.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
|
|
|
|
#include "rtc_base/onetimeevent.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2012-12-13 10:48:24 +00:00
|
|
|
// Handles audio RTP packets. This class is thread-safe.
|
2016-09-22 03:36:27 -07:00
|
|
|
class RTPReceiverAudio : public RTPReceiverStrategy,
|
|
|
|
|
public TelephoneEventHandler {
|
2013-02-05 15:12:39 +00:00
|
|
|
public:
|
2016-03-30 02:42:32 -07:00
|
|
|
explicit RTPReceiverAudio(RtpData* data_callback);
|
2018-02-07 09:38:31 +01:00
|
|
|
~RTPReceiverAudio() override;
|
2013-07-16 19:25:04 +00:00
|
|
|
|
RTPReceiverAudio: Removed frequency from CNGPayloadType and cleaned up
CheckPayloadChanged.
Removed last_received_frequency_, cng_payload_type_,
g722_payload_type_ and last_received_g722_ from RTPReceiverAudio and
cleaned up most of the related, now dead code.
Since g722_payload_type_ was never set, neither was
last_received_g722_, which means the frequency change in
CNGPayloadType was never done. Setting the frequency to the standard
values also proved unnecessary, since they were already set before the
call. Even if frequency would have been changed by RTPReceiverAudio, I
was not able to find a place where that would actually have
mattered. The ACM and NetEq, for example, which eventually gets these
packages, don't care about that value.
Also, GetPayloadTypeFrequency was never called, so keeping track of
last_received_frequency_ proved unnecessary.
cng_payload_type_ was stored to be able to check in CNGPayloadType if
cng_payload_type_has_changed. This flag was also never read, so these
all disappear.
The main reason for starting this change was to root out any G722
specific code we have sprinkled around the code base (specifically
dealing with the fact that for G722 clock rate != sample rate). In
this case, once I started pulling at one end of the string, the whole
thing came unraveled.
BUG=webrtc:5805
Review-Url: https://codereview.webrtc.org/2383103002
Cr-Commit-Position: refs/heads/master@{#14530}
2016-10-05 08:44:22 -07:00
|
|
|
// Is TelephoneEvent configured with |payload_type|.
|
2016-09-22 03:36:27 -07:00
|
|
|
bool TelephoneEventPayloadType(const int8_t payload_type) const override;
|
|
|
|
|
|
2018-02-07 09:38:31 +01:00
|
|
|
TelephoneEventHandler* GetTelephoneEventHandler() override;
|
2013-08-15 23:38:54 +00:00
|
|
|
|
RTPReceiverAudio: Removed frequency from CNGPayloadType and cleaned up
CheckPayloadChanged.
Removed last_received_frequency_, cng_payload_type_,
g722_payload_type_ and last_received_g722_ from RTPReceiverAudio and
cleaned up most of the related, now dead code.
Since g722_payload_type_ was never set, neither was
last_received_g722_, which means the frequency change in
CNGPayloadType was never done. Setting the frequency to the standard
values also proved unnecessary, since they were already set before the
call. Even if frequency would have been changed by RTPReceiverAudio, I
was not able to find a place where that would actually have
mattered. The ACM and NetEq, for example, which eventually gets these
packages, don't care about that value.
Also, GetPayloadTypeFrequency was never called, so keeping track of
last_received_frequency_ proved unnecessary.
cng_payload_type_ was stored to be able to check in CNGPayloadType if
cng_payload_type_has_changed. This flag was also never read, so these
all disappear.
The main reason for starting this change was to root out any G722
specific code we have sprinkled around the code base (specifically
dealing with the fact that for G722 clock rate != sample rate). In
this case, once I started pulling at one end of the string, the whole
thing came unraveled.
BUG=webrtc:5805
Review-Url: https://codereview.webrtc.org/2383103002
Cr-Commit-Position: refs/heads/master@{#14530}
2016-10-05 08:44:22 -07:00
|
|
|
// Returns true if CNG is configured with |payload_type|.
|
|
|
|
|
bool CNGPayloadType(const int8_t payload_type);
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const PayloadUnion& specific_payload,
|
|
|
|
|
const uint8_t* packet,
|
|
|
|
|
size_t payload_length,
|
2017-09-26 14:05:05 +02:00
|
|
|
int64_t timestamp_ms) override;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2017-10-04 12:38:53 +02:00
|
|
|
int32_t OnNewPayloadTypeCreated(int payload_type,
|
|
|
|
|
const SdpAudioFormat& audio_format) override;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
|
|
|
|
// We need to look out for special payload types here and sometimes reset
|
|
|
|
|
// statistics. In addition we sometimes need to tweak the frequency.
|
2013-08-15 23:38:54 +00:00
|
|
|
void CheckPayloadChanged(int8_t payload_type,
|
|
|
|
|
PayloadUnion* specific_payload,
|
2015-03-04 12:58:35 +00:00
|
|
|
bool* should_discard_changes) override;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-12-10 02:39:40 -08:00
|
|
|
int32_t ParseAudioCodecSpecific(WebRtcRTPHeader* rtp_header,
|
|
|
|
|
const uint8_t* payload_data,
|
|
|
|
|
size_t payload_length,
|
2018-03-14 11:27:26 +01:00
|
|
|
const AudioPayload& audio_specific);
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int8_t telephone_event_payload_type_;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2013-04-08 11:08:41 +00:00
|
|
|
int8_t cng_nb_payload_type_;
|
|
|
|
|
int8_t cng_wb_payload_type_;
|
|
|
|
|
int8_t cng_swb_payload_type_;
|
|
|
|
|
int8_t cng_fb_payload_type_;
|
2013-02-05 15:12:39 +00:00
|
|
|
|
2016-04-07 15:36:45 -07:00
|
|
|
ThreadUnsafeOneTimeEvent first_packet_received_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2013-02-05 15:12:39 +00:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_AUDIO_H_
|