/src/mozilla-central/media/mtransport/mediapacket.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mediapacket.h" |
8 | | |
9 | | #include <cstring> |
10 | | |
11 | | namespace mozilla { |
12 | | |
13 | | void |
14 | | MediaPacket::Copy(const uint8_t* data, size_t len, size_t capacity) |
15 | 0 | { |
16 | 0 | if (capacity < len) { |
17 | 0 | capacity = len; |
18 | 0 | } |
19 | 0 | data_.reset(new uint8_t[capacity]); |
20 | 0 | len_ = len; |
21 | 0 | capacity_ = capacity; |
22 | 0 | memcpy(data_.get(), data, len); |
23 | 0 | } |
24 | | |
25 | | } // namespace mozilla |
26 | | |