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

Side by Side Diff: media/base/android/video_media_codec_decoder.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/base/android/video_media_codec_decoder.h" 5 #include "media/base/android/video_media_codec_decoder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 DVLOG(1) << class_name() << "::" << __FUNCTION__ << " pts:" << pts; 195 DVLOG(1) << class_name() << "::" << __FUNCTION__ << " pts:" << pts;
196 196
197 start_time_ticks_ = base::TimeTicks::Now(); 197 start_time_ticks_ = base::TimeTicks::Now();
198 start_pts_ = pts; 198 start_pts_ = pts;
199 last_seen_pts_ = pts; 199 last_seen_pts_ = pts;
200 } 200 }
201 201
202 void VideoMediaCodecDecoder::DissociatePTSFromTime() { 202 void VideoMediaCodecDecoder::DissociatePTSFromTime() {
203 DCHECK(media_task_runner_->BelongsToCurrentThread()); 203 DCHECK(media_task_runner_->BelongsToCurrentThread());
204 204
205 start_pts_ = last_seen_pts_ = kNoTimestamp(); 205 start_pts_ = last_seen_pts_ = kNoTimestamp;
206 } 206 }
207 207
208 bool VideoMediaCodecDecoder::OnOutputFormatChanged() { 208 bool VideoMediaCodecDecoder::OnOutputFormatChanged() {
209 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); 209 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
210 210
211 gfx::Size prev_size = video_size_; 211 gfx::Size prev_size = video_size_;
212 212
213 // See b/18224769. The values reported from MediaCodecBridge::GetOutputSize 213 // See b/18224769. The values reported from MediaCodecBridge::GetOutputSize
214 // correspond to the actual video frame size, but this is not necessarily the 214 // correspond to the actual video frame size, but this is not necessarily the
215 // size that should be output. 215 // size that should be output.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // We get here in the preroll phase. Render now as explained above. 258 // We get here in the preroll phase. Render now as explained above.
259 // |start_pts_| is not set yet, thus we cannot calculate |time_to_render|. 259 // |start_pts_| is not set yet, thus we cannot calculate |time_to_render|.
260 ReleaseOutputBuffer(buffer_index, pts, (size > 0), update_time, 260 ReleaseOutputBuffer(buffer_index, pts, (size > 0), update_time,
261 eos_encountered); 261 eos_encountered);
262 return true; 262 return true;
263 case kRenderNow: 263 case kRenderNow:
264 break; 264 break;
265 } 265 }
266 266
267 DCHECK_EQ(kRenderNow, render_mode); 267 DCHECK_EQ(kRenderNow, render_mode);
268 DCHECK_NE(kNoTimestamp(), start_pts_); // start_pts_ must be set 268 DCHECK_NE(kNoTimestamp, start_pts_); // start_pts_ must be set
269 269
270 base::TimeDelta time_to_render = 270 base::TimeDelta time_to_render =
271 pts - (base::TimeTicks::Now() - start_time_ticks_ + start_pts_); 271 pts - (base::TimeTicks::Now() - start_time_ticks_ + start_pts_);
272 272
273 DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts 273 DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts
274 << " ticks delta:" << (base::TimeTicks::Now() - start_time_ticks_) 274 << " ticks delta:" << (base::TimeTicks::Now() - start_time_ticks_)
275 << " time_to_render:" << time_to_render; 275 << " time_to_render:" << time_to_render;
276 276
277 const bool render = (size > 0); 277 const bool render = (size > 0);
278 278
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 // |update_current_time_cb_| might be null if there is audio stream. 351 // |update_current_time_cb_| might be null if there is audio stream.
352 // Do not update current time for stand-alone EOS frames. 352 // Do not update current time for stand-alone EOS frames.
353 if (!update_current_time_cb_.is_null() && update_time) { 353 if (!update_current_time_cb_.is_null() && update_time) {
354 media_task_runner_->PostTask( 354 media_task_runner_->PostTask(
355 FROM_HERE, base::Bind(update_current_time_cb_, pts, pts, false)); 355 FROM_HERE, base::Bind(update_current_time_cb_, pts, pts, false));
356 } 356 }
357 } 357 }
358 358
359 } // namespace media 359 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698