diff --git a/common_video/generic_frame_descriptor/generic_frame_info.h b/common_video/generic_frame_descriptor/generic_frame_info.h index ba3265bb37..9b2070743c 100644 --- a/common_video/generic_frame_descriptor/generic_frame_info.h +++ b/common_video/generic_frame_descriptor/generic_frame_info.h @@ -40,7 +40,6 @@ struct GenericFrameInfo : public FrameDependencyTemplate { GenericFrameInfo(const GenericFrameInfo&); ~GenericFrameInfo(); - int64_t frame_id = 0; absl::InlinedVector encoder_buffers; }; diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 2684c4a61e..1dd8d825d9 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -251,7 +251,6 @@ VideoStreamEncoder::VideoStreamEncoder( next_frame_types_(1, VideoFrameType::kVideoFrameDelta), frame_encode_metadata_writer_(this), experiment_groups_(GetExperimentGroups()), - next_frame_id_(0), encoder_switch_experiment_(ParseEncoderSwitchFieldTrial()), automatic_animation_detection_experiment_( ParseAutomatincAnimationDetectionFieldTrial()), @@ -295,9 +294,6 @@ VideoStreamEncoder::VideoStreamEncoder( initialize_processor_event.Set(); }); initialize_processor_event.Wait(rtc::Event::kForever); - - for (auto& state : encoder_buffer_state_) - state.fill(std::numeric_limits::max()); } VideoStreamEncoder::~VideoStreamEncoder() { @@ -1499,48 +1495,8 @@ EncodedImageCallback::Result VideoStreamEncoder::OnEncodedImage( simulcast_id = encoded_image.SpatialIndex().value_or(0); } - std::unique_ptr codec_info_copy; - { - rtc::CritScope cs(&encoded_image_lock_); - - if (codec_specific_info && codec_specific_info->generic_frame_info) { - codec_info_copy = - std::make_unique(*codec_specific_info); - GenericFrameInfo& generic_info = *codec_info_copy->generic_frame_info; - generic_info.frame_id = next_frame_id_++; - - if (encoder_buffer_state_.size() <= static_cast(simulcast_id)) { - RTC_LOG(LS_ERROR) << "At most " << encoder_buffer_state_.size() - << " simulcast streams supported."; - } else { - std::array& state = - encoder_buffer_state_[simulcast_id]; - for (const CodecBufferUsage& buffer : generic_info.encoder_buffers) { - if (state.size() <= static_cast(buffer.id)) { - RTC_LOG(LS_ERROR) - << "At most " << state.size() << " encoder buffers supported."; - break; - } - - if (buffer.referenced) { - int64_t diff = generic_info.frame_id - state[buffer.id]; - if (diff <= 0) { - RTC_LOG(LS_ERROR) << "Invalid frame diff: " << diff << "."; - } else if (absl::c_find(generic_info.frame_diffs, diff) == - generic_info.frame_diffs.end()) { - generic_info.frame_diffs.push_back(diff); - } - } - - if (buffer.updated) - state[buffer.id] = generic_info.frame_id; - } - } - } - } - EncodedImageCallback::Result result = sink_->OnEncodedImage( - image_copy, codec_info_copy ? codec_info_copy.get() : codec_specific_info, + image_copy, codec_specific_info, fragmentation_copy ? fragmentation_copy.get() : fragmentation); // We are only interested in propagating the meta-data about the image, not diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h index 13b2bdf46b..193aa1e8c9 100644 --- a/video/video_stream_encoder.h +++ b/video/video_stream_encoder.h @@ -341,17 +341,6 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, // experiment group numbers incremented by 1. const std::array experiment_groups_; - // TODO(philipel): Remove this lock and run on |encoder_queue_| instead. - rtc::CriticalSection encoded_image_lock_; - - int64_t next_frame_id_ RTC_GUARDED_BY(encoded_image_lock_); - - // This array is used as a map from simulcast id to an encoder's buffer - // state. For every buffer of the encoder we keep track of the last frame id - // that updated that buffer. - std::array, kMaxSimulcastStreams> - encoder_buffer_state_ RTC_GUARDED_BY(encoded_image_lock_); - struct EncoderSwitchExperiment { struct Thresholds { absl::optional bitrate;