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

Side by Side Diff: services/media/framework/packet.cc

Issue 2081753002: Motown: Stop requiring size when releasing payload buffers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 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
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
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
OLDNEW
« no previous file with comments | « mojo/services/media/common/cpp/shared_media_buffer_allocator.h ('k') | services/media/framework/payload_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698