OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "services/media/framework/packet.h" | 6 #include "services/media/framework/packet.h" |
7 #include "services/media/framework/payload_allocator.h" | 7 #include "services/media/framework/payload_allocator.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace media { | 10 namespace media { |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 protected: | 26 protected: |
27 ~PacketImpl() override{}; | 27 ~PacketImpl() override{}; |
28 | 28 |
29 void Release() override { | 29 void Release() override { |
30 // In the default implementation, payload() will be nullptr if and only if | 30 // In the default implementation, payload() will be nullptr if and only if |
31 // allocator_ is nullptr. Subclasses have the option of having a non-null | 31 // allocator_ is nullptr. Subclasses have the option of having a non-null |
32 // payload() and handling deallocation themselves, so allocator_ can be | 32 // payload() and handling deallocation themselves, so allocator_ can be |
33 // nullptr even when payload() is not. | 33 // nullptr even when payload() is not. |
34 if (payload() != nullptr && allocator_ != nullptr) { | 34 if (payload() != nullptr && allocator_ != nullptr) { |
35 allocator_->ReleasePayloadBuffer(size(), payload()); | 35 allocator_->ReleasePayloadBuffer(payload()); |
36 } | 36 } |
37 delete this; | 37 delete this; |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 PayloadAllocator* allocator_; | 41 PayloadAllocator* allocator_; |
42 }; | 42 }; |
43 | 43 |
44 // static | 44 // static |
45 PacketPtr Packet::Create(int64_t pts, | 45 PacketPtr Packet::Create(int64_t pts, |
(...skipping 18 matching lines...) Expand all Loading... |
64 PacketPtr Packet::CreateEndOfStream(int64_t pts) { | 64 PacketPtr Packet::CreateEndOfStream(int64_t pts) { |
65 return PacketPtr(new PacketImpl(pts, | 65 return PacketPtr(new PacketImpl(pts, |
66 true, // end_of_stream | 66 true, // end_of_stream |
67 0, // size | 67 0, // size |
68 nullptr, // payload | 68 nullptr, // payload |
69 nullptr)); // allocator | 69 nullptr)); // allocator |
70 } | 70 } |
71 | 71 |
72 } // namespace media | 72 } // namespace media |
73 } // namespace mojo | 73 } // namespace mojo |
OLD | NEW |