Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/media/webrtc_rtp_dump_writer.h

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_
6 #define CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_ 6 #define CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_
7 7
8 #include "base/basictypes.h" 8 #include <stddef.h>
9 #include <stdint.h>
10
9 #include "base/callback.h" 11 #include "base/callback.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
13 #include "base/time/time.h" 16 #include "base/time/time.h"
14 #include "chrome/browser/media/rtp_dump_type.h" 17 #include "chrome/browser/media/rtp_dump_type.h"
15 18
16 // This class is responsible for creating the compressed RTP header dump file: 19 // This class is responsible for creating the compressed RTP header dump file:
17 // - Adds the RTP headers to an in-memory buffer. 20 // - Adds the RTP headers to an in-memory buffer.
18 // - When the in-memory buffer is full, compresses it, and writes it to the 21 // - When the in-memory buffer is full, compresses it, and writes it to the
19 // disk. 22 // disk.
20 // - Notifies the caller when the on-disk file size reaches the max limit. 23 // - Notifies the caller when the on-disk file size reaches the max limit.
(...skipping 17 matching lines...) Expand all
38 // reaches |max_dump_size|. 41 // reaches |max_dump_size|.
39 WebRtcRtpDumpWriter(const base::FilePath& incoming_dump_path, 42 WebRtcRtpDumpWriter(const base::FilePath& incoming_dump_path,
40 const base::FilePath& outgoing_dump_path, 43 const base::FilePath& outgoing_dump_path,
41 size_t max_dump_size, 44 size_t max_dump_size,
42 const base::Closure& max_dump_size_reached_callback); 45 const base::Closure& max_dump_size_reached_callback);
43 46
44 virtual ~WebRtcRtpDumpWriter(); 47 virtual ~WebRtcRtpDumpWriter();
45 48
46 // Adds a RTP packet to the dump. The caller must make sure it's a valid RTP 49 // Adds a RTP packet to the dump. The caller must make sure it's a valid RTP
47 // packet. No validation is done by this method. 50 // packet. No validation is done by this method.
48 virtual void WriteRtpPacket(const uint8* packet_header, 51 virtual void WriteRtpPacket(const uint8_t* packet_header,
49 size_t header_length, 52 size_t header_length,
50 size_t packet_length, 53 size_t packet_length,
51 bool incoming); 54 bool incoming);
52 55
53 // Flushes the in-memory buffer to the disk and ends the dump. The caller must 56 // Flushes the in-memory buffer to the disk and ends the dump. The caller must
54 // make sure the dump has not already been ended. 57 // make sure the dump has not already been ended.
55 // |finished_callback| will be called to indicate whether the dump is valid. 58 // |finished_callback| will be called to indicate whether the dump is valid.
56 // If this object is destroyed before the operation is finished, the callback 59 // If this object is destroyed before the operation is finished, the callback
57 // will be canceled and the dump files will be deleted. 60 // will be canceled and the dump files will be deleted.
58 virtual void EndDump(RtpDumpType type, 61 virtual void EndDump(RtpDumpType type,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // |context| if no more dump needs to be ended. 108 // |context| if no more dump needs to be ended.
106 void OnDumpEnded(EndDumpContext context, bool incoming, bool success); 109 void OnDumpEnded(EndDumpContext context, bool incoming, bool success);
107 110
108 // The max limit on the total size of incoming and outgoing dumps on disk. 111 // The max limit on the total size of incoming and outgoing dumps on disk.
109 const size_t max_dump_size_; 112 const size_t max_dump_size_;
110 113
111 // The callback to call when the max size limit is reached. 114 // The callback to call when the max size limit is reached.
112 const base::Closure max_dump_size_reached_callback_; 115 const base::Closure max_dump_size_reached_callback_;
113 116
114 // The in-memory buffers for the uncompressed dumps. 117 // The in-memory buffers for the uncompressed dumps.
115 std::vector<uint8> incoming_buffer_; 118 std::vector<uint8_t> incoming_buffer_;
116 std::vector<uint8> outgoing_buffer_; 119 std::vector<uint8_t> outgoing_buffer_;
117 120
118 // The time when the first packet is dumped. 121 // The time when the first packet is dumped.
119 base::TimeTicks start_time_; 122 base::TimeTicks start_time_;
120 123
121 // The total on-disk size of the compressed incoming and outgoing dumps. 124 // The total on-disk size of the compressed incoming and outgoing dumps.
122 size_t total_dump_size_on_disk_; 125 size_t total_dump_size_on_disk_;
123 126
124 // File thread workers must be called and deleted on the FILE thread. 127 // File thread workers must be called and deleted on the FILE thread.
125 scoped_ptr<FileThreadWorker> incoming_file_thread_worker_; 128 scoped_ptr<FileThreadWorker> incoming_file_thread_worker_;
126 scoped_ptr<FileThreadWorker> outgoing_file_thread_worker_; 129 scoped_ptr<FileThreadWorker> outgoing_file_thread_worker_;
127 130
128 base::ThreadChecker thread_checker_; 131 base::ThreadChecker thread_checker_;
129 132
130 base::WeakPtrFactory<WebRtcRtpDumpWriter> weak_ptr_factory_; 133 base::WeakPtrFactory<WebRtcRtpDumpWriter> weak_ptr_factory_;
131 134
132 DISALLOW_COPY_AND_ASSIGN(WebRtcRtpDumpWriter); 135 DISALLOW_COPY_AND_ASSIGN(WebRtcRtpDumpWriter);
133 }; 136 };
134 137
135 #endif // CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_ 138 #endif // CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_WRITER_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc_rtp_dump_handler_unittest.cc ('k') | chrome/browser/media/webrtc_rtp_dump_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698