I have a custom `VideoTrackSourceInterface` impl which I try in the peerconnection sample. When it starts producing FullHD frames they are dropped in `VideoStreamEncoder::EncodeVideoFrame` with log message "Dropping frame. Too large for target bitrate.":
video_frame.size() > MaximumFrameSizeForBitrate(encoder_start_bitrate_bps_ / 1000)
and `encoder_start_bitrate_bps_` is default 300000.
How can I fix this?
I stream from a prerecorded h.264 encoded file (just a prototype for later h.264 hardware encoder), so dropping frames isn't the best idea. Also for production version it would be nice to stream high quality from the beginning.
Can I configure higher "start bitrate"? Can I do this by some configuration parameter instead of messing with SDP offer? If not, what's the proper way to do this with SDP offer?
void Conductor::OnSuccess(webrtc::SessionDescriptionInterface* desc) {
std::string sdp;
desc->ToString(&sdp);
std::regex pattern{ "m=video.*\\r\\n(?:c=.*\\r\\n)*(?:i=.*\\r\\n)*" };
sdp = std::regex_replace(sdp, pattern, "$&b=AS:5000\r\n");
std::unique_ptr<webrtc::SessionDescriptionInterface> desc_with_b = webrtc::CreateSessionDescription(desc->GetType(), sdp);
delete desc;
desc = desc_with_b.release();
peer_connection_->SetLocalDescription(
DummySetSessionDescriptionObserver::Create(), desc);
Json::StyledWriter writer;
Json::Value jmessage;
jmessage[kSessionDescriptionTypeName] =
webrtc::SdpTypeToString(desc->GetType());
jmessage[kSessionDescriptionSdpName] = sdp;
SendMessage(writer.write(jmessage));
}
thank you