OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/frame_object.h" | 11 #include "webrtc/modules/video_coding/frame_object.h" |
12 #include "webrtc/base/criticalsection.h" | 12 #include "webrtc/base/criticalsection.h" |
13 #include "webrtc/modules/video_coding/packet_buffer.h" | 13 #include "webrtc/modules/video_coding/packet_buffer.h" |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 namespace video_coding { | 16 namespace video_coding { |
17 | 17 |
18 FrameObject::FrameObject() | 18 FrameObject::FrameObject() |
19 : picture_id(0), | 19 : picture_id(0), |
20 spatial_layer(0), | 20 spatial_layer(0), |
21 num_references(0), | 21 num_references(0), |
22 inter_layer_predicted(false) {} | 22 inter_layer_predicted(false) {} |
23 | 23 |
24 RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, | 24 RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, |
25 uint16_t first_seq_num, | 25 uint16_t first_seq_num, |
26 uint16_t last_seq_num) | 26 uint16_t last_seq_num, |
| 27 size_t combined_size, |
| 28 int8_t max_nack_count) |
27 : packet_buffer_(packet_buffer), | 29 : packet_buffer_(packet_buffer), |
28 first_seq_num_(first_seq_num), | 30 first_seq_num_(first_seq_num), |
29 last_seq_num_(last_seq_num) { | 31 last_seq_num_(last_seq_num), |
| 32 max_nack_count_(max_nack_count) { |
| 33 size = combined_size; |
30 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num); | 34 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num); |
31 if (packet) { | 35 if (packet) { |
32 frame_type_ = packet->frameType; | 36 frame_type_ = packet->frameType; |
33 codec_type_ = packet->codec; | 37 codec_type_ = packet->codec; |
34 } | 38 } |
35 } | 39 } |
36 | 40 |
37 RtpFrameObject::~RtpFrameObject() { | 41 RtpFrameObject::~RtpFrameObject() { |
38 packet_buffer_->ReturnFrame(this); | 42 packet_buffer_->ReturnFrame(this); |
39 } | 43 } |
40 | 44 |
41 uint16_t RtpFrameObject::first_seq_num() const { | 45 uint16_t RtpFrameObject::first_seq_num() const { |
42 return first_seq_num_; | 46 return first_seq_num_; |
43 } | 47 } |
44 | 48 |
45 uint16_t RtpFrameObject::last_seq_num() const { | 49 uint16_t RtpFrameObject::last_seq_num() const { |
46 return last_seq_num_; | 50 return last_seq_num_; |
47 } | 51 } |
48 | 52 |
| 53 int8_t RtpFrameObject::max_nack_count() const { |
| 54 return max_nack_count_; |
| 55 } |
| 56 |
49 FrameType RtpFrameObject::frame_type() const { | 57 FrameType RtpFrameObject::frame_type() const { |
50 return frame_type_; | 58 return frame_type_; |
51 } | 59 } |
52 | 60 |
53 VideoCodecType RtpFrameObject::codec_type() const { | 61 VideoCodecType RtpFrameObject::codec_type() const { |
54 return codec_type_; | 62 return codec_type_; |
55 } | 63 } |
56 | 64 |
57 bool RtpFrameObject::GetBitstream(uint8_t* destination) const { | 65 bool RtpFrameObject::GetBitstream(uint8_t* destination) const { |
58 return packet_buffer_->GetBitstream(*this, destination); | 66 return packet_buffer_->GetBitstream(*this, destination); |
59 } | 67 } |
60 | 68 |
61 RTPVideoTypeHeader* RtpFrameObject::GetCodecHeader() const { | 69 RTPVideoTypeHeader* RtpFrameObject::GetCodecHeader() const { |
62 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); | 70 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); |
63 if (!packet) | 71 if (!packet) |
64 return nullptr; | 72 return nullptr; |
65 return &packet->codecSpecificHeader.codecHeader; | 73 return &packet->codecSpecificHeader.codecHeader; |
66 } | 74 } |
67 | 75 |
68 } // namespace video_coding | 76 } // namespace video_coding |
69 } // namespace webrtc | 77 } // namespace webrtc |
OLD | NEW |