| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mojo/clients/mojo_video_decoder.h" | 5 #include "media/mojo/clients/mojo_video_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 std::move(mojo_buffer), | 95 std::move(mojo_buffer), |
| 96 base::Bind(&MojoVideoDecoder::OnDecodeDone, base::Unretained(this))); | 96 base::Bind(&MojoVideoDecoder::OnDecodeDone, base::Unretained(this))); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void MojoVideoDecoder::OnVideoFrameDecoded(mojom::VideoFramePtr frame) { | 99 void MojoVideoDecoder::OnVideoFrameDecoded(mojom::VideoFramePtr frame) { |
| 100 DVLOG(1) << __FUNCTION__; | 100 DVLOG(1) << __FUNCTION__; |
| 101 DCHECK(task_runner_->BelongsToCurrentThread()); | 101 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 102 output_cb_.Run(frame.To<scoped_refptr<VideoFrame>>()); | 102 output_cb_.Run(frame.To<scoped_refptr<VideoFrame>>()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void MojoVideoDecoder::OnDecodeDone(mojom::DecodeStatus status) { | 105 void MojoVideoDecoder::OnDecodeDone(DecodeStatus status) { |
| 106 DVLOG(1) << __FUNCTION__; | 106 DVLOG(1) << __FUNCTION__; |
| 107 DCHECK(task_runner_->BelongsToCurrentThread()); | 107 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 108 base::ResetAndReturn(&decode_cb_).Run(static_cast<DecodeStatus>(status)); | 108 base::ResetAndReturn(&decode_cb_).Run(status); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void MojoVideoDecoder::Reset(const base::Closure& reset_cb) { | 111 void MojoVideoDecoder::Reset(const base::Closure& reset_cb) { |
| 112 DVLOG(1) << __FUNCTION__; | 112 DVLOG(1) << __FUNCTION__; |
| 113 DCHECK(task_runner_->BelongsToCurrentThread()); | 113 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 114 | 114 |
| 115 if (has_connection_error_) { | 115 if (has_connection_error_) { |
| 116 task_runner_->PostTask(FROM_HERE, reset_cb); | 116 task_runner_->PostTask(FROM_HERE, reset_cb); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (!init_cb_.is_null()) | 177 if (!init_cb_.is_null()) |
| 178 base::ResetAndReturn(&init_cb_).Run(false); | 178 base::ResetAndReturn(&init_cb_).Run(false); |
| 179 // TODO(sandersd): If there is a pending reset, should these be aborted? | 179 // TODO(sandersd): If there is a pending reset, should these be aborted? |
| 180 if (!decode_cb_.is_null()) | 180 if (!decode_cb_.is_null()) |
| 181 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); | 181 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); |
| 182 if (!reset_cb_.is_null()) | 182 if (!reset_cb_.is_null()) |
| 183 base::ResetAndReturn(&reset_cb_).Run(); | 183 base::ResetAndReturn(&reset_cb_).Run(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace media | 186 } // namespace media |
| OLD | NEW |