diff --git a/webrtc/modules/include/module_common_types.h b/webrtc/modules/include/module_common_types.h index 23ed8f40bf..1ee428deed 100644 --- a/webrtc/modules/include/module_common_types.h +++ b/webrtc/modules/include/module_common_types.h @@ -91,6 +91,11 @@ class RTPFragmentationHeader { fragmentationTimeDiff(NULL), fragmentationPlType(NULL) {} + RTPFragmentationHeader(RTPFragmentationHeader&& other) + : RTPFragmentationHeader() { + std::swap(*this, other); + } + ~RTPFragmentationHeader() { delete[] fragmentationOffset; delete[] fragmentationLength; @@ -98,6 +103,17 @@ class RTPFragmentationHeader { delete[] fragmentationPlType; } + void operator=(RTPFragmentationHeader&& other) { std::swap(*this, other); } + + friend void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) { + using std::swap; + swap(a.fragmentationVectorSize, b.fragmentationVectorSize); + swap(a.fragmentationOffset, b.fragmentationOffset); + swap(a.fragmentationLength, b.fragmentationLength); + swap(a.fragmentationTimeDiff, b.fragmentationTimeDiff); + swap(a.fragmentationPlType, b.fragmentationPlType); + } + void CopyFrom(const RTPFragmentationHeader& src) { if (this == &src) { return;