From 8fa436bd65e7ae31b280f3ccced74d00ea3f29d5 Mon Sep 17 00:00:00 2001 From: "andresp@webrtc.org" Date: Mon, 16 Sep 2013 11:26:35 +0000 Subject: [PATCH] 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 --- .../utility/source/file_player_impl.cc | 30 +++++++++---------- .../modules/utility/source/file_player_impl.h | 2 +- webrtc/modules/utility/source/video_coder.cc | 12 -------- webrtc/modules/utility/source/video_coder.h | 2 -- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/webrtc/modules/utility/source/file_player_impl.cc b/webrtc/modules/utility/source/file_player_impl.cc index 1a2b67498a..9240e64691 100644 --- a/webrtc/modules/utility/source/file_player_impl.cc +++ b/webrtc/modules/utility/source/file_player_impl.cc @@ -457,8 +457,8 @@ int32_t FilePlayerImpl::SetUpAudioDecoder() #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 @@ VideoFilePlayerImpl::VideoFilePlayerImpl(uint32_t instanceID, _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 @@ int32_t VideoFilePlayerImpl::StopPlayingFile() CriticalSectionScoped lock( _critSec); _decodedVideoFrames = 0; - _videoDecoder.ResetDecoder(); + video_decoder_.reset(new VideoCoder(_instanceID)); return FilePlayerImpl::StopPlayingFile(); } @@ -578,7 +577,7 @@ int32_t VideoFilePlayerImpl::GetVideoFromFile(I420VideoFrame& videoFrame) // 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 VideoFilePlayerImpl::SetUpVideoDecoder() } 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 aae1ae97f3..e1ba4208ea 100644 --- a/webrtc/modules/utility/source/file_player_impl.h +++ b/webrtc/modules/utility/source/file_player_impl.h @@ -101,7 +101,7 @@ public: private: int32_t SetUpVideoDecoder(); - VideoCoder& _videoDecoder; + scoped_ptr 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 3b69b1ea1b..267ed81048 100644 --- a/webrtc/modules/utility/source/video_coder.cc +++ b/webrtc/modules/utility/source/video_coder.cc @@ -29,18 +29,6 @@ VideoCoder::~VideoCoder() 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 696da05787..cb8bfa5a18 100644 --- a/webrtc/modules/utility/source/video_coder.h +++ b/webrtc/modules/utility/source/video_coder.h @@ -23,8 +23,6 @@ public: VideoCoder(uint32_t instanceID); ~VideoCoder(); - int32_t ResetDecoder(); - int32_t SetEncodeCodec(VideoCodec& videoCodecInst, uint32_t numberOfCores, uint32_t maxPayloadSize);