Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: media/mojo/clients/mojo_video_decoder.cc

Issue 2408063009: media: Use native DecodeStatus in media mojo interfaces (Closed)
Patch Set: comments addressed Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/mojo/clients/mojo_video_decoder.h ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_video_decoder.h ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698