| 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 "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h" | 5 #include "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "gpu/ipc/client/gpu_channel_host.h" | 10 #include "gpu/ipc/client/gpu_channel_host.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // function. | 295 // function. |
| 296 OnNotifyError(kPlatformFailureError); | 296 OnNotifyError(kPlatformFailureError); |
| 297 return; | 297 return; |
| 298 } | 298 } |
| 299 frame = NULL; // Not necessary but nice to be explicit; see fun-fact above. | 299 frame = NULL; // Not necessary but nice to be explicit; see fun-fact above. |
| 300 } | 300 } |
| 301 | 301 |
| 302 void GpuVideoEncodeAcceleratorHost::OnBitstreamBufferReady( | 302 void GpuVideoEncodeAcceleratorHost::OnBitstreamBufferReady( |
| 303 int32_t bitstream_buffer_id, | 303 int32_t bitstream_buffer_id, |
| 304 uint32_t payload_size, | 304 uint32_t payload_size, |
| 305 bool key_frame) { | 305 bool key_frame, |
| 306 base::TimeDelta timestamp) { |
| 306 DCHECK(CalledOnValidThread()); | 307 DCHECK(CalledOnValidThread()); |
| 307 DVLOG(3) << "OnBitstreamBufferReady(): " | 308 DVLOG(3) << "OnBitstreamBufferReady(): " |
| 308 "bitstream_buffer_id=" | 309 "bitstream_buffer_id=" |
| 309 << bitstream_buffer_id << ", payload_size=" << payload_size | 310 << bitstream_buffer_id << ", payload_size=" << payload_size |
| 310 << ", key_frame=" << key_frame; | 311 << ", key_frame=" << key_frame; |
| 311 if (client_) | 312 if (client_) |
| 312 client_->BitstreamBufferReady(bitstream_buffer_id, payload_size, key_frame); | 313 client_->BitstreamBufferReady(bitstream_buffer_id, payload_size, key_frame, |
| 314 timestamp); |
| 313 } | 315 } |
| 314 | 316 |
| 315 void GpuVideoEncodeAcceleratorHost::OnNotifyError(Error error) { | 317 void GpuVideoEncodeAcceleratorHost::OnNotifyError(Error error) { |
| 316 DCHECK(CalledOnValidThread()); | 318 DCHECK(CalledOnValidThread()); |
| 317 DVLOG(2) << "OnNotifyError(): error=" << error; | 319 DVLOG(2) << "OnNotifyError(): error=" << error; |
| 318 if (!client_) | 320 if (!client_) |
| 319 return; | 321 return; |
| 320 weak_this_factory_.InvalidateWeakPtrs(); | 322 weak_this_factory_.InvalidateWeakPtrs(); |
| 321 | 323 |
| 322 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 324 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 323 // last thing done on this stack! | 325 // last thing done on this stack! |
| 324 VideoEncodeAccelerator::Client* client = NULL; | 326 VideoEncodeAccelerator::Client* client = NULL; |
| 325 std::swap(client_, client); | 327 std::swap(client_, client); |
| 326 client->NotifyError(error); | 328 client->NotifyError(error); |
| 327 } | 329 } |
| 328 | 330 |
| 329 } // namespace media | 331 } // namespace media |
| OLD | NEW |