Commit cf2eeaaa authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Revert "[RTCInsertableStreams] Always sync JS ArrayBuffer with internal buffer."

This reverts commit 8b1fecff.

Reason for revert: Causes bot failures. https://crbug.com/1057949

Original change's description:
> [RTCInsertableStreams] Always sync JS ArrayBuffer with internal buffer.
> 
> It is possible to modify the data field without replacing it, so syncing
> always.
> Will work on an optimization for a follow-up CL.
> 
> Bug: 1052765
> Change-Id: Ibc5b143413163f12af3c6cacefb3a9ee028b7eb1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083092
> Reviewed-by: Harald Alvestrand <hta@chromium.org>
> Commit-Queue: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#746093}

TBR=hta@chromium.org,guidou@chromium.org

Change-Id: I69c89db2923f8279fdb40bd7415157dfbb48a189
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1052765
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2082921Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746300}
parent c883316b
...@@ -46,6 +46,7 @@ DOMArrayBuffer* RTCEncodedVideoFrame::additionalData() const { ...@@ -46,6 +46,7 @@ DOMArrayBuffer* RTCEncodedVideoFrame::additionalData() const {
void RTCEncodedVideoFrame::setData(DOMArrayBuffer* data) { void RTCEncodedVideoFrame::setData(DOMArrayBuffer* data) {
frame_data_ = data; frame_data_ = data;
replaced_frame_data_ = true;
} }
String RTCEncodedVideoFrame::toString() const { String RTCEncodedVideoFrame::toString() const {
...@@ -65,12 +66,14 @@ String RTCEncodedVideoFrame::toString() const { ...@@ -65,12 +66,14 @@ String RTCEncodedVideoFrame::toString() const {
std::unique_ptr<webrtc::video_coding::EncodedFrame> std::unique_ptr<webrtc::video_coding::EncodedFrame>
RTCEncodedVideoFrame::PassDelegate() { RTCEncodedVideoFrame::PassDelegate() {
// Sync the delegate data with |frame_data_|. // Sync the delegate data with |frame_data_| if necessary.
rtc::scoped_refptr<webrtc::EncodedImageBuffer> webrtc_image = if (replaced_frame_data_) {
webrtc::EncodedImageBuffer::Create( rtc::scoped_refptr<webrtc::EncodedImageBuffer> webrtc_image =
static_cast<const uint8_t*>(frame_data_->Data()), webrtc::EncodedImageBuffer::Create(
frame_data_->ByteLengthAsSizeT()); static_cast<const uint8_t*>(frame_data_->Data()),
delegate_->SetEncodedData(std::move(webrtc_image)); frame_data_->ByteLengthAsSizeT());
delegate_->SetEncodedData(std::move(webrtc_image));
}
return std::move(delegate_); return std::move(delegate_);
} }
......
...@@ -52,6 +52,7 @@ class MODULES_EXPORT RTCEncodedVideoFrame final : public ScriptWrappable { ...@@ -52,6 +52,7 @@ class MODULES_EXPORT RTCEncodedVideoFrame final : public ScriptWrappable {
private: private:
std::unique_ptr<webrtc::video_coding::EncodedFrame> delegate_; std::unique_ptr<webrtc::video_coding::EncodedFrame> delegate_;
std::vector<uint8_t> additional_data_vector_; std::vector<uint8_t> additional_data_vector_;
bool replaced_frame_data_ = false;
// Exposes encoded frame data from |delegate_|. // Exposes encoded frame data from |delegate_|.
mutable Member<DOMArrayBuffer> frame_data_; mutable Member<DOMArrayBuffer> frame_data_;
// Exposes data from |additional_data_vector_|. // Exposes data from |additional_data_vector_|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment