Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_ | |
|
minyue-webrtc
2015/08/28 14:50:21
a line break before
ivoc
2015/09/01 10:03:50
Done.
| |
| 11 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_ | |
| 10 | 12 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ | |
| 13 | |
| 14 #include <stdio.h> | |
| 15 #include <string> | 13 #include <string> |
| 16 | 14 |
| 17 #include "webrtc/base/constructormagic.h" | 15 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/scoped_ptr.h" | 16 #include "webrtc/base/scoped_ptr.h" |
| 19 #include "webrtc/common_types.h" | |
| 20 #include "webrtc/modules/audio_coding/neteq/tools/packet_source.h" | 17 #include "webrtc/modules/audio_coding/neteq/tools/packet_source.h" |
| 21 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" | 18 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 22 | 19 |
| 23 namespace webrtc { | 20 namespace webrtc { |
| 24 | 21 |
| 25 class RtpHeaderParser; | 22 class RtpHeaderParser; |
| 26 | 23 |
| 24 namespace rtclog { | |
| 25 class EventStream; | |
| 26 } // namespace rtclog | |
| 27 | |
| 27 namespace test { | 28 namespace test { |
| 28 | 29 |
| 29 class RtpFileReader; | 30 class Packet; |
| 30 | 31 |
| 31 class RtpFileSource : public PacketSource { | 32 class RtcEventLogSource : public PacketSource { |
| 32 public: | 33 public: |
| 33 // Creates an RtpFileSource reading from |file_name|. If the file cannot be | 34 // Creates an RtcEventLogSource reading from |file_name|. If the file cannot |
| 34 // opened, or has the wrong format, NULL will be returned. | 35 // be opened, or has the wrong format, NULL will be returned. |
| 35 static RtpFileSource* Create(const std::string& file_name); | 36 static RtcEventLogSource* Create(const std::string& file_name); |
| 36 | 37 |
| 37 virtual ~RtpFileSource(); | 38 virtual ~RtcEventLogSource(); |
| 38 | 39 |
| 39 // Registers an RTP header extension and binds it to |id|. | 40 // Registers an RTP header extension and binds it to |id|. |
| 40 virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); | 41 virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
| 41 | 42 |
| 42 // Returns a pointer to the next packet. Returns NULL if end of file was | 43 // Returns a pointer to the next packet. Returns NULL if end of file was |
| 43 // reached, or if a the data was corrupt. | 44 // reached. |
| 44 Packet* NextPacket() override; | 45 Packet* NextPacket() override; |
| 45 | 46 |
| 47 // Returns the timestamp of the next audio output event, in milliseconds. A | |
| 48 // value of -1 is returned if the end of the file is reached. | |
|
hlundin-webrtc
2015/08/28 12:06:25
Is it end of file that is reached, or are there si
ivoc
2015/09/01 10:03:50
Updated to say that there are no more audio output
| |
| 49 int NextAudioOutputEventMs(); | |
| 50 | |
| 46 private: | 51 private: |
| 47 static const int kFirstLineLength = 40; | 52 RtcEventLogSource(); |
| 48 static const int kRtpFileHeaderSize = 4 + 4 + 4 + 2 + 2; | |
| 49 static const size_t kPacketHeaderSize = 8; | |
| 50 | |
| 51 RtpFileSource(); | |
| 52 | 53 |
| 53 bool OpenFile(const std::string& file_name); | 54 bool OpenFile(const std::string& file_name); |
| 54 | 55 |
| 55 rtc::scoped_ptr<RtpFileReader> rtp_reader_; | 56 int rtp_packet_index_ = 0; |
| 57 int audio_output_index_ = 0; | |
| 58 | |
| 59 rtc::scoped_ptr<rtclog::EventStream> event_log_; | |
| 56 rtc::scoped_ptr<RtpHeaderParser> parser_; | 60 rtc::scoped_ptr<RtpHeaderParser> parser_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(RtpFileSource); | 62 DISALLOW_COPY_AND_ASSIGN(RtcEventLogSource); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace test | 65 } // namespace test |
| 62 } // namespace webrtc | 66 } // namespace webrtc |
| 63 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ | 67 |
| 68 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_ | |
| OLD | NEW |