Removing encoder reset. Function did not make sence.

Review URL: https://webrtc-codereview.appspot.com/391005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1674 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-02-13 09:03:53 +00:00
parent 567d507707
commit 52fd98d876
15 changed files with 12 additions and 106 deletions

View File

@ -527,7 +527,7 @@ WebRtc_Word32 VideoFilePlayerImpl::StopPlayingFile()
CriticalSectionScoped lock( _critSec);
_decodedVideoFrames = 0;
_videoDecoder.Reset();
_videoDecoder.ResetDecoder();
return FilePlayerImpl::StopPlayingFile();
}

View File

@ -447,7 +447,6 @@ WebRtc_Word32 AviRecorder::StopRecording()
_timeEvent.StopTimer();
StopThread();
_videoEncoder->Reset();
return FileRecorderImpl::StopRecording();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -30,10 +30,9 @@ VideoCoder::~VideoCoder()
VideoCodingModule::Destroy(_vcm);
}
WebRtc_Word32 VideoCoder::Reset()
WebRtc_Word32 VideoCoder::ResetDecoder()
{
_vcm->ResetDecoder();
_vcm->ResetEncoder();
_vcm->InitializeSender();
_vcm->InitializeReceiver();
@ -108,7 +107,7 @@ WebRtc_Word32 VideoCoder::Encode(const VideoFrame& videoFrame,
return 0;
}
WebRtc_Word8 VideoCoder::DefaultPayloadType(const WebRtc_Word8* plName)
WebRtc_Word8 VideoCoder::DefaultPayloadType(const char* plName)
{
VideoCodec tmpCodec;
WebRtc_Word32 numberOfCodecs = _vcm->NumberOfCodecs();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -23,7 +23,7 @@ public:
VideoCoder(WebRtc_UWord32 instanceID);
~VideoCoder();
WebRtc_Word32 Reset();
WebRtc_Word32 ResetDecoder();
WebRtc_Word32 SetEncodeCodec(VideoCodec& videoCodecInst,
WebRtc_UWord32 numberOfCores,
@ -41,7 +41,7 @@ public:
WebRtc_Word32 Encode(const VideoFrame& videoFrame,
EncodedVideoData& videoEncodedData);
WebRtc_Word8 DefaultPayloadType(const WebRtc_Word8* plName);
WebRtc_Word8 DefaultPayloadType(const char* plName);
private:
// VCMReceiveCallback function.

View File

@ -65,12 +65,6 @@ public:
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 Release();
// Reset encoder state and prepare for a new call.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// <0 - Error
virtual WebRtc_Word32 Reset();
virtual WebRtc_Word32 SetRates(WebRtc_UWord32 /*newBitRate*/,
WebRtc_UWord32 /*frameRate*/)
{return WEBRTC_VIDEO_CODEC_OK;}

View File

@ -45,17 +45,6 @@ I420Encoder::Release()
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32
I420Encoder::Reset()
{
if (!_inited)
{
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32
I420Encoder::InitEncode(const VideoCodec* codecSettings,
WebRtc_Word32 /*numberOfCores*/,

View File

@ -115,11 +115,6 @@ public:
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 Release() = 0;
// Reset encoder state and prepare for a new call.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 Reset() = 0;
// Inform the encoder about the packet loss and round trip time on the
// network used to decide the best pattern and signaling.
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -373,7 +373,6 @@ UnitTest::Perform()
VideoBufferToRawImage(_inputVideoBuffer, inputImage);
EXPECT_TRUE(_encoder->Encode(inputImage, NULL, &videoFrameType )
== WEBRTC_VIDEO_CODEC_UNINITIALIZED);
EXPECT_TRUE(_encoder->Reset() == WEBRTC_VIDEO_CODEC_UNINITIALIZED);
//-- InitEncode() errors --
// Null pointer.
@ -475,7 +474,6 @@ UnitTest::Perform()
EXPECT_TRUE(_encoder->Encode(inputImage, NULL, &videoFrameType) ==
WEBRTC_VIDEO_CODEC_OK);
WaitForEncodedFrame();
EXPECT_TRUE(_encoder->Reset() == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) == WEBRTC_VIDEO_CODEC_OK);
_encoder->Encode(inputImage, NULL, &videoFrameType);
frameLength = WaitForEncodedFrame();
@ -679,7 +677,6 @@ UnitTest::Perform()
_inst.maxBitrate = 0;
//-- Timestamp propagation --
EXPECT_TRUE(_encoder->Reset() == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_decoder->Reset() == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_decoder->InitDecode(&_inst, 1) == WEBRTC_VIDEO_CODEC_OK);
@ -745,7 +742,6 @@ UnitTest::RateControlTests()
// Do not specify maxBitRate (as in ViE).
_inst.maxBitrate = 0;
//-- Verify rate control --
EXPECT_TRUE(_encoder->Reset() == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_encoder->InitEncode(&_inst, 1, 1440) == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_decoder->Reset() == WEBRTC_VIDEO_CODEC_OK);
EXPECT_TRUE(_decoder->InitDecode(&_inst, 1) == WEBRTC_VIDEO_CODEC_OK);
@ -759,7 +755,6 @@ UnitTest::RateControlTests()
{
_bitRate = bitRate[i];
int totalBytes = 0;
_encoder->Reset();
_inst.startBitrate = _bitRate;
_encoder->InitEncode(&_inst, 4, 1440);
_decoder->Reset();

View File

@ -39,14 +39,6 @@ class VP8Encoder : public VideoEncoder {
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual int Release();
// Reset encoder state and prepare for a new call.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_ERROR
virtual int Reset();
// Initialize the encoder with the information from the codecSettings
//
// Input:

View File

@ -91,24 +91,6 @@ int VP8Encoder::Release() {
return WEBRTC_VIDEO_CODEC_OK;
}
int VP8Encoder::Reset() {
if (!inited_) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
if (encoder_ != NULL) {
if (vpx_codec_destroy(encoder_)) {
return WEBRTC_VIDEO_CODEC_MEMORY;
}
delete encoder_;
encoder_ = NULL;
}
timestamp_ = 0;
encoder_ = new vpx_codec_ctx_t;
rps_->Init();
return InitAndSetControlSettings();
}
int VP8Encoder::SetRates(uint32_t new_bitrate_kbit, uint32_t new_framerate) {
if (!inited_) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -91,13 +91,6 @@ public:
// < 0, on error.
virtual WebRtc_Word32 InitializeSender() = 0;
// Resets the encoder state to the same state as when the encoder
// was created.
//
// Return value : VCM_OK, on success.
// < 0, on error.
virtual WebRtc_Word32 ResetEncoder() = 0;
// Registers a codec to be used for encoding. Calling this
// API multiple times overwrites any previously registered codecs.
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -33,15 +33,6 @@ VCMGenericEncoder::~VCMGenericEncoder()
{
}
WebRtc_Word32
VCMGenericEncoder::Reset()
{
_bitRate = 0;
_frameRate = 0;
_VCMencodedFrameCallback = NULL;
return _encoder.Reset();
}
WebRtc_Word32 VCMGenericEncoder::Release()
{
_bitRate = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -81,10 +81,6 @@ public:
VCMGenericEncoder(VideoEncoder& encoder, bool internalSource = false);
~VCMGenericEncoder();
/**
* Reset the encoder state, prepare for a new call
*/
WebRtc_Word32 Reset();
/**
* Free encoder memory
*/
WebRtc_Word32 Release();

View File

@ -344,22 +344,6 @@ VideoCodingModuleImpl::InitializeSender()
return VCM_OK;
}
// Makes sure the encoder is in its initial state.
WebRtc_Word32
VideoCodingModuleImpl::ResetEncoder()
{
WEBRTC_TRACE(webrtc::kTraceModuleCall,
webrtc::kTraceVideoCoding,
VCMId(_id),
"ResetEncoder()");
CriticalSectionScoped cs(_sendCritSect);
if (_encoder != NULL)
{
return _encoder->Reset();
}
return VCM_OK;
}
// Register the send codec to be used.
WebRtc_Word32
VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -81,9 +81,6 @@ public:
// Initialize send codec
virtual WebRtc_Word32 InitializeSender();
// Makes sure the encoder is in its initial state.
virtual WebRtc_Word32 ResetEncoder();
// Register the send codec to be used.
virtual WebRtc_Word32 RegisterSendCodec(const VideoCodec* sendCodec,
WebRtc_UWord32 numberOfCores,