| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_encode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
| 10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 size_t frame_size = 0; | 177 size_t frame_size = 0; |
| 178 for (size_t i = 0; i < plane_count; ++i) { | 178 for (size_t i = 0; i < plane_count; ++i) { |
| 179 // Cast DCHECK parameters to void* to avoid printing uint8* as a string. | 179 // Cast DCHECK parameters to void* to avoid printing uint8* as a string. |
| 180 DCHECK_EQ(reinterpret_cast<void*>(frame->data(i)), | 180 DCHECK_EQ(reinterpret_cast<void*>(frame->data(i)), |
| 181 reinterpret_cast<void*>((frame->data(0) + frame_size))) | 181 reinterpret_cast<void*>((frame->data(0) + frame_size))) |
| 182 << "plane=" << i; | 182 << "plane=" << i; |
| 183 frame_size += frame->stride(i) * frame->rows(i); | 183 frame_size += frame->stride(i) * frame->rows(i); |
| 184 } | 184 } |
| 185 | 185 |
| 186 Send(new AcceleratedVideoEncoderMsg_Encode( | 186 Send(new AcceleratedVideoEncoderMsg_Encode( |
| 187 encoder_route_id_, next_frame_id_, handle, frame_size, force_keyframe)); | 187 encoder_route_id_, next_frame_id_, handle, frame->shared_memory_offset(), |
| 188 frame_size, force_keyframe)); |
| 188 frame_map_[next_frame_id_] = frame; | 189 frame_map_[next_frame_id_] = frame; |
| 189 | 190 |
| 190 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. | 191 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. |
| 191 next_frame_id_ = (next_frame_id_ + 1) & 0x3FFFFFFF; | 192 next_frame_id_ = (next_frame_id_ + 1) & 0x3FFFFFFF; |
| 192 } | 193 } |
| 193 | 194 |
| 194 void GpuVideoEncodeAcceleratorHost::UseOutputBitstreamBuffer( | 195 void GpuVideoEncodeAcceleratorHost::UseOutputBitstreamBuffer( |
| 195 const media::BitstreamBuffer& buffer) { | 196 const media::BitstreamBuffer& buffer) { |
| 196 DCHECK(CalledOnValidThread()); | 197 DCHECK(CalledOnValidThread()); |
| 197 if (!channel_) | 198 if (!channel_) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 weak_this_factory_.InvalidateWeakPtrs(); | 312 weak_this_factory_.InvalidateWeakPtrs(); |
| 312 | 313 |
| 313 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 314 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 314 // last thing done on this stack! | 315 // last thing done on this stack! |
| 315 media::VideoEncodeAccelerator::Client* client = NULL; | 316 media::VideoEncodeAccelerator::Client* client = NULL; |
| 316 std::swap(client_, client); | 317 std::swap(client_, client); |
| 317 client->NotifyError(error); | 318 client->NotifyError(error); |
| 318 } | 319 } |
| 319 | 320 |
| 320 } // namespace content | 321 } // namespace content |
| OLD | NEW |