Add temporal layer factory.
R=marpan@google.com, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2180004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4691 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
016eec0983
commit
5500d93fe5
@ -277,4 +277,10 @@ void DefaultTemporalLayers::PopulateCodecSpecific(
|
||||
vp8_info->tl0PicIdx = tl0_pic_idx_;
|
||||
}
|
||||
}
|
||||
|
||||
TemporalLayers* TemporalLayers::Factory::Create(
|
||||
int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const {
|
||||
return new DefaultTemporalLayers(temporal_layers, initial_tl0_pic_idx);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
@ -24,6 +24,13 @@ struct CodecSpecificInfoVP8;
|
||||
|
||||
class TemporalLayers {
|
||||
public:
|
||||
struct Factory {
|
||||
Factory() {}
|
||||
virtual ~Factory() {}
|
||||
virtual TemporalLayers* Create(int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const;
|
||||
};
|
||||
|
||||
virtual ~TemporalLayers() {}
|
||||
|
||||
// Returns the recommended VP8 encode flags needed. May refresh the decoder
|
||||
|
@ -23,9 +23,10 @@
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx/vp8dx.h"
|
||||
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/interface/module_common_types.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/reference_picture_selection.h"
|
||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||
@ -153,10 +154,16 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
||||
codec_ = *inst;
|
||||
}
|
||||
|
||||
// TODO(andresp): assert(inst->extra_options) and cleanup.
|
||||
Config default_options;
|
||||
const Config& options =
|
||||
inst->extra_options ? *inst->extra_options : default_options;
|
||||
|
||||
int num_temporal_layers = inst->codecSpecific.VP8.numberOfTemporalLayers > 1 ?
|
||||
inst->codecSpecific.VP8.numberOfTemporalLayers : 1;
|
||||
assert(temporal_layers_ == NULL);
|
||||
temporal_layers_ = new DefaultTemporalLayers(num_temporal_layers, rand());
|
||||
temporal_layers_ = options.Get<TemporalLayers::Factory>()
|
||||
.Create(num_temporal_layers, rand());
|
||||
// random start 16 bits is enough.
|
||||
picture_id_ = static_cast<uint16_t>(rand()) & 0x7FFF;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user