OLD | NEW |
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 "media/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "media/base/demuxer_stream.h" | 10 #include "media/base/demuxer_stream.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 SHMBuffer* ret = available_shm_segments_.back(); | 393 SHMBuffer* ret = available_shm_segments_.back(); |
394 available_shm_segments_.pop_back(); | 394 available_shm_segments_.pop_back(); |
395 return ret; | 395 return ret; |
396 } | 396 } |
397 | 397 |
398 void GpuVideoDecoder::PutSHM(SHMBuffer* shm_buffer) { | 398 void GpuVideoDecoder::PutSHM(SHMBuffer* shm_buffer) { |
399 DCHECK(MessageLoop::current() == message_loop_); | 399 DCHECK(MessageLoop::current() == message_loop_); |
400 available_shm_segments_.push_back(shm_buffer); | 400 available_shm_segments_.push_back(shm_buffer); |
401 } | 401 } |
402 | 402 |
403 void GpuVideoDecoder::NotifyEndOfStream() { | |
404 if (MessageLoop::current() != message_loop_) { | |
405 message_loop_->PostTask(FROM_HERE, base::Bind( | |
406 &GpuVideoDecoder::NotifyEndOfStream, this)); | |
407 return; | |
408 } | |
409 DeliverFrame(VideoFrame::CreateEmptyFrame()); | |
410 } | |
411 | |
412 void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { | 403 void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { |
413 if (MessageLoop::current() != message_loop_) { | 404 if (MessageLoop::current() != message_loop_) { |
414 message_loop_->PostTask(FROM_HERE, base::Bind( | 405 message_loop_->PostTask(FROM_HERE, base::Bind( |
415 &GpuVideoDecoder::NotifyEndOfBitstreamBuffer, this, id)); | 406 &GpuVideoDecoder::NotifyEndOfBitstreamBuffer, this, id)); |
416 return; | 407 return; |
417 } | 408 } |
418 | 409 |
419 std::map<int32, BufferPair>::iterator it = | 410 std::map<int32, BufferPair>::iterator it = |
420 bitstream_buffers_in_decoder_.find(id); | 411 bitstream_buffers_in_decoder_.find(id); |
421 if (it == bitstream_buffers_in_decoder_.end()) { | 412 if (it == bitstream_buffers_in_decoder_.end()) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 &GpuVideoDecoder::NotifyError, this, error)); | 471 &GpuVideoDecoder::NotifyError, this, error)); |
481 return; | 472 return; |
482 } | 473 } |
483 vda_ = NULL; | 474 vda_ = NULL; |
484 DLOG(ERROR) << "VDA Error: " << error; | 475 DLOG(ERROR) << "VDA Error: " << error; |
485 if (host()) | 476 if (host()) |
486 host()->SetError(PIPELINE_ERROR_DECODE); | 477 host()->SetError(PIPELINE_ERROR_DECODE); |
487 } | 478 } |
488 | 479 |
489 } // namespace media | 480 } // namespace media |
OLD | NEW |