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
This commit is contained in:
@@ -84,10 +84,6 @@ int32_t VideoCoder::Decode(I420VideoFrame& decodedVideo,
|
||||
}
|
||||
|
||||
_decodedVideo = &decodedVideo;
|
||||
if(_vcm->DecodeFromStorage(encodedData) != VCM_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -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:
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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(
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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() {
|
||||
|
@@ -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_;
|
||||
|
@@ -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',
|
||||
|
@@ -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:
|
||||
|
@@ -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<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 @@ PayloadSinkInterface* VcmPayloadSinkFactory::Create(
|
||||
if (vcm->RegisterReceiveCodec(&codec, 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (use_frame_storage_) {
|
||||
if (vcm_playback->RegisterReceiveCodec(&codec, 1) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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<NullEventFactory> null_event_factory_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
Sinks sinks_;
|
||||
|
@@ -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<webrtc::rtpplayer::RtpPlayerInterface> rtp_player(
|
||||
webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types,
|
||||
kConfigLossRate, kConfigRttMs, kConfigReordering));
|
||||
|
@@ -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<RtpPlayerInterface> rtp_player(webrtc::rtpplayer::Create(
|
||||
args.inputFile, &factory, clock, payload_types, kConfigLossRate,
|
||||
kConfigRttMs, kConfigReordering));
|
||||
|
@@ -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());
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user