Split out RtpSource from libjingle_peerconnection_api

And moved declaration into a new api directory, as
api/transport/rtp/rtp_source.h.

Bug: webrtc:8733
Change-Id: Ia73b7b0630e6065de4707a37633adddfa00a2b8a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150880
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29039}
This commit is contained in:
Niels Möller
2019-09-02 15:16:49 +02:00
committed by Commit Bot
parent d112c75801
commit a837030f8f
20 changed files with 124 additions and 76 deletions

View File

@ -177,6 +177,7 @@ rtc_static_library("libjingle_peerconnection_api") {
"transport:network_control",
"transport/media:audio_interfaces",
"transport/media:video_interfaces",
"transport/rtp:rtp_source",
"units:data_rate",
"units:timestamp",
"video:encoded_image",

View File

@ -12,21 +12,6 @@
namespace webrtc {
RtpSource::RtpSource(int64_t timestamp_ms,
uint32_t source_id,
RtpSourceType source_type,
absl::optional<uint8_t> audio_level,
uint32_t rtp_timestamp)
: timestamp_ms_(timestamp_ms),
source_id_(source_id),
source_type_(source_type),
audio_level_(audio_level),
rtp_timestamp_(rtp_timestamp) {}
RtpSource::RtpSource(const RtpSource&) = default;
RtpSource& RtpSource::operator=(const RtpSource&) = default;
RtpSource::~RtpSource() = default;
std::vector<std::string> RtpReceiverInterface::stream_ids() const {
return {};
}

View File

@ -24,63 +24,12 @@
#include "api/proxy.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/transport/rtp/rtp_source.h"
#include "rtc_base/deprecation.h"
#include "rtc_base/ref_count.h"
namespace webrtc {
enum class RtpSourceType {
SSRC,
CSRC,
};
class RtpSource {
public:
RtpSource() = delete;
RtpSource(int64_t timestamp_ms,
uint32_t source_id,
RtpSourceType source_type,
absl::optional<uint8_t> audio_level,
uint32_t rtp_timestamp);
RtpSource(const RtpSource&);
RtpSource& operator=(const RtpSource&);
~RtpSource();
int64_t timestamp_ms() const { return timestamp_ms_; }
void update_timestamp_ms(int64_t timestamp_ms) {
RTC_DCHECK_LE(timestamp_ms_, timestamp_ms);
timestamp_ms_ = timestamp_ms;
}
// The identifier of the source can be the CSRC or the SSRC.
uint32_t source_id() const { return source_id_; }
// The source can be either a contributing source or a synchronization source.
RtpSourceType source_type() const { return source_type_; }
absl::optional<uint8_t> audio_level() const { return audio_level_; }
void set_audio_level(const absl::optional<uint8_t>& level) {
audio_level_ = level;
}
uint32_t rtp_timestamp() const { return rtp_timestamp_; }
bool operator==(const RtpSource& o) const {
return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() &&
source_type_ == o.source_type() && audio_level_ == o.audio_level_ &&
rtp_timestamp_ == o.rtp_timestamp();
}
private:
int64_t timestamp_ms_;
uint32_t source_id_;
RtpSourceType source_type_;
absl::optional<uint8_t> audio_level_;
uint32_t rtp_timestamp_;
};
class RtpReceiverObserverInterface {
public:
// Note: Currently if there are multiple RtpReceivers of the same media type,

View File

@ -0,0 +1,20 @@
# Copyright (c) 2019 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.
import("../../../webrtc.gni")
rtc_source_set("rtp_source") {
visibility = [ "*" ]
sources = [
"rtp_source.h",
]
deps = [
"../../../rtc_base:checks",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -0,0 +1,80 @@
/*
* Copyright 2019 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.
*/
#ifndef API_TRANSPORT_RTP_RTP_SOURCE_H_
#define API_TRANSPORT_RTP_RTP_SOURCE_H_
#include <stdint.h>
#include "absl/types/optional.h"
#include "rtc_base/checks.h"
namespace webrtc {
enum class RtpSourceType {
SSRC,
CSRC,
};
class RtpSource {
public:
RtpSource() = delete;
RtpSource(int64_t timestamp_ms,
uint32_t source_id,
RtpSourceType source_type,
absl::optional<uint8_t> audio_level,
uint32_t rtp_timestamp)
: timestamp_ms_(timestamp_ms),
source_id_(source_id),
source_type_(source_type),
audio_level_(audio_level),
rtp_timestamp_(rtp_timestamp) {}
RtpSource(const RtpSource&) = default;
RtpSource& operator=(const RtpSource&) = default;
~RtpSource() = default;
int64_t timestamp_ms() const { return timestamp_ms_; }
void update_timestamp_ms(int64_t timestamp_ms) {
RTC_DCHECK_LE(timestamp_ms_, timestamp_ms);
timestamp_ms_ = timestamp_ms;
}
// The identifier of the source can be the CSRC or the SSRC.
uint32_t source_id() const { return source_id_; }
// The source can be either a contributing source or a synchronization source.
RtpSourceType source_type() const { return source_type_; }
absl::optional<uint8_t> audio_level() const { return audio_level_; }
void set_audio_level(const absl::optional<uint8_t>& level) {
audio_level_ = level;
}
uint32_t rtp_timestamp() const { return rtp_timestamp_; }
bool operator==(const RtpSource& o) const {
return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() &&
source_type_ == o.source_type() && audio_level_ == o.audio_level_ &&
rtp_timestamp_ == o.rtp_timestamp();
}
private:
int64_t timestamp_ms_;
uint32_t source_id_;
RtpSourceType source_type_;
absl::optional<uint8_t> audio_level_;
uint32_t rtp_timestamp_;
};
} // namespace webrtc
#endif // API_TRANSPORT_RTP_RTP_SOURCE_H_

View File

@ -54,6 +54,7 @@ rtc_static_library("audio") {
"../api/audio_codecs:audio_codecs_api",
"../api/rtc_event_log",
"../api/task_queue",
"../api/transport/rtp:rtp_source",
"../call:bitrate_allocator",
"../call:call_interfaces",
"../call:rtp_interfaces",

View File

@ -18,6 +18,7 @@
#include <vector>
#include "absl/memory/memory.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "audio/audio_level.h"
#include "audio/channel_send.h"

View File

@ -24,7 +24,7 @@
#include "api/crypto/crypto_options.h"
#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/rtp_receiver_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "call/rtp_packet_sink_interface.h"
#include "call/syncable.h"
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"

View File

@ -43,6 +43,7 @@ rtc_source_set("call_interfaces") {
"../api/audio_codecs:audio_codecs_api",
"../api/task_queue",
"../api/transport:network_control",
"../api/transport/rtp:rtp_source",
"../modules/audio_device",
"../modules/audio_processing",
"../modules/audio_processing:api",
@ -284,6 +285,7 @@ rtc_source_set("video_stream_api") {
"../api:rtp_headers",
"../api:rtp_parameters",
"../api:transport_api",
"../api/transport/rtp:rtp_source",
"../api/video:video_frame",
"../api/video:video_rtp_headers",
"../api/video:video_stream_encoder",
@ -449,6 +451,7 @@ if (rtc_include_tests) {
"../modules/audio_device:audio_device_impl",
"../modules/audio_mixer:audio_mixer_impl",
"../modules/rtp_rtcp",
"../rtc_base",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../system_wrappers",

View File

@ -20,15 +20,15 @@
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/media_transport_config.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/scoped_refptr.h"
#include "api/transport/rtp/rtp_source.h"
#include "call/rtp_config.h"
namespace webrtc {
class AudioSinkInterface;
class FrameDecryptorInterface;
class AudioReceiveStream {
public:

View File

@ -28,6 +28,7 @@
#include "modules/audio_device/include/test_audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/metrics.h"
#include "test/call_test.h"

View File

@ -19,12 +19,14 @@
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/rtp_headers.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "api/video/video_content_type.h"
#include "api/video/video_frame.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_timing.h"
#include "api/video_codecs/sdp_video_format.h"
@ -34,7 +36,6 @@
namespace webrtc {
class FrameDecryptorInterface;
class RtpPacketSinkInterface;
class VideoDecoderFactory;

View File

@ -78,6 +78,7 @@ rtc_static_library("rtc_media_base") {
"../api:rtp_parameters",
"../api:scoped_refptr",
"../api/audio_codecs:audio_codecs_api",
"../api/transport/rtp:rtp_source",
"../api/video:video_bitrate_allocation",
"../api/video:video_bitrate_allocator_factory",
"../api/video:video_frame",
@ -264,6 +265,7 @@ rtc_static_library("rtc_audio_video") {
"../api/audio:audio_mixer_api",
"../api/audio_codecs:audio_codecs_api",
"../api/task_queue",
"../api/transport/rtp:rtp_source",
"../api/video:video_bitrate_allocation",
"../api/video:video_bitrate_allocator_factory",
"../api/video:video_codec_constants",

View File

@ -25,7 +25,7 @@
#include "api/media_transport_config.h"
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "api/video/video_content_type.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_source_interface.h"
@ -42,6 +42,7 @@
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/buffer.h"
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/dscp.h"
#include "rtc_base/logging.h"
#include "rtc_base/network_route.h"

View File

@ -17,9 +17,9 @@
#include <vector>
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/rtp_receiver_interface.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/transport/rtp/rtp_source.h"
#include "call/audio_state.h"
#include "call/call.h"
#include "media/base/media_engine.h"

View File

@ -228,6 +228,7 @@ rtc_static_library("rtp_rtcp") {
"../../api/rtc_event_log",
"../../api/transport:field_trial_based_config",
"../../api/transport:webrtc_key_value_config",
"../../api/transport/rtp:rtp_source",
"../../api/units:time_delta",
"../../api/units:timestamp",
"../../api/video:video_bitrate_allocation",

View File

@ -19,7 +19,7 @@
#include "absl/types/optional.h"
#include "api/rtp_packet_infos.h"
#include "api/rtp_receiver_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/clock.h"

View File

@ -541,6 +541,7 @@ if (rtc_include_tests) {
"../api/rtc_event_log",
"../api/rtc_event_log:rtc_event_log_factory",
"../api/task_queue:default_task_queue_factory",
"../api/transport/rtp:rtp_source",
"../api/units:time_delta",
"../api/video:builtin_video_bitrate_allocator_factory",
"../logging:fake_rtc_event_log",

View File

@ -16,8 +16,8 @@
#include <utility>
#include <vector>
#include "api/rtp_receiver_interface.h"
#include "api/rtp_sender_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "media/base/media_channel.h"
#include "pc/audio_track.h"
#include "pc/test/fake_video_track_source.h"

View File

@ -12,6 +12,7 @@
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "rtc_base/memory_usage.h"
#include "rtc_base/thread.h"
namespace webrtc {
namespace test {