Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/video_coding/session_info.h" | 11 #include "webrtc/modules/video_coding/session_info.h" |
| 12 | 12 |
| 13 #include <vector> | |
|
philipel
2016/09/15 12:52:46
in .h file
stefan-webrtc
2016/09/30 09:36:02
Done.
| |
| 14 | |
| 13 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 14 #include "webrtc/modules/video_coding/packet.h" | 16 #include "webrtc/modules/video_coding/packet.h" |
| 15 | 17 |
| 16 namespace webrtc { | 18 namespace webrtc { |
| 17 | 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| 20 uint16_t BufferToUWord16(const uint8_t* dataBuffer) { | 22 uint16_t BufferToUWord16(const uint8_t* dataBuffer) { |
| 21 return (dataBuffer[0] << 8) | dataBuffer[1]; | 23 return (dataBuffer[0] << 8) | dataBuffer[1]; |
| 22 } | 24 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 return kNoTl0PicIdx; | 106 return kNoTl0PicIdx; |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 | 109 |
| 108 bool VCMSessionInfo::NonReference() const { | 110 bool VCMSessionInfo::NonReference() const { |
| 109 if (packets_.empty() || packets_.front().video_header.codec != kRtpVideoVp8) | 111 if (packets_.empty() || packets_.front().video_header.codec != kRtpVideoVp8) |
| 110 return false; | 112 return false; |
| 111 return packets_.front().video_header.codecHeader.VP8.nonReference; | 113 return packets_.front().video_header.codecHeader.VP8.nonReference; |
| 112 } | 114 } |
| 113 | 115 |
| 116 std::vector<NaluInfo> VCMSessionInfo::GetNaluInfos() const { | |
| 117 if (packets_.empty() || packets_.front().video_header.codec != kRtpVideoH264) | |
| 118 return std::vector<NaluInfo>(); | |
| 119 std::vector<NaluInfo> nalu_infos; | |
| 120 for (const VCMPacket& packet : packets_) { | |
| 121 for (size_t i = 0; i < packet.video_header.codecHeader.H264.nalus_length; | |
| 122 ++i) { | |
| 123 nalu_infos.push_back(packet.video_header.codecHeader.H264.nalus[i]); | |
| 124 } | |
| 125 } | |
| 126 return nalu_infos; | |
| 127 } | |
| 128 | |
| 114 void VCMSessionInfo::SetGofInfo(const GofInfoVP9& gof_info, size_t idx) { | 129 void VCMSessionInfo::SetGofInfo(const GofInfoVP9& gof_info, size_t idx) { |
| 115 if (packets_.empty() || packets_.front().video_header.codec != kRtpVideoVp9 || | 130 if (packets_.empty() || packets_.front().video_header.codec != kRtpVideoVp9 || |
| 116 packets_.front().video_header.codecHeader.VP9.flexible_mode) { | 131 packets_.front().video_header.codecHeader.VP9.flexible_mode) { |
| 117 return; | 132 return; |
| 118 } | 133 } |
| 119 packets_.front().video_header.codecHeader.VP9.temporal_idx = | 134 packets_.front().video_header.codecHeader.VP9.temporal_idx = |
| 120 gof_info.temporal_idx[idx]; | 135 gof_info.temporal_idx[idx]; |
| 121 packets_.front().video_header.codecHeader.VP9.temporal_up_switch = | 136 packets_.front().video_header.codecHeader.VP9.temporal_up_switch = |
| 122 gof_info.temporal_up_switch[idx]; | 137 gof_info.temporal_up_switch[idx]; |
| 123 packets_.front().video_header.codecHeader.VP9.num_ref_pics = | 138 packets_.front().video_header.codecHeader.VP9.num_ref_pics = |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 if (empty_seq_num_high_ == -1) | 567 if (empty_seq_num_high_ == -1) |
| 553 empty_seq_num_high_ = seq_num; | 568 empty_seq_num_high_ = seq_num; |
| 554 else | 569 else |
| 555 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); | 570 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); |
| 556 if (empty_seq_num_low_ == -1 || | 571 if (empty_seq_num_low_ == -1 || |
| 557 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) | 572 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) |
| 558 empty_seq_num_low_ = seq_num; | 573 empty_seq_num_low_ = seq_num; |
| 559 } | 574 } |
| 560 | 575 |
| 561 } // namespace webrtc | 576 } // namespace webrtc |
| OLD | NEW |