Change RtcpPacket::PacketReadyCallback to rtc::FunctionView
from interface Bug: webrtc:5565 Change-Id: I2df5d7a0554b938888581f1c73dbdb8b85c387cc Reviewed-on: https://webrtc-review.googlesource.com/8680 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21136}
This commit is contained in:
committed by
Commit Bot
parent
f1061c2d90
commit
5c3cc41cef
@ -13,6 +13,7 @@
|
||||
|
||||
#include "rtc_base/basictypes.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/function_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace rtcp {
|
||||
@ -49,14 +50,8 @@ class RtcpPacket {
|
||||
// not contain all data in this RtcpPacket; if a packet cannot fit in
|
||||
// max_length bytes, it will be fragmented and multiple calls to this
|
||||
// callback will be made.
|
||||
class PacketReadyCallback {
|
||||
public:
|
||||
virtual void OnPacketReady(uint8_t* data, size_t length) = 0;
|
||||
|
||||
protected:
|
||||
PacketReadyCallback() {}
|
||||
virtual ~PacketReadyCallback() {}
|
||||
};
|
||||
using PacketReadyCallback =
|
||||
rtc::FunctionView<void(rtc::ArrayView<const uint8_t> packet)>;
|
||||
|
||||
virtual ~RtcpPacket() {}
|
||||
|
||||
@ -64,11 +59,8 @@ class RtcpPacket {
|
||||
// fragmentation using BlockLength() to allocate big enough buffer.
|
||||
rtc::Buffer Build() const;
|
||||
|
||||
// Returns true if call to Create succeeded. Provided buffer reference
|
||||
// will be used for all calls to callback.
|
||||
bool BuildExternalBuffer(uint8_t* buffer,
|
||||
size_t max_length,
|
||||
PacketReadyCallback* callback) const;
|
||||
// Returns true if call to Create succeeded.
|
||||
bool Build(size_t max_length, PacketReadyCallback callback) const;
|
||||
|
||||
// Size of this packet in bytes (including headers).
|
||||
virtual size_t BlockLength() const = 0;
|
||||
@ -79,7 +71,7 @@ class RtcpPacket {
|
||||
virtual bool Create(uint8_t* packet,
|
||||
size_t* index,
|
||||
size_t max_length,
|
||||
PacketReadyCallback* callback) const = 0;
|
||||
PacketReadyCallback callback) const = 0;
|
||||
|
||||
protected:
|
||||
// Size of the rtcp common header.
|
||||
@ -94,7 +86,7 @@ class RtcpPacket {
|
||||
|
||||
bool OnBufferFull(uint8_t* packet,
|
||||
size_t* index,
|
||||
PacketReadyCallback* callback) const;
|
||||
PacketReadyCallback callback) const;
|
||||
// Size of the rtcp packet as written in header.
|
||||
size_t HeaderLength() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user