| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/renderer/pepper/pepper_video_decoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 int32_t PepperVideoDecoderHost::OnHostMsgFlush( | 324 int32_t PepperVideoDecoderHost::OnHostMsgFlush( |
| 325 ppapi::host::HostMessageContext* context) { | 325 ppapi::host::HostMessageContext* context) { |
| 326 if (!initialized_) | 326 if (!initialized_) |
| 327 return PP_ERROR_FAILED; | 327 return PP_ERROR_FAILED; |
| 328 DCHECK(decoder_); | 328 DCHECK(decoder_); |
| 329 if (flush_reply_context_.is_valid() || reset_reply_context_.is_valid()) | 329 if (flush_reply_context_.is_valid() || reset_reply_context_.is_valid()) |
| 330 return PP_ERROR_FAILED; | 330 return PP_ERROR_FAILED; |
| 331 | 331 |
| 332 flush_reply_context_ = context->MakeReplyMessageContext(); | 332 flush_reply_context_ = context->MakeReplyMessageContext(); |
| 333 decoder_->Flush(); | 333 decoder_->Flush(false); |
| 334 | 334 |
| 335 return PP_OK_COMPLETIONPENDING; | 335 return PP_OK_COMPLETIONPENDING; |
| 336 } | 336 } |
| 337 | 337 |
| 338 int32_t PepperVideoDecoderHost::OnHostMsgReset( | 338 int32_t PepperVideoDecoderHost::OnHostMsgReset( |
| 339 ppapi::host::HostMessageContext* context) { | 339 ppapi::host::HostMessageContext* context) { |
| 340 if (!initialized_) | 340 if (!initialized_) |
| 341 return PP_ERROR_FAILED; | 341 return PP_ERROR_FAILED; |
| 342 DCHECK(decoder_); | 342 DCHECK(decoder_); |
| 343 if (flush_reply_context_.is_valid() || reset_reply_context_.is_valid()) | 343 if (flush_reply_context_.is_valid() || reset_reply_context_.is_valid()) |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 515 |
| 516 // Resubmit all pending decodes. | 516 // Resubmit all pending decodes. |
| 517 for (const PendingDecode& decode : pending_decodes_) { | 517 for (const PendingDecode& decode : pending_decodes_) { |
| 518 DCHECK(shm_buffer_busy_[decode.shm_id]); | 518 DCHECK(shm_buffer_busy_[decode.shm_id]); |
| 519 decoder_->Decode(media::BitstreamBuffer( | 519 decoder_->Decode(media::BitstreamBuffer( |
| 520 decode.decode_id, shm_buffers_[decode.shm_id]->handle(), decode.size)); | 520 decode.decode_id, shm_buffers_[decode.shm_id]->handle(), decode.size)); |
| 521 } | 521 } |
| 522 | 522 |
| 523 // Flush the new decoder if Flush() was pending. | 523 // Flush the new decoder if Flush() was pending. |
| 524 if (flush_reply_context_.is_valid()) | 524 if (flush_reply_context_.is_valid()) |
| 525 decoder_->Flush(); | 525 decoder_->Flush(false); |
| 526 | 526 |
| 527 return true; | 527 return true; |
| 528 #endif | 528 #endif |
| 529 } | 529 } |
| 530 | 530 |
| 531 PepperVideoDecoderHost::PendingDecodeList::iterator | 531 PepperVideoDecoderHost::PendingDecodeList::iterator |
| 532 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { | 532 PepperVideoDecoderHost::GetPendingDecodeById(int32_t decode_id) { |
| 533 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), | 533 return std::find_if(pending_decodes_.begin(), pending_decodes_.end(), |
| 534 [decode_id](const PendingDecode& item) { | 534 [decode_id](const PendingDecode& item) { |
| 535 return item.decode_id == decode_id; | 535 return item.decode_id == decode_id; |
| 536 }); | 536 }); |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace content | 539 } // namespace content |
| OLD | NEW |