From f1e807c0e5cc088138d194658a665f00b0ccf073 Mon Sep 17 00:00:00 2001 From: "mikhal@webrtc.org" Date: Thu, 5 Sep 2013 22:34:41 +0000 Subject: [PATCH] Removing FrameForStorage R=pwestin@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2142004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4688 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/utility/source/video_coder.cc | 4 --- .../main/interface/video_coding.h | 23 -------------- .../main/interface/video_coding_defines.h | 11 ------- .../video_coding/main/source/encoded_frame.cc | 23 -------------- .../video_coding/main/source/encoded_frame.h | 2 -- .../video_coding/main/source/frame_buffer.cc | 21 ------------- .../video_coding/main/source/frame_buffer.h | 2 -- .../main/source/video_coding_impl.cc | 28 ----------------- .../main/source/video_coding_impl.h | 10 ------ .../main/source/video_coding_test.gypi | 1 - .../video_coding/main/test/tester_main.cc | 3 -- .../main/test/vcm_payload_sink_factory.cc | 31 ++----------------- .../main/test/vcm_payload_sink_factory.h | 4 +-- .../video_coding/main/test/video_rtp_play.cc | 2 +- .../main/test/video_rtp_play_mt.cc | 2 +- webrtc/video_engine/vie_channel.cc | 5 --- webrtc/video_engine/vie_channel.h | 5 --- 17 files changed, 5 insertions(+), 172 deletions(-) diff --git a/webrtc/modules/utility/source/video_coder.cc b/webrtc/modules/utility/source/video_coder.cc index bd8d8e841e..3b69b1ea1b 100644 --- a/webrtc/modules/utility/source/video_coder.cc +++ b/webrtc/modules/utility/source/video_coder.cc @@ -84,10 +84,6 @@ int32_t VideoCoder::Decode(I420VideoFrame& decodedVideo, } _decodedVideo = &decodedVideo; - if(_vcm->DecodeFromStorage(encodedData) != VCM_OK) - { - return -1; - } return 0; } diff --git a/webrtc/modules/video_coding/main/interface/video_coding.h b/webrtc/modules/video_coding/main/interface/video_coding.h index 51aa4bb0f7..c4bb744cd6 100644 --- a/webrtc/modules/video_coding/main/interface/video_coding.h +++ b/webrtc/modules/video_coding/main/interface/video_coding.h @@ -389,18 +389,6 @@ public: virtual int32_t RegisterFrameTypeCallback( VCMFrameTypeCallback* frameTypeCallback) = 0; - // Register a frame storage callback. This callback will be called right before an - // encoded frame is given to the decoder. Useful for recording the incoming video sequence. - // - // Input: - // - frameStorageCallback : The callback object used by the module - // to store a received encoded frame. - // - // Return value : VCM_OK, on success. - // < 0, on error. - virtual int32_t RegisterFrameStorageCallback( - VCMFrameStorageCallback* frameStorageCallback) = 0; - // Registers a callback which is called whenever the receive side of the VCM // encounters holes in the packet sequence and needs packets to be retransmitted. // @@ -435,17 +423,6 @@ public: // < 0, on error. virtual int32_t DecodeDualFrame(uint16_t maxWaitTimeMs = 200) = 0; - // Decodes a frame and sets an appropriate render time in ms relative to the system time. - // Should be used in conjunction with VCMFrameStorageCallback. - // - // Input: - // - frameFromStorage : Encoded frame read from file or received through - // the VCMFrameStorageCallback callback. - // - // Return value: : VCM_OK, on success - // < 0, on error - virtual int32_t DecodeFromStorage(const EncodedVideoData& frameFromStorage) = 0; - // Reset the decoder state to the initial state. // // Return value : VCM_OK, on success. diff --git a/webrtc/modules/video_coding/main/interface/video_coding_defines.h b/webrtc/modules/video_coding/main/interface/video_coding_defines.h index 193475c665..ae1acd3100 100644 --- a/webrtc/modules/video_coding/main/interface/video_coding_defines.h +++ b/webrtc/modules/video_coding/main/interface/video_coding_defines.h @@ -79,17 +79,6 @@ class VCMPacketizationCallback { } }; -// Callback class used for passing decoded frames which are ready to be rendered. -class VCMFrameStorageCallback { - public: - virtual int32_t StoreReceivedFrame( - const EncodedVideoData& frameToStore) = 0; - - protected: - virtual ~VCMFrameStorageCallback() { - } -}; - // Callback class used for passing decoded frames which are ready to be rendered. class VCMReceiveCallback { public: diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.cc b/webrtc/modules/video_coding/main/source/encoded_frame.cc index b6ed7ce8a2..62744500e2 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.cc +++ b/webrtc/modules/video_coding/main/source/encoded_frame.cc @@ -149,29 +149,6 @@ const RTPFragmentationHeader* VCMEncodedFrame::FragmentationHeader() const { return &_fragmentation; } -int32_t -VCMEncodedFrame::Store(VCMFrameStorageCallback& storeCallback) const -{ - EncodedVideoData frameToStore; - frameToStore.codec = _codec; - if (_buffer != NULL) - { - frameToStore.VerifyAndAllocate(_length); - memcpy(frameToStore.payloadData, _buffer, _length); - frameToStore.payloadSize = _length; - } - frameToStore.completeFrame = _completeFrame; - frameToStore.encodedWidth = _encodedWidth; - frameToStore.encodedHeight = _encodedHeight; - frameToStore.frameType = ConvertFrameType(_frameType); - frameToStore.missingFrame = _missingFrame; - frameToStore.payloadType = _payloadType; - frameToStore.renderTimeMs = _renderTimeMs; - frameToStore.timeStamp = _timeStamp; - storeCallback.StoreReceivedFrame(frameToStore); - return VCM_OK; -} - int32_t VCMEncodedFrame::VerifyAndAllocate(const uint32_t minimumSize) { diff --git a/webrtc/modules/video_coding/main/source/encoded_frame.h b/webrtc/modules/video_coding/main/source/encoded_frame.h index b741236d6b..3e73be5180 100644 --- a/webrtc/modules/video_coding/main/source/encoded_frame.h +++ b/webrtc/modules/video_coding/main/source/encoded_frame.h @@ -91,8 +91,6 @@ public: const RTPFragmentationHeader* FragmentationHeader() const; - int32_t Store(VCMFrameStorageCallback& storeCallback) const; - static webrtc::FrameType ConvertFrameType(VideoFrameType frameType); static VideoFrameType ConvertFrameType(webrtc::FrameType frameType); static void ConvertFrameTypes( diff --git a/webrtc/modules/video_coding/main/source/frame_buffer.cc b/webrtc/modules/video_coding/main/source/frame_buffer.cc index cbd5215238..531c7ac112 100644 --- a/webrtc/modules/video_coding/main/source/frame_buffer.cc +++ b/webrtc/modules/video_coding/main/source/frame_buffer.cc @@ -243,27 +243,6 @@ VCMFrameBuffer::SetState(VCMFrameBufferStateEnum state) { _state = state; } -int32_t -VCMFrameBuffer::ExtractFromStorage(const EncodedVideoData& frameFromStorage) { - _frameType = ConvertFrameType(frameFromStorage.frameType); - _timeStamp = frameFromStorage.timeStamp; - _payloadType = frameFromStorage.payloadType; - _encodedWidth = frameFromStorage.encodedWidth; - _encodedHeight = frameFromStorage.encodedHeight; - _missingFrame = frameFromStorage.missingFrame; - _completeFrame = frameFromStorage.completeFrame; - _renderTimeMs = frameFromStorage.renderTimeMs; - _codec = frameFromStorage.codec; - const uint8_t *prevBuffer = _buffer; - if (VerifyAndAllocate(frameFromStorage.payloadSize) < 0) { - return VCM_MEMORY; - } - _sessionInfo.UpdateDataPointers(prevBuffer, _buffer); - memcpy(_buffer, frameFromStorage.payloadData, frameFromStorage.payloadSize); - _length = frameFromStorage.payloadSize; - return VCM_OK; -} - // Set counted status (as counted by JB or not) void VCMFrameBuffer::SetCountedFrame(bool frameCounted) { _frameCounted = frameCounted; diff --git a/webrtc/modules/video_coding/main/source/frame_buffer.h b/webrtc/modules/video_coding/main/source/frame_buffer.h index 8bd9690164..eec77840a3 100644 --- a/webrtc/modules/video_coding/main/source/frame_buffer.h +++ b/webrtc/modules/video_coding/main/source/frame_buffer.h @@ -77,8 +77,6 @@ class VCMFrameBuffer : public VCMEncodedFrame { webrtc::FrameType FrameType() const; void SetPreviousFrameLoss(); - int32_t ExtractFromStorage(const EncodedVideoData& frameFromStorage); - // The number of packets discarded because the decoder can't make use of // them. int NotDecodablePackets() const; diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc index c354a5a120..39d6eeb88e 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc @@ -59,7 +59,6 @@ VideoCodingModuleImpl::VideoCodingModuleImpl(const int32_t id, _decodedFrameCallback(_timing, clock_), _dualDecodedFrameCallback(_dualTiming, clock_), _frameTypeCallback(NULL), - _frameStorageCallback(NULL), _receiveStatsCallback(NULL), _packetRequestCallback(NULL), render_buffer_callback_(NULL), @@ -712,7 +711,6 @@ VideoCodingModuleImpl::InitializeReceiver() { _decodedFrameCallback.SetUserReceiveCallback(NULL); _receiverInited = true; _frameTypeCallback = NULL; - _frameStorageCallback = NULL; _receiveStatsCallback = NULL; _packetRequestCallback = NULL; _keyRequestMode = kKeyOnError; @@ -764,14 +762,6 @@ VideoCodingModuleImpl::RegisterFrameTypeCallback( return VCM_OK; } -int32_t -VideoCodingModuleImpl::RegisterFrameStorageCallback( - VCMFrameStorageCallback* frameStorageCallback) { - CriticalSectionScoped cs(_receiveCritSect); - _frameStorageCallback = frameStorageCallback; - return VCM_OK; -} - int32_t VideoCodingModuleImpl::RegisterPacketRequestCallback( VCMPacketRequestCallback* callback) { @@ -850,13 +840,6 @@ VideoCodingModuleImpl::Decode(uint16_t maxWaitTimeMs) { } } #endif - if (_frameStorageCallback != NULL) { - int32_t ret = frame->Store(*_frameStorageCallback); - if (ret < 0) { - return ret; - } - } - const int32_t ret = Decode(*frame); _receiver.ReleaseFrame(frame); frame = NULL; @@ -1027,17 +1010,6 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame) { return ret; } -int32_t -VideoCodingModuleImpl::DecodeFromStorage( - const EncodedVideoData& frameFromStorage) { - CriticalSectionScoped cs(_receiveCritSect); - int32_t ret = _frameFromFile.ExtractFromStorage(frameFromStorage); - if (ret < 0) { - return ret; - } - return Decode(_frameFromFile); -} - // Reset the decoder state int32_t VideoCodingModuleImpl::ResetDecoder() { diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.h b/webrtc/modules/video_coding/main/source/video_coding_impl.h index 2390c51ca7..6af45c02fc 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.h +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.h @@ -188,10 +188,6 @@ public: virtual int32_t RegisterFrameTypeCallback( VCMFrameTypeCallback* frameTypeCallback); - // Register a frame storage callback. - virtual int32_t RegisterFrameStorageCallback( - VCMFrameStorageCallback* frameStorageCallback); - // Nack callback virtual int32_t RegisterPacketRequestCallback( VCMPacketRequestCallback* callback); @@ -222,11 +218,6 @@ public: uint32_t payloadLength, const WebRtcRTPHeader& rtpInfo); - // A part of an encoded frame to be decoded. - // Used in conjunction with VCMFrameStorageCallback. - virtual int32_t DecodeFromStorage( - const EncodedVideoData& frameFromStorage); - // Minimum playout delay (Used for lip-sync). This is the minimum delay // required to sync with audio. Not included in VideoCodingModule::Delay() // Defaults to 0 ms. @@ -300,7 +291,6 @@ private: VCMDecodedFrameCallback _decodedFrameCallback; VCMDecodedFrameCallback _dualDecodedFrameCallback; VCMFrameTypeCallback* _frameTypeCallback; - VCMFrameStorageCallback* _frameStorageCallback; VCMReceiveStatisticsCallback* _receiveStatsCallback; VCMPacketRequestCallback* _packetRequestCallback; VCMRenderBufferSizeCallback* render_buffer_callback_; diff --git a/webrtc/modules/video_coding/main/source/video_coding_test.gypi b/webrtc/modules/video_coding/main/source/video_coding_test.gypi index 19c075acc0..9dd68af6c2 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_test.gypi +++ b/webrtc/modules/video_coding/main/source/video_coding_test.gypi @@ -49,7 +49,6 @@ # sources '../test/codec_database_test.cc', - '../test/decode_from_storage_test.cc', '../test/generic_codec_test.cc', '../test/media_opt_test.cc', '../test/mt_test_common.cc', diff --git a/webrtc/modules/video_coding/main/test/tester_main.cc b/webrtc/modules/video_coding/main/test/tester_main.cc index eec5902ad9..bf17ab2741 100644 --- a/webrtc/modules/video_coding/main/test/tester_main.cc +++ b/webrtc/modules/video_coding/main/test/tester_main.cc @@ -121,9 +121,6 @@ int main(int argc, char **argv) { ret = RtpPlayMT(args); break; case 9: - ret = DecodeFromStorageTest(args); - break; - case 10: qualityModeTest(args); break; default: diff --git a/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.cc b/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.cc index ef8866c9a8..da4149752c 100644 --- a/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.cc +++ b/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.cc @@ -24,8 +24,7 @@ namespace rtpplayer { class VcmPayloadSinkFactory::VcmPayloadSink : public PayloadSinkInterface, - public VCMPacketRequestCallback, - public VCMFrameStorageCallback { + public VCMPacketRequestCallback { public: VcmPayloadSink(VcmPayloadSinkFactory* factory, RtpStreamInterface* stream, @@ -51,7 +50,6 @@ class VcmPayloadSinkFactory::VcmPayloadSink if (vcm_playback_.get() == NULL) { vcm_->RegisterReceiveCallback(frame_receiver_.get()); } else { - vcm_->RegisterFrameStorageCallback(this); vcm_playback_->RegisterReceiveCallback(frame_receiver_.get()); } } @@ -81,13 +79,6 @@ class VcmPayloadSinkFactory::VcmPayloadSink return 0; } - // VCMFrameStorageCallback - virtual int32_t StoreReceivedFrame( - const EncodedVideoData& frame_to_store) { - vcm_playback_->DecodeFromStorage(frame_to_store); - return VCM_OK; - } - int DecodeAndProcess(bool should_decode, bool decode_dual_frame) { if (should_decode) { if (vcm_->Decode() < 0) { @@ -128,8 +119,7 @@ class VcmPayloadSinkFactory::VcmPayloadSink VcmPayloadSinkFactory::VcmPayloadSinkFactory( const std::string& base_out_filename, Clock* clock, bool protection_enabled, VCMVideoProtection protection_method, uint32_t rtt_ms, - uint32_t render_delay_ms, uint32_t min_playout_delay_ms, - bool use_frame_storage) + uint32_t render_delay_ms, uint32_t min_playout_delay_ms) : base_out_filename_(base_out_filename), clock_(clock), protection_enabled_(protection_enabled), @@ -137,7 +127,6 @@ VcmPayloadSinkFactory::VcmPayloadSinkFactory( rtt_ms_(rtt_ms), render_delay_ms_(render_delay_ms), min_playout_delay_ms_(min_playout_delay_ms), - use_frame_storage_(use_frame_storage), null_event_factory_(new NullEventFactory()), crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), sinks_(), @@ -165,17 +154,6 @@ PayloadSinkInterface* VcmPayloadSinkFactory::Create( } scoped_ptr vcm_playback; - if (use_frame_storage_) { - vcm_playback.reset( - VideoCodingModule::Create(next_id_++, clock_, - null_event_factory_.get())); - if (vcm_playback.get() == NULL) { - return NULL; - } - if (vcm_playback->InitializeReceiver() < 0) { - return NULL; - } - } const PayloadTypes& plt = stream->payload_types(); for (PayloadTypesIterator it = plt.begin(); it != plt.end(); @@ -190,11 +168,6 @@ PayloadSinkInterface* VcmPayloadSinkFactory::Create( if (vcm->RegisterReceiveCodec(&codec, 1) < 0) { return NULL; } - if (use_frame_storage_) { - if (vcm_playback->RegisterReceiveCodec(&codec, 1) < 0) { - return NULL; - } - } } } diff --git a/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.h b/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.h index aa4dfa3da8..a891b5c649 100644 --- a/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.h +++ b/webrtc/modules/video_coding/main/test/vcm_payload_sink_factory.h @@ -29,8 +29,7 @@ class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface { Clock* clock, bool protection_enabled, VCMVideoProtection protection_method, uint32_t rtt_ms, uint32_t render_delay_ms, - uint32_t min_playout_delay_ms, - bool use_frame_storage); + uint32_t min_playout_delay_ms); virtual ~VcmPayloadSinkFactory(); // PayloadSinkFactoryInterface @@ -54,7 +53,6 @@ class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface { uint32_t rtt_ms_; uint32_t render_delay_ms_; uint32_t min_playout_delay_ms_; - bool use_frame_storage_; scoped_ptr null_event_factory_; scoped_ptr crit_sect_; Sinks sinks_; diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play.cc b/webrtc/modules/video_coding/main/test/video_rtp_play.cc index be578bbd55..b2850563f7 100644 --- a/webrtc/modules/video_coding/main/test/video_rtp_play.cc +++ b/webrtc/modules/video_coding/main/test/video_rtp_play.cc @@ -49,7 +49,7 @@ int RtpPlay(const CmdArgs& args) { webrtc::SimulatedClock clock(0); webrtc::rtpplayer::VcmPayloadSinkFactory factory(output_file, &clock, kConfigProtectionEnabled, kConfigProtectionMethod, kConfigRttMs, - kConfigRenderDelayMs, kConfigMinPlayoutDelayMs, false); + kConfigRenderDelayMs, kConfigMinPlayoutDelayMs); webrtc::scoped_ptr rtp_player( webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types, kConfigLossRate, kConfigRttMs, kConfigReordering)); diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc index d9dbb35da5..5033fee898 100644 --- a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc +++ b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc @@ -81,7 +81,7 @@ int RtpPlayMT(const CmdArgs& args) { webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock(); VcmPayloadSinkFactory factory(output_file, clock, kConfigProtectionEnabled, kConfigProtectionMethod, kConfigRttMs, kConfigRenderDelayMs, - kConfigMinPlayoutDelayMs, false); + kConfigMinPlayoutDelayMs); webrtc::scoped_ptr rtp_player(webrtc::rtpplayer::Create( args.inputFile, &factory, clock, payload_types, kConfigLossRate, kConfigRttMs, kConfigReordering)); diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index a1b0c86d17..4946f978ed 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -1647,11 +1647,6 @@ void ViEChannel::IncomingCodecChanged(const VideoCodec& codec) { receive_codec_ = codec; } -int32_t ViEChannel::StoreReceivedFrame( - const EncodedVideoData& frame_to_store) { - return 0; -} - int32_t ViEChannel::OnReceiveStatisticsUpdate(const uint32_t bit_rate, const uint32_t frame_rate) { CriticalSectionScoped cs(callback_cs_.get()); diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 90665e8cbe..9791e102d7 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -53,7 +53,6 @@ class ViEChannel public VCMReceiveCallback, public VCMReceiveStatisticsCallback, public VCMPacketRequestCallback, - public VCMFrameStorageCallback, public RtcpFeedback, public RtpFeedback, public ViEFrameProviderBase { @@ -282,10 +281,6 @@ class ViEChannel // Implements VCMReceiveCallback. virtual void IncomingCodecChanged(const VideoCodec& codec); - // Implements VCM. - virtual int32_t StoreReceivedFrame( - const EncodedVideoData& frame_to_store); - // Implements VideoReceiveStatisticsCallback. virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bit_rate, const uint32_t frame_rate);