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 timestamp(0), | 21 timestamp(0), |
22 num_references(0), | 22 num_references(0), |
23 inter_layer_predicted(false) {} | 23 inter_layer_predicted(false) {} |
24 | 24 |
25 RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, | 25 RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer, |
26 uint16_t first_seq_num, | 26 uint16_t first_seq_num, |
27 uint16_t last_seq_num) | 27 uint16_t last_seq_num, |
28 size_t frame_size, | |
29 int times_nacked) | |
28 : packet_buffer_(packet_buffer), | 30 : packet_buffer_(packet_buffer), |
29 first_seq_num_(first_seq_num), | 31 first_seq_num_(first_seq_num), |
30 last_seq_num_(last_seq_num) { | 32 last_seq_num_(last_seq_num), |
33 times_nacked_(times_nacked) { | |
34 size = frame_size; | |
stefan-webrtc
2016/05/23 13:42:07
Maybe pass this in to the FrameObject via construc
| |
31 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num); | 35 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num); |
32 if (packet) { | 36 if (packet) { |
33 frame_type_ = packet->frameType; | 37 frame_type_ = packet->frameType; |
34 codec_type_ = packet->codec; | 38 codec_type_ = packet->codec; |
35 } | 39 } |
36 } | 40 } |
37 | 41 |
38 RtpFrameObject::~RtpFrameObject() { | 42 RtpFrameObject::~RtpFrameObject() { |
39 packet_buffer_->ReturnFrame(this); | 43 packet_buffer_->ReturnFrame(this); |
40 } | 44 } |
41 | 45 |
42 uint16_t RtpFrameObject::first_seq_num() const { | 46 uint16_t RtpFrameObject::first_seq_num() const { |
43 return first_seq_num_; | 47 return first_seq_num_; |
44 } | 48 } |
45 | 49 |
46 uint16_t RtpFrameObject::last_seq_num() const { | 50 uint16_t RtpFrameObject::last_seq_num() const { |
47 return last_seq_num_; | 51 return last_seq_num_; |
48 } | 52 } |
49 | 53 |
54 int RtpFrameObject::times_nacked() const { | |
55 return times_nacked_; | |
56 } | |
57 | |
50 FrameType RtpFrameObject::frame_type() const { | 58 FrameType RtpFrameObject::frame_type() const { |
51 return frame_type_; | 59 return frame_type_; |
52 } | 60 } |
53 | 61 |
54 VideoCodecType RtpFrameObject::codec_type() const { | 62 VideoCodecType RtpFrameObject::codec_type() const { |
55 return codec_type_; | 63 return codec_type_; |
56 } | 64 } |
57 | 65 |
58 bool RtpFrameObject::GetBitstream(uint8_t* destination) const { | 66 bool RtpFrameObject::GetBitstream(uint8_t* destination) const { |
59 return packet_buffer_->GetBitstream(*this, destination); | 67 return packet_buffer_->GetBitstream(*this, destination); |
60 } | 68 } |
61 | 69 |
62 RTPVideoTypeHeader* RtpFrameObject::GetCodecHeader() const { | 70 RTPVideoTypeHeader* RtpFrameObject::GetCodecHeader() const { |
63 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); | 71 VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); |
64 if (!packet) | 72 if (!packet) |
65 return nullptr; | 73 return nullptr; |
66 return &packet->codecSpecificHeader.codecHeader; | 74 return &packet->codecSpecificHeader.codecHeader; |
67 } | 75 } |
68 | 76 |
69 } // namespace video_coding | 77 } // namespace video_coding |
70 } // namespace webrtc | 78 } // namespace webrtc |
OLD | NEW |