Update rtc_tools to not use implicit T* --> scoped_refptr<T> conversion
Bug: webrtc:13464
Change-Id: Ieb7747eaf466254c6feaf5670846b897d700ad07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/246101
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35680}
diff --git a/rtc_tools/frame_analyzer/video_color_aligner.cc b/rtc_tools/frame_analyzer/video_color_aligner.cc
index 05e963f..6e9f81d 100644
--- a/rtc_tools/frame_analyzer/video_color_aligner.cc
+++ b/rtc_tools/frame_analyzer/video_color_aligner.cc
@@ -155,7 +155,7 @@
rtc::scoped_refptr<Video> AdjustColors(
const ColorTransformationMatrix& color_transformation,
const rtc::scoped_refptr<Video>& video) {
- class ColorAdjustedVideo : public rtc::RefCountedObject<Video> {
+ class ColorAdjustedVideo : public Video {
public:
ColorAdjustedVideo(const ColorTransformationMatrix& color_transformation,
const rtc::scoped_refptr<Video>& video)
@@ -177,7 +177,7 @@
const rtc::scoped_refptr<Video> video_;
};
- return new ColorAdjustedVideo(color_transformation, video);
+ return rtc::make_ref_counted<ColorAdjustedVideo>(color_transformation, video);
}
rtc::scoped_refptr<I420BufferInterface> AdjustColors(
diff --git a/rtc_tools/frame_analyzer/video_geometry_aligner.cc b/rtc_tools/frame_analyzer/video_geometry_aligner.cc
index 88da26d..b06792e 100644
--- a/rtc_tools/frame_analyzer/video_geometry_aligner.cc
+++ b/rtc_tools/frame_analyzer/video_geometry_aligner.cc
@@ -132,7 +132,7 @@
rtc::scoped_refptr<Video> AdjustCropping(
const rtc::scoped_refptr<Video>& reference_video,
const rtc::scoped_refptr<Video>& test_video) {
- class CroppedVideo : public rtc::RefCountedObject<Video> {
+ class CroppedVideo : public Video {
public:
CroppedVideo(const rtc::scoped_refptr<Video>& reference_video,
const rtc::scoped_refptr<Video>& test_video)
@@ -171,7 +171,7 @@
mutable std::map<size_t, CropRegion> crop_regions_;
};
- return new CroppedVideo(reference_video, test_video);
+ return rtc::make_ref_counted<CroppedVideo>(reference_video, test_video);
}
} // namespace test
diff --git a/rtc_tools/frame_analyzer/video_temporal_aligner.cc b/rtc_tools/frame_analyzer/video_temporal_aligner.cc
index 42017c4..20c8b95 100644
--- a/rtc_tools/frame_analyzer/video_temporal_aligner.cc
+++ b/rtc_tools/frame_analyzer/video_temporal_aligner.cc
@@ -37,7 +37,7 @@
const int kNumberOfFramesLookAhead = 60;
// Helper class that takes a video and generates an infinite looping video.
-class LoopingVideo : public rtc::RefCountedObject<Video> {
+class LoopingVideo : public Video {
public:
explicit LoopingVideo(const rtc::scoped_refptr<Video>& video)
: video_(video) {}
@@ -59,7 +59,7 @@
// Helper class that take a vector of frame indices and a video and produces a
// new video where the frames have been reshuffled.
-class ReorderedVideo : public rtc::RefCountedObject<Video> {
+class ReorderedVideo : public Video {
public:
ReorderedVideo(const rtc::scoped_refptr<Video>& video,
const std::vector<size_t>& indices)
@@ -80,7 +80,7 @@
};
// Helper class that takes a video and produces a downscaled video.
-class DownscaledVideo : public rtc::RefCountedObject<Video> {
+class DownscaledVideo : public Video {
public:
DownscaledVideo(float scale_factor, const rtc::scoped_refptr<Video>& video)
: downscaled_width_(
@@ -113,7 +113,7 @@
// Helper class that takes a video and caches the latest frame access. This
// improves performance a lot since the original source is often from a file.
-class CachedVideo : public rtc::RefCountedObject<Video> {
+class CachedVideo : public Video {
public:
CachedVideo(int max_cache_size, const rtc::scoped_refptr<Video>& video)
: max_cache_size_(max_cache_size), video_(video) {}
@@ -189,14 +189,15 @@
// same memory tens of times.
const float kScaleFactor = 0.25f;
const rtc::scoped_refptr<Video> cached_downscaled_reference_video =
- new CachedVideo(kNumberOfFramesLookAhead,
- new DownscaledVideo(kScaleFactor, reference_video));
+ rtc::make_ref_counted<CachedVideo>(kNumberOfFramesLookAhead,
+ rtc::make_ref_counted<DownscaledVideo>(
+ kScaleFactor, reference_video));
const rtc::scoped_refptr<Video> downscaled_test_video =
- new DownscaledVideo(kScaleFactor, test_video);
+ rtc::make_ref_counted<DownscaledVideo>(kScaleFactor, test_video);
// Assume the video is looping around.
const rtc::scoped_refptr<Video> looping_reference_video =
- new LoopingVideo(cached_downscaled_reference_video);
+ rtc::make_ref_counted<LoopingVideo>(cached_downscaled_reference_video);
std::vector<size_t> match_indices;
for (const rtc::scoped_refptr<I420BufferInterface>& test_frame :
@@ -216,7 +217,8 @@
rtc::scoped_refptr<Video> ReorderVideo(const rtc::scoped_refptr<Video>& video,
const std::vector<size_t>& indices) {
- return new ReorderedVideo(new LoopingVideo(video), indices);
+ return rtc::make_ref_counted<ReorderedVideo>(
+ rtc::make_ref_counted<LoopingVideo>(video), indices);
}
rtc::scoped_refptr<Video> GenerateAlignedReferenceVideo(
diff --git a/rtc_tools/video_file_reader.cc b/rtc_tools/video_file_reader.cc
index bfdcba4..c6fa587 100644
--- a/rtc_tools/video_file_reader.cc
+++ b/rtc_tools/video_file_reader.cc
@@ -110,11 +110,11 @@
}
Video::Iterator Video::begin() const {
- return Iterator(this, 0);
+ return Iterator(rtc::scoped_refptr<const Video>(this), 0);
}
Video::Iterator Video::end() const {
- return Iterator(this, number_of_frames());
+ return Iterator(rtc::scoped_refptr<const Video>(this), number_of_frames());
}
rtc::scoped_refptr<Video> OpenY4mFile(const std::string& file_name) {