Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.h

Issue 1823503002: Reland Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvoiceengine.h
diff --git a/webrtc/media/engine/webrtcvoiceengine.h b/webrtc/media/engine/webrtcvoiceengine.h
index 0ccc64908dc77539a2f7139253e78d8adccfe9a7..a16d0428fe71a80c0484042f8ecb8fd1faebb49a 100644
--- a/webrtc/media/engine/webrtcvoiceengine.h
+++ b/webrtc/media/engine/webrtcvoiceengine.h
@@ -179,9 +179,9 @@ class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
bool CanInsertDtmf() override;
bool InsertDtmf(uint32_t ssrc, int event, int duration) override;
- void OnPacketReceived(rtc::Buffer* packet,
+ void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) override;
- void OnRtcpReceived(rtc::Buffer* packet,
+ void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) override;
void OnReadyToSend(bool ready) override {}
bool GetStats(VoiceMediaInfo* info) override;
@@ -194,16 +194,14 @@ class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
bool SendRtp(const uint8_t* data,
size_t len,
const webrtc::PacketOptions& options) override {
- rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
- kMaxRtpPacketLen);
+ rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
rtc::PacketOptions rtc_options;
rtc_options.packet_id = options.packet_id;
return VoiceMediaChannel::SendPacket(&packet, rtc_options);
}
bool SendRtcp(const uint8_t* data, size_t len) override {
- rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
- kMaxRtpPacketLen);
+ rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
}

Powered by Google App Engine
This is Rietveld 408576698