Remove use of vcm->ResetDecoder from modules/utility.
R=asapersson@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2203006
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4750 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/utility/source/file_player_impl.cc b/webrtc/modules/utility/source/file_player_impl.cc
index 1a2b674..9240e64 100644
--- a/webrtc/modules/utility/source/file_player_impl.cc
+++ b/webrtc/modules/utility/source/file_player_impl.cc
@@ -457,8 +457,8 @@
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
VideoFilePlayerImpl::VideoFilePlayerImpl(uint32_t instanceID,
FileFormats fileFormat)
- : FilePlayerImpl(instanceID,fileFormat),
- _videoDecoder(*new VideoCoder(instanceID)),
+ : FilePlayerImpl(instanceID, fileFormat),
+ video_decoder_(new VideoCoder(instanceID)),
video_codec_info_(),
_decodedVideoFrames(0),
_encodedData(*new EncodedVideoData()),
@@ -468,16 +468,15 @@
_accumulatedRenderTimeMs(0),
_frameLengthMS(0),
_numberOfFramesRead(0),
- _videoOnly(false)
-{
- memset(&video_codec_info_, 0, sizeof(video_codec_info_));
+ _videoOnly(false) {
+ memset(&video_codec_info_, 0, sizeof(video_codec_info_));
}
VideoFilePlayerImpl::~VideoFilePlayerImpl()
{
delete _critSec;
delete &_frameScaler;
- delete &_videoDecoder;
+ video_decoder_.reset();
delete &_encodedData;
}
@@ -523,7 +522,7 @@
CriticalSectionScoped lock( _critSec);
_decodedVideoFrames = 0;
- _videoDecoder.ResetDecoder();
+ video_decoder_.reset(new VideoCoder(_instanceID));
return FilePlayerImpl::StopPlayingFile();
}
@@ -578,7 +577,7 @@
// Set the timestamp manually since there is no timestamp in the file.
// Update timestam according to 90 kHz stream.
_encodedData.timeStamp += (90000 / video_codec_info_.maxFramerate);
- retVal = _videoDecoder.Decode(videoFrame, _encodedData);
+ retVal = video_decoder_->Decode(videoFrame, _encodedData);
}
int64_t renderTimeMs = TickTime::MillisecondTimestamp();
@@ -696,14 +695,13 @@
}
int32_t useNumberOfCores = 1;
- if(_videoDecoder.SetDecodeCodec(video_codec_info_, useNumberOfCores) != 0)
- {
- WEBRTC_TRACE(
- kTraceWarning,
- kTraceVideo,
- _instanceID,
- "FilePlayerImpl::SetUpVideoDecoder() codec %s not supported",
- video_codec_info_.plName);
+ if (video_decoder_->SetDecodeCodec(video_codec_info_, useNumberOfCores) !=
+ 0) {
+ WEBRTC_TRACE(kTraceWarning,
+ kTraceVideo,
+ _instanceID,
+ "FilePlayerImpl::SetUpVideoDecoder() codec %s not supported",
+ video_codec_info_.plName);
return -1;
}
diff --git a/webrtc/modules/utility/source/file_player_impl.h b/webrtc/modules/utility/source/file_player_impl.h
index aae1ae9..e1ba420 100644
--- a/webrtc/modules/utility/source/file_player_impl.h
+++ b/webrtc/modules/utility/source/file_player_impl.h
@@ -101,7 +101,7 @@
private:
int32_t SetUpVideoDecoder();
- VideoCoder& _videoDecoder;
+ scoped_ptr<VideoCoder> video_decoder_;
VideoCodec video_codec_info_;
int32_t _decodedVideoFrames;
diff --git a/webrtc/modules/utility/source/video_coder.cc b/webrtc/modules/utility/source/video_coder.cc
index 3b69b1e..267ed81 100644
--- a/webrtc/modules/utility/source/video_coder.cc
+++ b/webrtc/modules/utility/source/video_coder.cc
@@ -29,18 +29,6 @@
VideoCodingModule::Destroy(_vcm);
}
-int32_t VideoCoder::ResetDecoder()
-{
- _vcm->ResetDecoder();
-
- _vcm->InitializeSender();
- _vcm->InitializeReceiver();
-
- _vcm->RegisterTransportCallback(this);
- _vcm->RegisterReceiveCallback(this);
- return 0;
-}
-
int32_t VideoCoder::SetEncodeCodec(VideoCodec& videoCodecInst,
uint32_t numberOfCores,
uint32_t maxPayloadSize)
diff --git a/webrtc/modules/utility/source/video_coder.h b/webrtc/modules/utility/source/video_coder.h
index 696da05..cb8bfa5 100644
--- a/webrtc/modules/utility/source/video_coder.h
+++ b/webrtc/modules/utility/source/video_coder.h
@@ -23,8 +23,6 @@
VideoCoder(uint32_t instanceID);
~VideoCoder();
- int32_t ResetDecoder();
-
int32_t SetEncodeCodec(VideoCodec& videoCodecInst,
uint32_t numberOfCores,
uint32_t maxPayloadSize);