| OLD | NEW |
| 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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_HANDLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_HANDLER_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_HANDLER_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 "chrome/browser/media/rtp_dump_type.h" | 15 #include "chrome/browser/media/rtp_dump_type.h" |
| 13 | 16 |
| 14 class WebRtcRtpDumpWriter; | 17 class WebRtcRtpDumpWriter; |
| 15 | 18 |
| 16 // WebRtcRtpDumpHandler handles operations regarding the WebRTC RTP dump: | 19 // WebRtcRtpDumpHandler handles operations regarding the WebRTC RTP dump: |
| 17 // - Starts or stops the RTP dumping on behalf of the client. | 20 // - Starts or stops the RTP dumping on behalf of the client. |
| 18 // - Stops the RTP dumping when the max dump file size is reached. | 21 // - Stops the RTP dumping when the max dump file size is reached. |
| 19 // - Writes the dump file. | 22 // - Writes the dump file. |
| 20 // - Provides the dump file to the client code to be uploaded when | 23 // - Provides the dump file to the client code to be uploaded when |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // It should only be called when both incoming and outgoing dumping has been | 68 // It should only be called when both incoming and outgoing dumping has been |
| 66 // stopped, i.e. ReadyToRelease() returns true. Returns the dump file paths. | 69 // stopped, i.e. ReadyToRelease() returns true. Returns the dump file paths. |
| 67 // | 70 // |
| 68 // The caller will own the dump file after the method returns. If ReleaseDump | 71 // The caller will own the dump file after the method returns. If ReleaseDump |
| 69 // is not called before this object goes away, the dump file will be deleted | 72 // is not called before this object goes away, the dump file will be deleted |
| 70 // by this object. | 73 // by this object. |
| 71 ReleasedDumps ReleaseDumps(); | 74 ReleasedDumps ReleaseDumps(); |
| 72 | 75 |
| 73 // Adds an RTP packet to the dump. The caller must make sure it's a valid RTP | 76 // Adds an RTP packet to the dump. The caller must make sure it's a valid RTP |
| 74 // packet. | 77 // packet. |
| 75 void OnRtpPacket(const uint8* packet_header, | 78 void OnRtpPacket(const uint8_t* packet_header, |
| 76 size_t header_length, | 79 size_t header_length, |
| 77 size_t packet_length, | 80 size_t packet_length, |
| 78 bool incoming); | 81 bool incoming); |
| 79 | 82 |
| 80 // Stops all ongoing dumps and call |callback| when finished. | 83 // Stops all ongoing dumps and call |callback| when finished. |
| 81 void StopOngoingDumps(const base::Closure& callback); | 84 void StopOngoingDumps(const base::Closure& callback); |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 friend class WebRtcRtpDumpHandlerTest; | 87 friend class WebRtcRtpDumpHandlerTest; |
| 85 | 88 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 125 |
| 123 // The object used to create and write the dump file. | 126 // The object used to create and write the dump file. |
| 124 scoped_ptr<WebRtcRtpDumpWriter> dump_writer_; | 127 scoped_ptr<WebRtcRtpDumpWriter> dump_writer_; |
| 125 | 128 |
| 126 base::WeakPtrFactory<WebRtcRtpDumpHandler> weak_ptr_factory_; | 129 base::WeakPtrFactory<WebRtcRtpDumpHandler> weak_ptr_factory_; |
| 127 | 130 |
| 128 DISALLOW_COPY_AND_ASSIGN(WebRtcRtpDumpHandler); | 131 DISALLOW_COPY_AND_ASSIGN(WebRtcRtpDumpHandler); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 #endif // CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_HANDLER_H_ | 134 #endif // CHROME_BROWSER_MEDIA_WEBRTC_RTP_DUMP_HANDLER_H_ |
| OLD | NEW |