| OLD | NEW |
| 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 2 * | 2 * |
| 3 * Use of this source code is governed by a BSD-style license | 3 * Use of this source code is governed by a BSD-style license |
| 4 * that can be found in the LICENSE file in the root of the source | 4 * that can be found in the LICENSE file in the root of the source |
| 5 * tree. An additional intellectual property rights grant can be found | 5 * tree. An additional intellectual property rights grant can be found |
| 6 * in the file PATENTS. All contributing project authors may | 6 * in the file PATENTS. All contributing project authors may |
| 7 * be found in the AUTHORS file in the root of the source tree. | 7 * be found in the AUTHORS file in the root of the source tree. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include "webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h" | 10 #include "webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h" |
| 11 | 11 |
| 12 #include <stdlib.h> | 12 #include <stdlib.h> |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include <algorithm> | 15 #include <algorithm> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
| 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
| 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 21 #include "webrtc/rtc_base/checks.h" | 21 #include "webrtc/rtc_base/checks.h" |
| 22 | 22 |
| 23 #include "vpx/vpx_encoder.h" | 23 #include "vpx/vpx_encoder.h" |
| 24 #include "vpx/vp8cx.h" | 24 #include "vpx/vp8cx.h" |
| 25 | 25 |
| 26 namespace webrtc { | 26 namespace webrtc { |
| 27 | 27 |
| 28 TemporalLayers::FrameConfig::FrameConfig() {} | 28 TemporalLayers::FrameConfig::FrameConfig() |
| 29 : FrameConfig(kNone, kNone, kNone, false) {} |
| 29 | 30 |
| 30 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, | 31 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, |
| 31 TemporalLayers::BufferFlags golden, | 32 TemporalLayers::BufferFlags golden, |
| 32 TemporalLayers::BufferFlags arf) | 33 TemporalLayers::BufferFlags arf) |
| 33 : FrameConfig(last, golden, arf, false) {} | 34 : FrameConfig(last, golden, arf, false) {} |
| 34 | 35 |
| 35 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, | 36 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, |
| 36 TemporalLayers::BufferFlags golden, | 37 TemporalLayers::BufferFlags golden, |
| 37 TemporalLayers::BufferFlags arf, | 38 TemporalLayers::BufferFlags arf, |
| 38 FreezeEntropy) | 39 FreezeEntropy) |
| 39 : FrameConfig(last, golden, arf, true) {} | 40 : FrameConfig(last, golden, arf, true) {} |
| 40 | 41 |
| 41 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, | 42 TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last, |
| 42 TemporalLayers::BufferFlags golden, | 43 TemporalLayers::BufferFlags golden, |
| 43 TemporalLayers::BufferFlags arf, | 44 TemporalLayers::BufferFlags arf, |
| 44 bool freeze_entropy) | 45 bool freeze_entropy) |
| 45 : drop_frame(last == TemporalLayers::kNone && | 46 : drop_frame(last == TemporalLayers::kNone && |
| 46 golden == TemporalLayers::kNone && | 47 golden == TemporalLayers::kNone && |
| 47 arf == TemporalLayers::kNone), | 48 arf == TemporalLayers::kNone), |
| 48 last_buffer_flags(last), | 49 last_buffer_flags(last), |
| 49 golden_buffer_flags(golden), | 50 golden_buffer_flags(golden), |
| 50 arf_buffer_flags(arf), | 51 arf_buffer_flags(arf), |
| 51 freeze_entropy(freeze_entropy) {} | 52 layer_sync(false), |
| 53 freeze_entropy(freeze_entropy), |
| 54 pattern_idx(0) {} |
| 52 | 55 |
| 53 namespace { | 56 namespace { |
| 54 | 57 |
| 55 std::vector<unsigned int> GetTemporalIds(size_t num_layers) { | 58 std::vector<unsigned int> GetTemporalIds(size_t num_layers) { |
| 56 switch (num_layers) { | 59 switch (num_layers) { |
| 57 case 1: | 60 case 1: |
| 58 // Temporal layer structure (single layer): | 61 // Temporal layer structure (single layer): |
| 59 // 0 0 0 0 ... | 62 // 0 0 0 0 ... |
| 60 return {0}; | 63 return {0}; |
| 61 case 2: | 64 case 2: |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (listener_) | 383 if (listener_) |
| 381 listener_->OnTemporalLayersCreated(simulcast_id, tl); | 384 listener_->OnTemporalLayersCreated(simulcast_id, tl); |
| 382 return tl; | 385 return tl; |
| 383 } | 386 } |
| 384 | 387 |
| 385 void TemporalLayersFactory::SetListener(TemporalLayersListener* listener) { | 388 void TemporalLayersFactory::SetListener(TemporalLayersListener* listener) { |
| 386 listener_ = listener; | 389 listener_ = listener; |
| 387 } | 390 } |
| 388 | 391 |
| 389 } // namespace webrtc | 392 } // namespace webrtc |
| OLD | NEW |