Remove ReceiveCodec() getters from VideoCodingModule.
The getters are not used and the implementation cannot be guaranteed to return a correct value except when called synchronously from the decoding thread while decoding. The methods as is imply that the implementation needs to offer some sort of synchronization, and that's not desirable. BUG=webrtc:7328 R=stefan@webrtc.org Review-Url: https://codereview.webrtc.org/2741853008 . Cr-Commit-Position: refs/heads/master@{#17233}
This commit is contained in:
@ -449,22 +449,6 @@ bool VCMCodecDataBase::DeregisterReceiveCodec(uint8_t payload_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VCMCodecDataBase::ReceiveCodec(VideoCodec* current_receive_codec) const {
|
||||
RTC_DCHECK(current_receive_codec);
|
||||
if (!ptr_decoder_) {
|
||||
return false;
|
||||
}
|
||||
memcpy(current_receive_codec, &receive_codec_, sizeof(VideoCodec));
|
||||
return true;
|
||||
}
|
||||
|
||||
VideoCodecType VCMCodecDataBase::ReceiveCodec() const {
|
||||
if (!ptr_decoder_) {
|
||||
return kVideoCodecUnknown;
|
||||
}
|
||||
return receive_codec_.codecType;
|
||||
}
|
||||
|
||||
VCMGenericDecoder* VCMCodecDataBase::GetDecoder(
|
||||
const VCMEncodedFrame& frame,
|
||||
VCMDecodedFrameCallback* decoded_frame_callback) {
|
||||
|
||||
@ -98,12 +98,6 @@ class VCMCodecDataBase {
|
||||
|
||||
bool DeregisterReceiveCodec(uint8_t payload_type);
|
||||
|
||||
// Get current receive side codec. Relevant for internal codecs only.
|
||||
bool ReceiveCodec(VideoCodec* current_receive_codec) const;
|
||||
|
||||
// Get current receive side codec type. Relevant for internal codecs only.
|
||||
VideoCodecType ReceiveCodec() const;
|
||||
|
||||
// Returns a decoder specified by |payload_type|. The decoded frame callback
|
||||
// of the encoder is set to |decoded_frame_callback|. If no such decoder
|
||||
// already exists an instance will be created and initialized.
|
||||
|
||||
@ -360,22 +360,6 @@ class VideoCodingModule : public Module {
|
||||
// < 0, on error.
|
||||
virtual int32_t Decode(uint16_t maxWaitTimeMs = 200) = 0;
|
||||
|
||||
// API to get the codec which is currently used for decoding by the module.
|
||||
//
|
||||
// Input:
|
||||
// - currentReceiveCodec : Settings for the codec to be registered.
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const = 0;
|
||||
|
||||
// API to get the codec type currently used for decoding by the module.
|
||||
//
|
||||
// Return value : codecy type, on success.
|
||||
// kVideoCodecUnknown, on error or if no receive codec is
|
||||
// registered
|
||||
virtual VideoCodecType ReceiveCodec() const = 0;
|
||||
|
||||
// Insert a parsed packet into the receiver side of the module. Will be placed
|
||||
// in the
|
||||
// jitter buffer waiting for the frame to become complete. Returns as soon as
|
||||
|
||||
@ -220,14 +220,6 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
return receiver_.Decode(maxWaitTimeMs);
|
||||
}
|
||||
|
||||
int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const override {
|
||||
return receiver_.ReceiveCodec(currentReceiveCodec);
|
||||
}
|
||||
|
||||
VideoCodecType ReceiveCodec() const override {
|
||||
return receiver_.ReceiveCodec();
|
||||
}
|
||||
|
||||
int32_t IncomingPacket(const uint8_t* incomingPayload,
|
||||
size_t payloadLength,
|
||||
const WebRtcRTPHeader& rtpInfo) override {
|
||||
|
||||
@ -175,9 +175,6 @@ class VideoReceiver : public Module {
|
||||
// Called on the decoder thread when thread is exiting.
|
||||
void DecodingStopped();
|
||||
|
||||
int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const;
|
||||
VideoCodecType ReceiveCodec() const;
|
||||
|
||||
int32_t IncomingPacket(const uint8_t* incomingPayload,
|
||||
size_t payloadLength,
|
||||
const WebRtcRTPHeader& rtpInfo);
|
||||
|
||||
@ -369,26 +369,6 @@ int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get current received codec
|
||||
// TODO(tommi): See if there are any actual callers to this method.
|
||||
// Neither me nor Stefan could find callers. If we can remove it, threading
|
||||
// will be simpler.
|
||||
int32_t VideoReceiver::ReceiveCodec(VideoCodec* currentReceiveCodec) const {
|
||||
rtc::CritScope cs(&receive_crit_);
|
||||
if (currentReceiveCodec == nullptr) {
|
||||
return VCM_PARAMETER_ERROR;
|
||||
}
|
||||
return _codecDataBase.ReceiveCodec(currentReceiveCodec) ? 0 : -1;
|
||||
}
|
||||
|
||||
// Get current received codec
|
||||
// TODO(tommi): See if there are any actual callers to this method.
|
||||
// If not, it will make threading simpler.
|
||||
VideoCodecType VideoReceiver::ReceiveCodec() const {
|
||||
rtc::CritScope cs(&receive_crit_);
|
||||
return _codecDataBase.ReceiveCodec();
|
||||
}
|
||||
|
||||
// Incoming packet from network parsed and ready for decode, non blocking.
|
||||
int32_t VideoReceiver::IncomingPacket(const uint8_t* incomingPayload,
|
||||
size_t payloadLength,
|
||||
|
||||
Reference in New Issue
Block a user