Add CurrentLayerId() to temporal layers.
same patch as: https://webrtc-codereview.appspot.com/2427004/ TBR=holmer@google.com Review URL: https://webrtc-codereview.appspot.com/2729004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5012 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
		| @@ -36,6 +36,13 @@ DefaultTemporalLayers::DefaultTemporalLayers(int numberOfTemporalLayers, | |||||||
|   memset(temporal_pattern_, 0, sizeof(temporal_pattern_)); |   memset(temporal_pattern_, 0, sizeof(temporal_pattern_)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int DefaultTemporalLayers::CurrentLayerId() const { | ||||||
|  |   assert(temporal_ids_length_ > 0); | ||||||
|  |   int index = pattern_idx_ % temporal_ids_length_; | ||||||
|  |   assert(index >= 0); | ||||||
|  |   return temporal_ids_[index]; | ||||||
|  |  } | ||||||
|  |  | ||||||
| bool DefaultTemporalLayers::ConfigureBitrates(int bitrateKbit, | bool DefaultTemporalLayers::ConfigureBitrates(int bitrateKbit, | ||||||
|                                               int max_bitrate_kbit, |                                               int max_bitrate_kbit, | ||||||
|                                               int framerate, |                                               int framerate, | ||||||
| @@ -247,8 +254,7 @@ void DefaultTemporalLayers::PopulateCodecSpecific( | |||||||
|     vp8_info->temporalIdx = 0; |     vp8_info->temporalIdx = 0; | ||||||
|     vp8_info->layerSync = true; |     vp8_info->layerSync = true; | ||||||
|     } else { |     } else { | ||||||
|       vp8_info->temporalIdx = temporal_ids_ |       vp8_info->temporalIdx = CurrentLayerId(); | ||||||
|           [pattern_idx_ % temporal_ids_length_]; |  | ||||||
|       TemporalReferences temporal_reference = |       TemporalReferences temporal_reference = | ||||||
|           temporal_pattern_[pattern_idx_ % temporal_pattern_length_]; |           temporal_pattern_[pattern_idx_ % temporal_pattern_length_]; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ class DefaultTemporalLayers : public TemporalLayers { | |||||||
|  |  | ||||||
|   virtual void FrameEncoded(unsigned int size, uint32_t timestamp) {} |   virtual void FrameEncoded(unsigned int size, uint32_t timestamp) {} | ||||||
|  |  | ||||||
|  |   virtual int CurrentLayerId() const; | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   enum TemporalReferences { |   enum TemporalReferences { | ||||||
|     // For 1 layer case: reference all (last, golden, and alt ref), but only |     // For 1 layer case: reference all (last, golden, and alt ref), but only | ||||||
|   | |||||||
| @@ -189,7 +189,7 @@ class RealTimeTemporalLayers : public TemporalLayers { | |||||||
|     return encode_flags_[index]; |     return encode_flags_[index]; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   unsigned int CurrentLayerId() const { |   virtual int CurrentLayerId() const { | ||||||
|     assert(layer_ids_length_ > 0 && layer_ids_ != NULL); |     assert(layer_ids_length_ > 0 && layer_ids_ != NULL); | ||||||
|     int index = frame_counter_ % layer_ids_length_; |     int index = frame_counter_ % layer_ids_length_; | ||||||
|     assert(index >= 0 && index < layer_ids_length_); |     assert(index >= 0 && index < layer_ids_length_); | ||||||
|   | |||||||
| @@ -49,6 +49,8 @@ class TemporalLayers { | |||||||
|                                      uint32_t timestamp) = 0; |                                      uint32_t timestamp) = 0; | ||||||
|  |  | ||||||
|   virtual void FrameEncoded(unsigned int size, uint32_t timestamp) = 0; |   virtual void FrameEncoded(unsigned int size, uint32_t timestamp) = 0; | ||||||
|  |  | ||||||
|  |   virtual int CurrentLayerId() const = 0; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // Factory for a temporal layers strategy that adaptively changes the number of | // Factory for a temporal layers strategy that adaptively changes the number of | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 marpan@webrtc.org
					marpan@webrtc.org