OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TEST_STREAM_GENERATOR_H_ | 10 #ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TEST_STREAM_GENERATOR_H_ |
(...skipping 12 matching lines...) Expand all Loading... |
23 const unsigned int kMaxPacketSize = 1500; | 23 const unsigned int kMaxPacketSize = 1500; |
24 const unsigned int kFrameSize = | 24 const unsigned int kFrameSize = |
25 (kDefaultBitrateKbps + kDefaultFrameRate * 4) / (kDefaultFrameRate * 8); | 25 (kDefaultBitrateKbps + kDefaultFrameRate * 4) / (kDefaultFrameRate * 8); |
26 const int kDefaultFramePeriodMs = 1000 / kDefaultFrameRate; | 26 const int kDefaultFramePeriodMs = 1000 / kDefaultFrameRate; |
27 | 27 |
28 class StreamGenerator { | 28 class StreamGenerator { |
29 public: | 29 public: |
30 StreamGenerator(uint16_t start_seq_num, int64_t current_time); | 30 StreamGenerator(uint16_t start_seq_num, int64_t current_time); |
31 void Init(uint16_t start_seq_num, int64_t current_time); | 31 void Init(uint16_t start_seq_num, int64_t current_time); |
32 | 32 |
| 33 // |time_ms| denotes the timestamp you want to put on the frame, and the unit |
| 34 // is millisecond. GenerateFrame will translate |time_ms| into a 90kHz |
| 35 // timestamp and put it on the frame. |
33 void GenerateFrame(FrameType type, | 36 void GenerateFrame(FrameType type, |
34 int num_media_packets, | 37 int num_media_packets, |
35 int num_empty_packets, | 38 int num_empty_packets, |
36 int64_t current_time); | 39 int64_t time_ms); |
37 | 40 |
38 bool PopPacket(VCMPacket* packet, int index); | 41 bool PopPacket(VCMPacket* packet, int index); |
39 void DropLastPacket(); | 42 void DropLastPacket(); |
40 | 43 |
41 bool GetPacket(VCMPacket* packet, int index); | 44 bool GetPacket(VCMPacket* packet, int index); |
42 | 45 |
43 bool NextPacket(VCMPacket* packet); | 46 bool NextPacket(VCMPacket* packet); |
44 | 47 |
45 uint16_t NextSequenceNumber() const; | 48 uint16_t NextSequenceNumber() const; |
46 | 49 |
(...skipping 13 matching lines...) Expand all Loading... |
60 uint16_t sequence_number_; | 63 uint16_t sequence_number_; |
61 int64_t start_time_; | 64 int64_t start_time_; |
62 uint8_t packet_buffer_[kMaxPacketSize]; | 65 uint8_t packet_buffer_[kMaxPacketSize]; |
63 | 66 |
64 DISALLOW_COPY_AND_ASSIGN(StreamGenerator); | 67 DISALLOW_COPY_AND_ASSIGN(StreamGenerator); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace webrtc | 70 } // namespace webrtc |
68 | 71 |
69 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TEST_STREAM_GENERATOR_H_ | 72 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TEST_STREAM_GENERATOR_H_ |
OLD | NEW |