Remove FrameTransformerInterface functions using EncodedFrame.

Replaced by the function versions using TransformableFrameInterface
downstream.

Bug: webrtc:11380
Change-Id: Ia4aef84dd76b542ba33287aff6c9151448ed5be6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171864
Commit-Queue: Marina Ciocea <marinaciocea@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31170}
This commit is contained in:
Marina Ciocea
2020-05-05 16:03:54 +02:00
committed by Commit Bot
parent a0ff50c031
commit 81be4217b8
12 changed files with 24 additions and 256 deletions

View File

@ -206,8 +206,6 @@ rtc_library("rtp_rtcp") {
"source/time_util.h",
"source/tmmbr_help.cc",
"source/tmmbr_help.h",
"source/transformable_encoded_frame.cc",
"source/transformable_encoded_frame.h",
"source/ulpfec_generator.cc",
"source/ulpfec_generator.h",
"source/ulpfec_header_reader_writer.cc",

View File

@ -35,7 +35,6 @@
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "modules/rtp_rtcp/source/time_util.h"
#include "modules/rtp_rtcp/source/transformable_encoded_frame.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/trace_event.h"

View File

@ -16,7 +16,6 @@
#include "absl/memory/memory.h"
#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h"
#include "modules/rtp_rtcp/source/rtp_sender_video.h"
#include "modules/rtp_rtcp/source/transformable_encoded_frame.h"
#include "rtc_base/task_utils/to_queued_task.h"
namespace webrtc {
@ -126,35 +125,12 @@ bool RTPSenderVideoFrameTransformerDelegate::TransformFrame(
absl::optional<int64_t> expected_retransmission_time_ms) {
if (!encoder_queue_)
encoder_queue_ = TaskQueueBase::Current();
// TODO(bugs.webrtc.org/11380) remove once this version of TransformFrame() is
// deprecated.
frame_transformer_->TransformFrame(
std::make_unique<TransformableEncodedFrame>(
encoded_image.GetEncodedData(), video_header, payload_type,
codec_type, rtp_timestamp, encoded_image.capture_time_ms_,
fragmentation, expected_retransmission_time_ms),
RtpDescriptorAuthentication(video_header), ssrc_);
frame_transformer_->Transform(std::make_unique<TransformableVideoSenderFrame>(
encoded_image, video_header, payload_type, codec_type, rtp_timestamp,
fragmentation, expected_retransmission_time_ms, ssrc_));
return true;
}
void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
std::unique_ptr<video_coding::EncodedFrame> frame) {
rtc::CritScope lock(&sender_lock_);
// The encoder queue gets destroyed after the sender; as long as the sender is
// alive, it's safe to post.
if (!sender_)
return;
rtc::scoped_refptr<RTPSenderVideoFrameTransformerDelegate> delegate = this;
encoder_queue_->PostTask(ToQueuedTask(
[delegate = std::move(delegate), frame = std::move(frame)]() mutable {
delegate->SendVideo(std::move(frame));
}));
}
void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) {
rtc::CritScope lock(&sender_lock_);
@ -170,23 +146,6 @@ void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
}));
}
void RTPSenderVideoFrameTransformerDelegate::SendVideo(
std::unique_ptr<video_coding::EncodedFrame> frame) const {
RTC_CHECK(encoder_queue_->IsCurrent());
rtc::CritScope lock(&sender_lock_);
if (!sender_)
return;
auto* transformed_frame =
static_cast<TransformableEncodedFrame*>(frame.get());
sender_->SendVideo(
transformed_frame->PayloadType(), transformed_frame->codec_type(),
transformed_frame->Timestamp(), transformed_frame->capture_time_ms(),
transformed_frame->EncodedImage(),
transformed_frame->fragmentation_header(),
transformed_frame->video_header(),
transformed_frame->expected_retransmission_time_ms());
}
void RTPSenderVideoFrameTransformerDelegate::SendVideo(
std::unique_ptr<TransformableFrameInterface> transformed_frame) const {
RTC_CHECK(encoder_queue_->IsCurrent());

View File

@ -16,7 +16,6 @@
#include "api/frame_transformer_interface.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h"
#include "modules/rtp_rtcp/source/transformable_encoded_frame.h"
#include "rtc_base/critical_section.h"
namespace webrtc {
@ -46,13 +45,10 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
// Implements TransformedFrameCallback. Can be called on any thread. Posts
// the transformed frame to be sent on the |encoder_queue_|.
void OnTransformedFrame(
std::unique_ptr<video_coding::EncodedFrame> frame) override;
void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) override;
// Delegates the call to RTPSendVideo::SendVideo on the |encoder_queue_|.
void SendVideo(std::unique_ptr<video_coding::EncodedFrame> frame) const;
void SendVideo(std::unique_ptr<TransformableFrameInterface> frame) const;
// Delegates the call to RTPSendVideo::SendVideo under |sender_lock_|.

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
#include "modules/rtp_rtcp/source/transformable_encoded_frame.h"
namespace webrtc {
TransformableEncodedFrame::TransformableEncodedFrame(
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data,
const RTPVideoHeader& video_header,
int payload_type,
absl::optional<VideoCodecType> codec_type,
uint32_t rtp_timestamp,
int64_t capture_time_ms,
const RTPFragmentationHeader* fragmentation,
absl::optional<int64_t> expected_retransmission_time_ms)
: video_header_(video_header),
codec_type_(codec_type),
expected_retransmission_time_ms_(expected_retransmission_time_ms) {
SetEncodedData(encoded_data);
_payloadType = payload_type;
SetTimestamp(rtp_timestamp);
capture_time_ms_ = capture_time_ms;
if (fragmentation) {
fragmentation_header_ = std::make_unique<RTPFragmentationHeader>();
fragmentation_header_->CopyFrom(*fragmentation);
}
}
TransformableEncodedFrame::~TransformableEncodedFrame() = default;
const RTPVideoHeader& TransformableEncodedFrame::video_header() const {
return video_header_;
}
absl::optional<VideoCodecType> TransformableEncodedFrame::codec_type() const {
return codec_type_;
}
int64_t TransformableEncodedFrame::ReceivedTime() const {
return 0;
}
int64_t TransformableEncodedFrame::RenderTime() const {
return _renderTimeMs;
}
} // namespace webrtc

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
#ifndef MODULES_RTP_RTCP_SOURCE_TRANSFORMABLE_ENCODED_FRAME_H_
#define MODULES_RTP_RTCP_SOURCE_TRANSFORMABLE_ENCODED_FRAME_H_
#include <memory>
#include "absl/types/optional.h"
#include "api/video/encoded_frame.h"
#include "modules/include/module_common_types.h"
#include "modules/rtp_rtcp/source/rtp_video_header.h"
namespace webrtc {
class TransformableEncodedFrame : public video_coding::EncodedFrame {
public:
TransformableEncodedFrame(
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data,
const RTPVideoHeader& video_header,
int payload_type,
absl::optional<VideoCodecType> codec_type,
uint32_t rtp_timestamp,
int64_t capture_time_ms,
const RTPFragmentationHeader* fragmentation,
absl::optional<int64_t> expected_retransmission_time_ms);
~TransformableEncodedFrame() override;
const RTPVideoHeader& video_header() const;
absl::optional<VideoCodecType> codec_type() const;
int64_t capture_time_ms() const { return capture_time_ms_; }
RTPFragmentationHeader* fragmentation_header() const {
return fragmentation_header_.get();
}
const absl::optional<int64_t>& expected_retransmission_time_ms() const {
return expected_retransmission_time_ms_;
}
// Implements EncodedFrame.
int64_t ReceivedTime() const override;
int64_t RenderTime() const override;
private:
RTPVideoHeader video_header_;
absl::optional<VideoCodecType> codec_type_ = absl::nullopt;
std::unique_ptr<RTPFragmentationHeader> fragmentation_header_;
absl::optional<int64_t> expected_retransmission_time_ms_ = absl::nullopt;
};
} // namespace webrtc
#endif // MODULES_RTP_RTCP_SOURCE_TRANSFORMABLE_ENCODED_FRAME_H_