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

Side by Side Diff: content/common/gpu/client/gpu_video_decode_accelerator_host.cc

Issue 1645873002: Use ParamTraits for media::BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/gpu/client/gpu_video_decode_accelerator_host.h" 5 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (!channel_) 112 if (!channel_)
113 return; 113 return;
114 Send(new AcceleratedVideoDecoderMsg_SetCdm(decoder_route_id_, cdm_id)); 114 Send(new AcceleratedVideoDecoderMsg_SetCdm(decoder_route_id_, cdm_id));
115 } 115 }
116 116
117 void GpuVideoDecodeAcceleratorHost::Decode( 117 void GpuVideoDecodeAcceleratorHost::Decode(
118 const media::BitstreamBuffer& bitstream_buffer) { 118 const media::BitstreamBuffer& bitstream_buffer) {
119 DCHECK(CalledOnValidThread()); 119 DCHECK(CalledOnValidThread());
120 if (!channel_) 120 if (!channel_)
121 return; 121 return;
122 122 media::BitstreamBuffer buffer_to_send = bitstream_buffer;
123 base::SharedMemoryHandle handle = channel_->ShareToGpuProcess( 123 base::SharedMemoryHandle handle =
124 bitstream_buffer.handle()); 124 channel_->ShareToGpuProcess(bitstream_buffer.handle());
125 if (!base::SharedMemory::IsHandleValid(handle)) { 125 if (!base::SharedMemory::IsHandleValid(handle)) {
126 NOTREACHED() << "Failed to duplicate buffer handler"; 126 NOTREACHED() << "Failed to duplicate buffer handler";
127 return; 127 return;
128 } 128 }
129 129 buffer_to_send.set_handle(handle);
130 AcceleratedVideoDecoderMsg_Decode_Params params; 130 Send(
131 params.bitstream_buffer_id = bitstream_buffer.id(); 131 new AcceleratedVideoDecoderMsg_Decode(decoder_route_id_, buffer_to_send));
132 params.buffer_handle = handle;
133 params.size = bitstream_buffer.size();
134 params.presentation_timestamp = bitstream_buffer.presentation_timestamp();
135 params.key_id = bitstream_buffer.key_id();
136 params.iv = bitstream_buffer.iv();
137 params.subsamples = bitstream_buffer.subsamples();
138
139 Send(new AcceleratedVideoDecoderMsg_Decode(decoder_route_id_, params));
140 } 132 }
141 133
142 void GpuVideoDecodeAcceleratorHost::AssignPictureBuffers( 134 void GpuVideoDecodeAcceleratorHost::AssignPictureBuffers(
143 const std::vector<media::PictureBuffer>& buffers) { 135 const std::vector<media::PictureBuffer>& buffers) {
144 DCHECK(CalledOnValidThread()); 136 DCHECK(CalledOnValidThread());
145 if (!channel_) 137 if (!channel_)
146 return; 138 return;
147 // Rearrange data for IPC command. 139 // Rearrange data for IPC command.
148 std::vector<int32_t> buffer_ids; 140 std::vector<int32_t> buffer_ids;
149 std::vector<uint32_t> texture_ids; 141 std::vector<uint32_t> texture_ids;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 weak_this_factory_.InvalidateWeakPtrs(); 275 weak_this_factory_.InvalidateWeakPtrs();
284 276
285 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the 277 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the
286 // last thing done on this stack! 278 // last thing done on this stack!
287 media::VideoDecodeAccelerator::Client* client = NULL; 279 media::VideoDecodeAccelerator::Client* client = NULL;
288 std::swap(client, client_); 280 std::swap(client, client_);
289 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); 281 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error));
290 } 282 }
291 283
292 } // namespace content 284 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_jpeg_decode_accelerator_host.cc ('k') | content/common/gpu/media/gpu_jpeg_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698