Make FrameInstrumentation movable and prefer move to pass by reference. This is a precursor to moving processing to a separate thread. Bug: webrtc:358039777 Change-Id: Iea32fa597cf1c5edfc94ccb12caffe057d9ce576 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/466824 Commit-Queue: Markus Handell <handellm@webrtc.org> Reviewed-by: Markus Handell <handellm@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Auto-Submit: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47552}
diff --git a/api/video/corruption_detection/frame_instrumentation_data.h b/api/video/corruption_detection/frame_instrumentation_data.h index 923a981..dadf59d 100644 --- a/api/video/corruption_detection/frame_instrumentation_data.h +++ b/api/video/corruption_detection/frame_instrumentation_data.h
@@ -19,6 +19,11 @@ class FrameInstrumentationData { public: FrameInstrumentationData(); + FrameInstrumentationData(const FrameInstrumentationData&) = default; + FrameInstrumentationData(FrameInstrumentationData&&) = default; + FrameInstrumentationData& operator=(const FrameInstrumentationData&) = + default; + FrameInstrumentationData& operator=(FrameInstrumentationData&&) = default; int sequence_index() const { return sequence_index_; } bool is_droppable() const { return droppable_; }
diff --git a/api/video/corruption_detection/frame_instrumentation_evaluation.cc b/api/video/corruption_detection/frame_instrumentation_evaluation.cc index d1beb7c..dbfe1b6 100644 --- a/api/video/corruption_detection/frame_instrumentation_evaluation.cc +++ b/api/video/corruption_detection/frame_instrumentation_evaluation.cc
@@ -51,7 +51,7 @@ } ~FrameInstrumentationEvaluationImpl() override = default; - void OnInstrumentedFrame(const FrameInstrumentationData& data, + void OnInstrumentedFrame(FrameInstrumentationData data, const VideoFrame& frame, VideoContentType frame_type) override { if (data.sample_values().empty()) {
diff --git a/api/video/corruption_detection/frame_instrumentation_evaluation.h b/api/video/corruption_detection/frame_instrumentation_evaluation.h index 60b846a..ae61931 100644 --- a/api/video/corruption_detection/frame_instrumentation_evaluation.h +++ b/api/video/corruption_detection/frame_instrumentation_evaluation.h
@@ -43,7 +43,7 @@ CorruptionScoreObserver* observer); virtual ~FrameInstrumentationEvaluation() = default; - virtual void OnInstrumentedFrame(const FrameInstrumentationData& data, + virtual void OnInstrumentedFrame(FrameInstrumentationData data, const VideoFrame& frame, VideoContentType frame_type) = 0;
diff --git a/common_video/include/corruption_score_calculator.h b/common_video/include/corruption_score_calculator.h index d9fa823..1220187 100644 --- a/common_video/include/corruption_score_calculator.h +++ b/common_video/include/corruption_score_calculator.h
@@ -25,7 +25,7 @@ virtual void CalculateCorruptionScore( const VideoFrame& frame, - const FrameInstrumentationData& frame_instrumentation_data, + FrameInstrumentationData frame_instrumentation_data, VideoContentType content_type) = 0; };
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc index dac95bf..2e0f27e 100644 --- a/modules/video_coding/generic_decoder.cc +++ b/modules/video_coding/generic_decoder.cc
@@ -249,7 +249,7 @@ if (corruption_score_calculator_ && frame_info->frame_instrumentation_data.has_value()) { corruption_score_calculator_->CalculateCorruptionScore( - decodedImage, *frame_info->frame_instrumentation_data, + decodedImage, std::move(*frame_info->frame_instrumentation_data), frame_info->content_type); } }
diff --git a/modules/video_coding/generic_decoder_unittest.cc b/modules/video_coding/generic_decoder_unittest.cc index 23ecf26..c0eaebd 100644 --- a/modules/video_coding/generic_decoder_unittest.cc +++ b/modules/video_coding/generic_decoder_unittest.cc
@@ -55,7 +55,7 @@ MOCK_METHOD(void, CalculateCorruptionScore, (const VideoFrame& frame, - const FrameInstrumentationData& frame_instrumentation_data, + FrameInstrumentationData frame_instrumentation_data, VideoContentType content_type), (override)); };
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc index 79624b6..f508ae5 100644 --- a/video/video_receive_stream2.cc +++ b/video/video_receive_stream2.cc
@@ -615,11 +615,11 @@ void VideoReceiveStream2::CalculateCorruptionScore( const VideoFrame& frame, - const FrameInstrumentationData& frame_instrumentation_data, + FrameInstrumentationData frame_instrumentation_data, VideoContentType content_type) { RTC_DCHECK_RUNS_SERIALIZED(&decode_callback_race_checker_); - frame_evaluator_->OnInstrumentedFrame(frame_instrumentation_data, frame, - content_type); + frame_evaluator_->OnInstrumentedFrame(std::move(frame_instrumentation_data), + frame, content_type); } bool VideoReceiveStream2::SetBaseMinimumPlayoutDelayMs(int delay_ms) {
diff --git a/video/video_receive_stream2.h b/video/video_receive_stream2.h index c90527e..f57818b 100644 --- a/video/video_receive_stream2.h +++ b/video/video_receive_stream2.h
@@ -254,7 +254,7 @@ void UpdateHistograms(); void CalculateCorruptionScore( const VideoFrame& frame, - const FrameInstrumentationData& frame_instrumentation_data, + FrameInstrumentationData frame_instrumentation_data, VideoContentType content_type) override; const Environment env_;