Revert "Delete methods EncodedImage::Allocate and EncodedImageBufferInterface::Realloc"
This reverts commit d6bb18479f4d9e258ae3e05427c101fb9e635373. Reason for revert: Breaks Chromium Roll. Example: https://ci.chromium.org/p/chromium/builders/try/android-kitkat-arm-rel/382446 Roll: https://chromium-review.googlesource.com/c/chromium/src/+/1859941 Original change's description: > Delete methods EncodedImage::Allocate and EncodedImageBufferInterface::Realloc > > Bug: webrtc:9378 > Change-Id: I3b03656769623647fcbb4f9125a3e920b7650fe9 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155961 > Reviewed-by: Philip Eliasson <philipel@webrtc.org> > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > Commit-Queue: Niels Moller <nisse@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29458} TBR=ilnik@webrtc.org,nisse@webrtc.org,philipel@webrtc.org Change-Id: I7209c5ae2be2d512572210cf08a4751ee2ee5bc4 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9378 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157040 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29473}
This commit is contained in:

committed by
Commit Bot

parent
c122c29698
commit
3f0d8e46a8
@ -81,6 +81,15 @@ void EncodedImage::Retain() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EncodedImage::Allocate(size_t capacity) {
|
||||||
|
if (encoded_data_ && encoded_data_->HasOneRef()) {
|
||||||
|
encoded_data_->Realloc(capacity);
|
||||||
|
} else {
|
||||||
|
encoded_data_ = EncodedImageBuffer::Create(capacity);
|
||||||
|
}
|
||||||
|
buffer_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void EncodedImage::SetEncodeTime(int64_t encode_start_ms,
|
void EncodedImage::SetEncodeTime(int64_t encode_start_ms,
|
||||||
int64_t encode_finish_ms) {
|
int64_t encode_finish_ms) {
|
||||||
timing_.encode_start_ms = encode_start_ms;
|
timing_.encode_start_ms = encode_start_ms;
|
||||||
|
@ -44,6 +44,13 @@ class EncodedImageBufferInterface : public rtc::RefCountInterface {
|
|||||||
// this non-const data method.
|
// this non-const data method.
|
||||||
virtual uint8_t* data() = 0;
|
virtual uint8_t* data() = 0;
|
||||||
virtual size_t size() const = 0;
|
virtual size_t size() const = 0;
|
||||||
|
// TODO(bugs.webrtc.org/9378): Delete from this interface, together with
|
||||||
|
// EncodedImage::Allocate. Implemented properly only by the below concrete
|
||||||
|
// class
|
||||||
|
virtual void Realloc(size_t size) { RTC_NOTREACHED(); }
|
||||||
|
// Will be implemented by RefCountedObject, which also implements
|
||||||
|
// |rtc::RefCountInterface|.
|
||||||
|
virtual bool HasOneRef() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Basic implementation of EncodedImageBufferInterface.
|
// Basic implementation of EncodedImageBufferInterface.
|
||||||
@ -57,7 +64,7 @@ class EncodedImageBuffer : public EncodedImageBufferInterface {
|
|||||||
const uint8_t* data() const override;
|
const uint8_t* data() const override;
|
||||||
uint8_t* data() override;
|
uint8_t* data() override;
|
||||||
size_t size() const override;
|
size_t size() const override;
|
||||||
void Realloc(size_t t);
|
void Realloc(size_t t) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit EncodedImageBuffer(size_t size);
|
explicit EncodedImageBuffer(size_t size);
|
||||||
@ -139,6 +146,11 @@ class RTC_EXPORT EncodedImage {
|
|||||||
capacity_ = capacity;
|
capacity_ = capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(bugs.webrtc.org/9378): Delete; this method implies realloc, which
|
||||||
|
// should not be generally supported by the EncodedImageBufferInterface.
|
||||||
|
RTC_DEPRECATED
|
||||||
|
void Allocate(size_t capacity);
|
||||||
|
|
||||||
void SetEncodedData(
|
void SetEncodedData(
|
||||||
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data) {
|
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data) {
|
||||||
encoded_data_ = encoded_data;
|
encoded_data_ = encoded_data;
|
||||||
|
@ -35,6 +35,8 @@ class EncodedImageBufferWrapper : public EncodedImageBufferInterface {
|
|||||||
uint8_t* data() override { return buffer_.data(); }
|
uint8_t* data() override { return buffer_.data(); }
|
||||||
size_t size() const override { return buffer_.size(); }
|
size_t size() const override { return buffer_.size(); }
|
||||||
|
|
||||||
|
void Realloc(size_t t) override { RTC_NOTREACHED(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rtc::Buffer buffer_;
|
rtc::Buffer buffer_;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user