webrtc_m130/modules/video_coding/codecs/stereo/stereo_encoder_adapter.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

262 lines
9.6 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
#include <cstring>
#include "common_video/include/video_frame.h"
#include "common_video/include/video_frame_buffer.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/include/module_common_types.h"
#include "rtc_base/keep_ref_until_done.h"
#include "rtc_base/logging.h"
namespace webrtc {
// Callback wrapper that helps distinguish returned results from |encoders_|
// instances.
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
class StereoEncoderAdapter::AdapterEncodedImageCallback
: public webrtc::EncodedImageCallback {
public:
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
AdapterEncodedImageCallback(webrtc::StereoEncoderAdapter* adapter,
AlphaCodecStream stream_idx)
: adapter_(adapter), stream_idx_(stream_idx) {}
EncodedImageCallback::Result OnEncodedImage(
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) override {
if (!adapter_)
return Result(Result::OK);
return adapter_->OnEncodedImage(stream_idx_, encoded_image,
codec_specific_info, fragmentation);
}
private:
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
StereoEncoderAdapter* adapter_;
const AlphaCodecStream stream_idx_;
};
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
StereoEncoderAdapter::StereoEncoderAdapter(
VideoEncoderFactory* factory,
const SdpVideoFormat& associated_format)
: factory_(factory),
associated_format_(associated_format),
encoded_complete_callback_(nullptr) {}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
StereoEncoderAdapter::~StereoEncoderAdapter() {
Release();
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::InitEncode(const VideoCodec* inst,
int number_of_cores,
size_t max_payload_size) {
const size_t buffer_size =
CalcBufferSize(VideoType::kI420, inst->width, inst->height);
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
stereo_dummy_planes_.resize(buffer_size);
// It is more expensive to encode 0x00, so use 0x80 instead.
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
std::fill(stereo_dummy_planes_.begin(), stereo_dummy_planes_.end(), 0x80);
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
RTC_DCHECK_EQ(kVideoCodecStereo, inst->codecType);
VideoCodec settings = *inst;
settings.codecType = PayloadStringToCodecType(associated_format_.name);
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
// Take over the key frame interval at adapter level, because we have to
// sync the key frames for both sub-encoders.
switch (settings.codecType) {
case kVideoCodecVP8:
key_frame_interval_ = settings.VP8()->keyFrameInterval;
settings.VP8()->keyFrameInterval = 0;
break;
case kVideoCodecVP9:
key_frame_interval_ = settings.VP9()->keyFrameInterval;
settings.VP9()->keyFrameInterval = 0;
break;
case kVideoCodecH264:
key_frame_interval_ = settings.H264()->keyFrameInterval;
settings.H264()->keyFrameInterval = 0;
break;
default:
break;
}
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
std::unique_ptr<VideoEncoder> encoder =
factory_->CreateVideoEncoder(associated_format_);
const int rv =
encoder->InitEncode(&settings, number_of_cores, max_payload_size);
if (rv) {
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
RTC_LOG(LS_ERROR) << "Failed to create stereo codec index " << i;
return rv;
}
adapter_callbacks_.emplace_back(new AdapterEncodedImageCallback(
this, static_cast<AlphaCodecStream>(i)));
encoder->RegisterEncodeCompleteCallback(adapter_callbacks_.back().get());
encoders_.emplace_back(std::move(encoder));
}
return WEBRTC_VIDEO_CODEC_OK;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) {
if (!encoded_complete_callback_) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
Revert "Add stereo codec header and pass it through RTP" This reverts commit 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1. Reason for revert: Breaks downstream project. Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,niklas.enbom@webrtc.org,emircan@webrtc.org Change-Id: I57f3172ca3c60a84537d577a574dc8018e12d634 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/26940 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20931}
2017-11-29 11:39:27 +00:00
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
std::vector<FrameType> adjusted_frame_types;
if (key_frame_interval_ > 0 && picture_index_ % key_frame_interval_ == 0) {
adjusted_frame_types.push_back(kVideoFrameKey);
} else {
adjusted_frame_types.push_back(kVideoFrameDelta);
}
Revert "Add stereo codec header and pass it through RTP" This reverts commit 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1. Reason for revert: Breaks downstream project. Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,niklas.enbom@webrtc.org,emircan@webrtc.org Change-Id: I57f3172ca3c60a84537d577a574dc8018e12d634 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/26940 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20931}
2017-11-29 11:39:27 +00:00
const bool has_alpha = input_image.video_frame_buffer()->type() ==
VideoFrameBuffer::Type::kI420A;
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
stashed_images_.emplace(
Reland "Add stereo codec header and pass it through RTP" This is a reland of 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1 Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org, sprang@webrtc.org, niklas.enbom@webrtc.org Bug: webrtc:7671 Change-Id: If8f0c7e6e3a2a704f19161f0e8bf1880906e7fe0 Reviewed-on: https://webrtc-review.googlesource.com/27160 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20946}
2017-11-28 09:45:25 -08:00
std::piecewise_construct, std::forward_as_tuple(input_image.timestamp()),
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
std::forward_as_tuple(picture_index_,
Reland "Add stereo codec header and pass it through RTP" This is a reland of 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1 Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org, sprang@webrtc.org, niklas.enbom@webrtc.org Bug: webrtc:7671 Change-Id: If8f0c7e6e3a2a704f19161f0e8bf1880906e7fe0 Reviewed-on: https://webrtc-review.googlesource.com/27160 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20946}
2017-11-28 09:45:25 -08:00
has_alpha ? kAlphaCodecStreams : 1));
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
++picture_index_;
Reland "Add stereo codec header and pass it through RTP" This is a reland of 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1 Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org, sprang@webrtc.org, niklas.enbom@webrtc.org Bug: webrtc:7671 Change-Id: If8f0c7e6e3a2a704f19161f0e8bf1880906e7fe0 Reviewed-on: https://webrtc-review.googlesource.com/27160 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20946}
2017-11-28 09:45:25 -08:00
// Encode YUV
int rv = encoders_[kYUVStream]->Encode(input_image, codec_specific_info,
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
&adjusted_frame_types);
Reland "Add stereo codec header and pass it through RTP" This is a reland of 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1 Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org, sprang@webrtc.org, niklas.enbom@webrtc.org Bug: webrtc:7671 Change-Id: If8f0c7e6e3a2a704f19161f0e8bf1880906e7fe0 Reviewed-on: https://webrtc-review.googlesource.com/27160 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20946}
2017-11-28 09:45:25 -08:00
// If we do not receive an alpha frame, we send a single frame for this
// |picture_index_|. The receiver will receive |frame_count| as 1 which
// soecifies this case.
if (rv || !has_alpha)
return rv;
// Encode AXX
const I420ABufferInterface* yuva_buffer =
input_image.video_frame_buffer()->GetI420A();
rtc::scoped_refptr<I420BufferInterface> alpha_buffer =
WrapI420Buffer(input_image.width(), input_image.height(),
yuva_buffer->DataA(), yuva_buffer->StrideA(),
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
stereo_dummy_planes_.data(), yuva_buffer->StrideU(),
stereo_dummy_planes_.data(), yuva_buffer->StrideV(),
rtc::KeepRefUntilDone(input_image.video_frame_buffer()));
VideoFrame alpha_image(alpha_buffer, input_image.timestamp(),
input_image.render_time_ms(), input_image.rotation());
rv = encoders_[kAXXStream]->Encode(alpha_image, codec_specific_info,
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
&adjusted_frame_types);
return rv;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) {
encoded_complete_callback_ = callback;
return WEBRTC_VIDEO_CODEC_OK;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
int64_t rtt) {
for (auto& encoder : encoders_) {
const int rv = encoder->SetChannelParameters(packet_loss, rtt);
if (rv)
return rv;
}
return WEBRTC_VIDEO_CODEC_OK;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
uint32_t framerate) {
for (auto& encoder : encoders_) {
Reland "Add stereo codec header and pass it through RTP" This is a reland of 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1 Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org, sprang@webrtc.org, niklas.enbom@webrtc.org Bug: webrtc:7671 Change-Id: If8f0c7e6e3a2a704f19161f0e8bf1880906e7fe0 Reviewed-on: https://webrtc-review.googlesource.com/27160 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20946}
2017-11-28 09:45:25 -08:00
// TODO(emircan): |framerate| is used to calculate duration in encoder
// instances. We report the total frame rate to keep real time for now.
// Remove this after refactoring duration logic.
const int rv = encoder->SetRateAllocation(
bitrate, static_cast<uint32_t>(encoders_.size()) * framerate);
if (rv)
return rv;
}
return WEBRTC_VIDEO_CODEC_OK;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
int StereoEncoderAdapter::Release() {
for (auto& encoder : encoders_) {
const int rv = encoder->Release();
if (rv)
return rv;
}
encoders_.clear();
adapter_callbacks_.clear();
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
for (auto& stashed_image : stashed_images_) {
for (auto& image_component : stashed_image.second.image_components) {
delete[] image_component.encoded_image._buffer;
}
}
stashed_images_.clear();
if (combined_image_._buffer) {
delete[] combined_image_._buffer;
combined_image_._buffer = nullptr;
}
return WEBRTC_VIDEO_CODEC_OK;
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
const char* StereoEncoderAdapter::ImplementationName() const {
return "StereoEncoderAdapter";
}
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
AlphaCodecStream stream_idx,
const EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentation) {
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
const auto& stashed_image_itr = stashed_images_.find(encodedImage._timeStamp);
const auto& stashed_image_next_itr = std::next(stashed_image_itr, 1);
RTC_DCHECK(stashed_image_itr != stashed_images_.end());
MultiplexImage& stashed_image = stashed_image_itr->second;
const uint8_t frame_count = stashed_image.component_count;
// Save the image
MultiplexImageComponent image_component;
image_component.component_index = stream_idx;
image_component.codec_type =
PayloadStringToCodecType(associated_format_.name);
image_component.encoded_image = encodedImage;
image_component.encoded_image._buffer = new uint8_t[encodedImage._length];
std::memcpy(image_component.encoded_image._buffer, encodedImage._buffer,
encodedImage._length);
stashed_image.image_components.push_back(image_component);
if (stashed_image.image_components.size() == frame_count) {
// Complete case
auto iter = stashed_images_.begin();
while (iter != stashed_images_.end() && iter != stashed_image_next_itr) {
// No image at all, skip.
if (iter->second.image_components.size() == 0)
continue;
// We have to send out those stashed frames, otherwise the delta frame
// dependency chain is broken.
if (combined_image_._buffer)
delete[] combined_image_._buffer;
combined_image_ =
MultiplexEncodedImagePacker::PackAndRelease(iter->second);
CodecSpecificInfo codec_info = *codecSpecificInfo;
Revert "Reland "Rename stereo video codec to multiplex"" This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > Rename stereo video codec to multiplex > > > > This CL only does the rename from"stereo" to multiplex". With this we have a > > better name that doesn't clash with audio's usage of stereo. > > > > Bug: webrtc:7671 > > Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 > > Reviewed-on: https://webrtc-review.googlesource.com/43242 > > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21769} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
2018-01-27 00:45:14 +00:00
codec_info.codecType = kVideoCodecStereo;
codec_info.codecSpecific.generic.simulcast_idx = 0;
Reland "Wrap Alpha and YUV frame into one EncodedImage for transmission" This reverts commit d756fd06fed1b6c65dcb263cbd8f00ca23d72f3b. Original change's description: > Revert "Wrap Alpha and YUV frame into one EncodedImage for transmission" > > This reverts commit 5670c86aeccc9bc1191725431de7998d21b73c07. > > Reason for revert: Breaks downstream build. Need to add "#include <cstring>" to stereo_encoder_adapter.cc to use std::memcpy. > > Original change's description: > > Wrap Alpha and YUV frame into one EncodedImage for transmission > > > > With alpha channel, we observe the artifacts on the receiver side, and > > the reason is that when YUV channel has a key frame, it gives frame_buffer2 > > a chance to drop some previous frames. Then it is possible that some alpha > > frames got dropped, which break the alpha frame dependence chain. > > > > In this CL, we pack the YUV frame and alpha encoded frame together as one > > entity to solve the issue. > > > > Bug: webrtc:8773 > > Change-Id: Ibe746a46cb41fd92b399a7069e1d89f02f292af7 > > Reviewed-on: https://webrtc-review.googlesource.com/38481 > > Commit-Queue: Qiang Chen <qiangchen@chromium.org> > > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#21737} > > TBR=qiangchen@chromium.org,emircan@webrtc.org > > Change-Id: I11eff814ce093bf6db327ebcd21b1b71a1929849 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8773 > Reviewed-on: https://webrtc-review.googlesource.com/43260 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21739} TBR=deadbeef@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0d64b7e7a62e4f35aa012270d3826a23b3fb2337 Bug: webrtc:8773 Reviewed-on: https://webrtc-review.googlesource.com/43440 Commit-Queue: Qiang Chen <qiangchen@chromium.org> Reviewed-by: Qiang Chen <qiangchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#21749}
2018-01-24 13:36:41 -08:00
encoded_complete_callback_->OnEncodedImage(combined_image_, &codec_info,
fragmentation);
iter++;
}
stashed_images_.erase(stashed_images_.begin(), stashed_image_next_itr);
}
return EncodedImageCallback::Result(EncodedImageCallback::Result::OK);
}
} // namespace webrtc