Add codec name to CodecSpecificInfo and get the codec name stats from there instead.
BUG=webrtc:5687 Review-Url: https://codereview.webrtc.org/2253563002 Cr-Commit-Position: refs/heads/master@{#14012}
This commit is contained in:
@ -410,6 +410,7 @@ EncodedImageCallback::Result SimulcastEncoderAdapter::OnEncodedImage(
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
CodecSpecificInfo stream_codec_specific = *codecSpecificInfo;
|
||||
stream_codec_specific.codec_name = implementation_name_.c_str();
|
||||
CodecSpecificInfoVP8* vp8Info = &(stream_codec_specific.codecSpecific.VP8);
|
||||
vp8Info->simulcastIdx = stream_idx;
|
||||
|
||||
|
||||
@ -960,6 +960,7 @@ void VP8EncoderImpl::PopulateCodecSpecific(
|
||||
bool only_predicting_from_key_frame) {
|
||||
assert(codec_specific != NULL);
|
||||
codec_specific->codecType = kVideoCodecVP8;
|
||||
codec_specific->codec_name = ImplementationName();
|
||||
CodecSpecificInfoVP8* vp8Info = &(codec_specific->codecSpecific.VP8);
|
||||
vp8Info->pictureId = picture_id_[stream_idx];
|
||||
if (pkt.data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
|
||||
@ -560,6 +560,7 @@ void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
|
||||
uint32_t timestamp) {
|
||||
assert(codec_specific != NULL);
|
||||
codec_specific->codecType = kVideoCodecVP9;
|
||||
codec_specific->codec_name = ImplementationName();
|
||||
CodecSpecificInfoVP9* vp9_info = &(codec_specific->codecSpecific.VP9);
|
||||
// TODO(asapersson): Set correct value.
|
||||
vp9_info->inter_pic_predicted =
|
||||
|
||||
@ -77,11 +77,6 @@ int32_t VCMGenericEncoder::Encode(const VideoFrame& frame,
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* VCMGenericEncoder::ImplementationName() const {
|
||||
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
|
||||
return encoder_->ImplementationName();
|
||||
}
|
||||
|
||||
void VCMGenericEncoder::SetEncoderParameters(const EncoderParameters& params) {
|
||||
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
|
||||
bool channel_parameters_have_changed;
|
||||
|
||||
@ -71,8 +71,6 @@ class VCMGenericEncoder {
|
||||
const CodecSpecificInfo* codec_specific,
|
||||
const std::vector<FrameType>& frame_types);
|
||||
|
||||
const char* ImplementationName() const;
|
||||
|
||||
void SetEncoderParameters(const EncoderParameters& params);
|
||||
EncoderParameters GetEncoderParameters() const;
|
||||
|
||||
|
||||
@ -90,7 +90,9 @@ union CodecSpecificInfoUnion {
|
||||
// must be fitted with a copy-constructor. This is because it is copied
|
||||
// in the copy-constructor of VCMEncodedFrame.
|
||||
struct CodecSpecificInfo {
|
||||
CodecSpecificInfo() : codecType(kVideoCodecUnknown), codec_name(nullptr) {}
|
||||
VideoCodecType codecType;
|
||||
const char* codec_name;
|
||||
CodecSpecificInfoUnion codecSpecific;
|
||||
};
|
||||
|
||||
|
||||
@ -77,9 +77,7 @@ class VCMReceiveCallback {
|
||||
// and the name of the encoder.
|
||||
class VCMSendStatisticsCallback {
|
||||
public:
|
||||
virtual void SendStatistics(uint32_t bitRate,
|
||||
uint32_t frameRate,
|
||||
const std::string& encoder_name) = 0;
|
||||
virtual void SendStatistics(uint32_t bitRate, uint32_t frameRate) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~VCMSendStatisticsCallback() {}
|
||||
|
||||
@ -113,7 +113,6 @@ class VideoSender : public Module {
|
||||
rtc::CriticalSection params_crit_;
|
||||
EncoderParameters encoder_params_ GUARDED_BY(params_crit_);
|
||||
bool encoder_has_internal_source_ GUARDED_BY(params_crit_);
|
||||
std::string encoder_name_ GUARDED_BY(params_crit_);
|
||||
std::vector<FrameType> next_frame_types_ GUARDED_BY(params_crit_);
|
||||
};
|
||||
|
||||
|
||||
@ -56,13 +56,7 @@ void VideoSender::Process() {
|
||||
if (send_stats_callback_) {
|
||||
uint32_t bitRate = _mediaOpt.SentBitRate();
|
||||
uint32_t frameRate = _mediaOpt.SentFrameRate();
|
||||
std::string encoder_name;
|
||||
{
|
||||
rtc::CritScope cs(¶ms_crit_);
|
||||
// Copy the string here so that we don't hold |params_crit_| in the CB.
|
||||
encoder_name = encoder_name_;
|
||||
}
|
||||
send_stats_callback_->SendStatistics(bitRate, frameRate, encoder_name);
|
||||
send_stats_callback_->SendStatistics(bitRate, frameRate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,8 +308,6 @@ int32_t VideoSender::AddVideoFrame(const VideoFrame& videoFrame,
|
||||
|
||||
{
|
||||
rtc::CritScope lock(¶ms_crit_);
|
||||
encoder_name_ = _encoder->ImplementationName();
|
||||
|
||||
// Change all keyframe requests to encode delta frames the next time.
|
||||
for (size_t i = 0; i < next_frame_types_.size(); ++i) {
|
||||
// Check for equality (same requested as before encoding) to not
|
||||
|
||||
Reference in New Issue
Block a user