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/webrtc@4688 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/utility/source/video_coder.cc b/modules/utility/source/video_coder.cc
index bd8d8e8..3b69b1e 100644
--- a/modules/utility/source/video_coder.cc
+++ b/modules/utility/source/video_coder.cc
@@ -84,10 +84,6 @@
     }
 
     _decodedVideo = &decodedVideo;
-    if(_vcm->DecodeFromStorage(encodedData) != VCM_OK)
-    {
-        return -1;
-    }
     return 0;
 }
 
diff --git a/modules/video_coding/main/interface/video_coding.h b/modules/video_coding/main/interface/video_coding.h
index 51aa4bb..c4bb744 100644
--- a/modules/video_coding/main/interface/video_coding.h
+++ b/modules/video_coding/main/interface/video_coding.h
@@ -389,18 +389,6 @@
     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 @@
     //                     < 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/modules/video_coding/main/interface/video_coding_defines.h b/modules/video_coding/main/interface/video_coding_defines.h
index 193475c..ae1acd3 100644
--- a/modules/video_coding/main/interface/video_coding_defines.h
+++ b/modules/video_coding/main/interface/video_coding_defines.h
@@ -80,17 +80,6 @@
 };
 
 // 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:
   virtual int32_t FrameToRender(I420VideoFrame& videoFrame) = 0;
diff --git a/modules/video_coding/main/source/encoded_frame.cc b/modules/video_coding/main/source/encoded_frame.cc
index b6ed7ce..6274450 100644
--- a/modules/video_coding/main/source/encoded_frame.cc
+++ b/modules/video_coding/main/source/encoded_frame.cc
@@ -150,29 +150,6 @@
 }
 
 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)
 {
     if(minimumSize > _size)
diff --git a/modules/video_coding/main/source/encoded_frame.h b/modules/video_coding/main/source/encoded_frame.h
index b741236..3e73be5 100644
--- a/modules/video_coding/main/source/encoded_frame.h
+++ b/modules/video_coding/main/source/encoded_frame.h
@@ -91,8 +91,6 @@
 
     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/modules/video_coding/main/source/frame_buffer.cc b/modules/video_coding/main/source/frame_buffer.cc
index cbd5215..531c7ac 100644
--- a/modules/video_coding/main/source/frame_buffer.cc
+++ b/modules/video_coding/main/source/frame_buffer.cc
@@ -243,27 +243,6 @@
     _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/modules/video_coding/main/source/frame_buffer.h b/modules/video_coding/main/source/frame_buffer.h
index 8bd9690..eec7784 100644
--- a/modules/video_coding/main/source/frame_buffer.h
+++ b/modules/video_coding/main/source/frame_buffer.h
@@ -77,8 +77,6 @@
   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/modules/video_coding/main/source/video_coding_impl.cc b/modules/video_coding/main/source/video_coding_impl.cc
index c354a5a..39d6eeb 100644
--- a/modules/video_coding/main/source/video_coding_impl.cc
+++ b/modules/video_coding/main/source/video_coding_impl.cc
@@ -59,7 +59,6 @@
       _decodedFrameCallback(_timing, clock_),
       _dualDecodedFrameCallback(_dualTiming, clock_),
       _frameTypeCallback(NULL),
-      _frameStorageCallback(NULL),
       _receiveStatsCallback(NULL),
       _packetRequestCallback(NULL),
       render_buffer_callback_(NULL),
@@ -712,7 +711,6 @@
     _decodedFrameCallback.SetUserReceiveCallback(NULL);
     _receiverInited = true;
     _frameTypeCallback = NULL;
-    _frameStorageCallback = NULL;
     _receiveStatsCallback = NULL;
     _packetRequestCallback = NULL;
     _keyRequestMode = kKeyOnError;
@@ -765,14 +763,6 @@
 }
 
 int32_t
-VideoCodingModuleImpl::RegisterFrameStorageCallback(
-    VCMFrameStorageCallback* frameStorageCallback) {
-    CriticalSectionScoped cs(_receiveCritSect);
-    _frameStorageCallback = frameStorageCallback;
-    return VCM_OK;
-}
-
-int32_t
 VideoCodingModuleImpl::RegisterPacketRequestCallback(
     VCMPacketRequestCallback* callback) {
     CriticalSectionScoped cs(_receiveCritSect);
@@ -850,13 +840,6 @@
           }
         }
 #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 @@
     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/modules/video_coding/main/source/video_coding_impl.h b/modules/video_coding/main/source/video_coding_impl.h
index 2390c51..6af45c0 100644
--- a/modules/video_coding/main/source/video_coding_impl.h
+++ b/modules/video_coding/main/source/video_coding_impl.h
@@ -188,10 +188,6 @@
     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 @@
                                          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 @@
     VCMDecodedFrameCallback             _decodedFrameCallback;
     VCMDecodedFrameCallback             _dualDecodedFrameCallback;
     VCMFrameTypeCallback*               _frameTypeCallback;
-    VCMFrameStorageCallback*            _frameStorageCallback;
     VCMReceiveStatisticsCallback*       _receiveStatsCallback;
     VCMPacketRequestCallback*           _packetRequestCallback;
     VCMRenderBufferSizeCallback*        render_buffer_callback_;
diff --git a/modules/video_coding/main/source/video_coding_test.gypi b/modules/video_coding/main/source/video_coding_test.gypi
index 19c075a..9dd68af 100644
--- a/modules/video_coding/main/source/video_coding_test.gypi
+++ b/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/modules/video_coding/main/test/tester_main.cc b/modules/video_coding/main/test/tester_main.cc
index eec5902..bf17ab2 100644
--- a/modules/video_coding/main/test/tester_main.cc
+++ b/modules/video_coding/main/test/tester_main.cc
@@ -121,9 +121,6 @@
       ret = RtpPlayMT(args);
       break;
     case 9:
-      ret = DecodeFromStorageTest(args);
-      break;
-    case 10:
       qualityModeTest(args);
       break;
     default:
diff --git a/modules/video_coding/main/test/vcm_payload_sink_factory.cc b/modules/video_coding/main/test/vcm_payload_sink_factory.cc
index ef8866c..da41497 100644
--- a/modules/video_coding/main/test/vcm_payload_sink_factory.cc
+++ b/modules/video_coding/main/test/vcm_payload_sink_factory.cc
@@ -24,8 +24,7 @@
 
 class VcmPayloadSinkFactory::VcmPayloadSink
     : public PayloadSinkInterface,
-      public VCMPacketRequestCallback,
-      public VCMFrameStorageCallback {
+      public VCMPacketRequestCallback {
  public:
   VcmPayloadSink(VcmPayloadSinkFactory* factory,
                  RtpStreamInterface* stream,
@@ -51,7 +50,6 @@
     if (vcm_playback_.get() == NULL) {
       vcm_->RegisterReceiveCallback(frame_receiver_.get());
     } else {
-      vcm_->RegisterFrameStorageCallback(this);
       vcm_playback_->RegisterReceiveCallback(frame_receiver_.get());
     }
   }
@@ -81,13 +79,6 @@
     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 @@
 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 @@
       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 @@
   }
 
   scoped_ptr<VideoCodingModule> 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 @@
       if (vcm->RegisterReceiveCodec(&codec, 1) < 0) {
         return NULL;
       }
-      if (use_frame_storage_) {
-        if (vcm_playback->RegisterReceiveCodec(&codec, 1) < 0) {
-          return NULL;
-        }
-      }
     }
   }
 
diff --git a/modules/video_coding/main/test/vcm_payload_sink_factory.h b/modules/video_coding/main/test/vcm_payload_sink_factory.h
index aa4dfa3..a891b5c 100644
--- a/modules/video_coding/main/test/vcm_payload_sink_factory.h
+++ b/modules/video_coding/main/test/vcm_payload_sink_factory.h
@@ -29,8 +29,7 @@
                         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 @@
   uint32_t rtt_ms_;
   uint32_t render_delay_ms_;
   uint32_t min_playout_delay_ms_;
-  bool use_frame_storage_;
   scoped_ptr<NullEventFactory> null_event_factory_;
   scoped_ptr<CriticalSectionWrapper> crit_sect_;
   Sinks sinks_;
diff --git a/modules/video_coding/main/test/video_rtp_play.cc b/modules/video_coding/main/test/video_rtp_play.cc
index be578bb..b285056 100644
--- a/modules/video_coding/main/test/video_rtp_play.cc
+++ b/modules/video_coding/main/test/video_rtp_play.cc
@@ -49,7 +49,7 @@
   webrtc::SimulatedClock clock(0);
   webrtc::rtpplayer::VcmPayloadSinkFactory factory(output_file, &clock,
       kConfigProtectionEnabled, kConfigProtectionMethod, kConfigRttMs,
-      kConfigRenderDelayMs, kConfigMinPlayoutDelayMs, false);
+      kConfigRenderDelayMs, kConfigMinPlayoutDelayMs);
   webrtc::scoped_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player(
       webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types,
           kConfigLossRate, kConfigRttMs, kConfigReordering));
diff --git a/modules/video_coding/main/test/video_rtp_play_mt.cc b/modules/video_coding/main/test/video_rtp_play_mt.cc
index d9dbb35..5033fee 100644
--- a/modules/video_coding/main/test/video_rtp_play_mt.cc
+++ b/modules/video_coding/main/test/video_rtp_play_mt.cc
@@ -81,7 +81,7 @@
   webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock();
   VcmPayloadSinkFactory factory(output_file, clock, kConfigProtectionEnabled,
       kConfigProtectionMethod, kConfigRttMs, kConfigRenderDelayMs,
-      kConfigMinPlayoutDelayMs, false);
+      kConfigMinPlayoutDelayMs);
   webrtc::scoped_ptr<RtpPlayerInterface> rtp_player(webrtc::rtpplayer::Create(
       args.inputFile, &factory, clock, payload_types, kConfigLossRate,
       kConfigRttMs, kConfigReordering));
diff --git a/video_engine/vie_channel.cc b/video_engine/vie_channel.cc
index a1b0c86..4946f97 100644
--- a/video_engine/vie_channel.cc
+++ b/video_engine/vie_channel.cc
@@ -1647,11 +1647,6 @@
   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/video_engine/vie_channel.h b/video_engine/vie_channel.h
index 90665e8..9791e10 100644
--- a/video_engine/vie_channel.h
+++ b/video_engine/vie_channel.h
@@ -53,7 +53,6 @@
       public VCMReceiveCallback,
       public VCMReceiveStatisticsCallback,
       public VCMPacketRequestCallback,
-      public VCMFrameStorageCallback,
       public RtcpFeedback,
       public RtpFeedback,
       public ViEFrameProviderBase {
@@ -282,10 +281,6 @@
   // 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);