| 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 #include "chrome/browser/media/webrtc_rtp_dump_writer.h" | 5 #include "chrome/browser/media/webrtc_rtp_dump_writer.h" |
| 6 | 6 |
| 7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 output->resize(output->size() + kPacketDumpHeaderSize); | 64 output->resize(output->size() + kPacketDumpHeaderSize); |
| 65 | 65 |
| 66 char* buffer = reinterpret_cast<char*>(&(*output)[buffer_start_pos]); | 66 char* buffer = reinterpret_cast<char*>(&(*output)[buffer_start_pos]); |
| 67 | 67 |
| 68 base::WriteBigEndian(buffer, dump_length); | 68 base::WriteBigEndian(buffer, dump_length); |
| 69 buffer += sizeof(dump_length); | 69 buffer += sizeof(dump_length); |
| 70 | 70 |
| 71 base::WriteBigEndian(buffer, packet_length); | 71 base::WriteBigEndian(buffer, packet_length); |
| 72 buffer += sizeof(packet_length); | 72 buffer += sizeof(packet_length); |
| 73 | 73 |
| 74 base::WriteBigEndian(buffer, | 74 uint32 elapsed = |
| 75 (base::TimeTicks::Now() - start).InMilliseconds()); | 75 static_cast<uint32>((base::TimeTicks::Now() - start).InMilliseconds()); |
| 76 base::WriteBigEndian(buffer, elapsed); |
| 76 } | 77 } |
| 77 | 78 |
| 78 // Append |src_len| bytes from |src| to |dest|. | 79 // Append |src_len| bytes from |src| to |dest|. |
| 79 void AppendToBuffer(const uint8* src, | 80 void AppendToBuffer(const uint8* src, |
| 80 size_t src_len, | 81 size_t src_len, |
| 81 std::vector<uint8>* dest) { | 82 std::vector<uint8>* dest) { |
| 82 size_t old_dest_size = dest->size(); | 83 size_t old_dest_size = dest->size(); |
| 83 dest->resize(old_dest_size + src_len); | 84 dest->resize(old_dest_size + src_len); |
| 84 memcpy(&(*dest)[old_dest_size], src, src_len); | 85 memcpy(&(*dest)[old_dest_size], src, src_len); |
| 85 } | 86 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 true, | 442 true, |
| 442 base::Bind(&WebRtcRtpDumpWriter::OnDumpEnded, | 443 base::Bind(&WebRtcRtpDumpWriter::OnDumpEnded, |
| 443 weak_ptr_factory_.GetWeakPtr(), | 444 weak_ptr_factory_.GetWeakPtr(), |
| 444 context, | 445 context, |
| 445 false)); | 446 false)); |
| 446 return; | 447 return; |
| 447 } | 448 } |
| 448 | 449 |
| 449 context.callback.Run(context.incoming_succeeded, context.outgoing_succeeded); | 450 context.callback.Run(context.incoming_succeeded, context.outgoing_succeeded); |
| 450 } | 451 } |
| OLD | NEW |