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

Side by Side Diff: media/filters/vpx_video_decoder.cc

Issue 2964573002: Avoid constexpr compiler bug in VS 2017 (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/vpx_video_decoder.h" 5 #include "media/filters/vpx_video_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" 45 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h"
46 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h" 46 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h"
47 #include "third_party/libvpx/source/libvpx/vpx/vpx_frame_buffer.h" 47 #include "third_party/libvpx/source/libvpx/vpx/vpx_frame_buffer.h"
48 } 48 }
49 49
50 #include "third_party/libyuv/include/libyuv/convert.h" 50 #include "third_party/libyuv/include/libyuv/convert.h"
51 #include "third_party/libyuv/include/libyuv/planar_functions.h" 51 #include "third_party/libyuv/include/libyuv/planar_functions.h"
52 52
53 namespace media { 53 namespace media {
54 54
55 constexpr base::TimeDelta kStaleFrameLimit = base::TimeDelta::FromSeconds(10);
56
55 // High resolution VP9 decodes can block the main task runner for too long, 57 // High resolution VP9 decodes can block the main task runner for too long,
56 // preventing demuxing, audio decoding, and other control activities. In those 58 // preventing demuxing, audio decoding, and other control activities. In those
57 // cases share a thread per process for higher resolution decodes. 59 // cases share a thread per process for higher resolution decodes.
58 // 60 //
59 // All calls into this class must be done on the per-process media thread. 61 // All calls into this class must be done on the per-process media thread.
60 class VpxOffloadThread { 62 class VpxOffloadThread {
61 public: 63 public:
62 VpxOffloadThread() : offload_thread_("VpxOffloadThread") {} 64 VpxOffloadThread() : offload_thread_("VpxOffloadThread") {}
63 ~VpxOffloadThread() {} 65 ~VpxOffloadThread() {}
64 66
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 EraseUnusedResources(); 391 EraseUnusedResources();
390 return; 392 return;
391 } 393 }
392 394
393 const base::TimeTicks now = tick_clock_->NowTicks(); 395 const base::TimeTicks now = tick_clock_->NowTicks();
394 if (!frame_buffer->ref_cnt) 396 if (!frame_buffer->ref_cnt)
395 frame_buffer->last_use_time = now; 397 frame_buffer->last_use_time = now;
396 398
397 base::EraseIf( 399 base::EraseIf(
398 frame_buffers_, [now](const std::unique_ptr<VP9FrameBuffer>& buf) { 400 frame_buffers_, [now](const std::unique_ptr<VP9FrameBuffer>& buf) {
399 constexpr base::TimeDelta kStaleFrameLimit =
400 base::TimeDelta::FromSeconds(10);
401 return !buf->ref_cnt && now - buf->last_use_time > kStaleFrameLimit; 401 return !buf->ref_cnt && now - buf->last_use_time > kStaleFrameLimit;
402 }); 402 });
403 } 403 }
404 404
405 VpxVideoDecoder::VpxVideoDecoder() 405 VpxVideoDecoder::VpxVideoDecoder()
406 : state_(kUninitialized), 406 : state_(kUninitialized),
407 vpx_codec_(nullptr), 407 vpx_codec_(nullptr),
408 vpx_codec_alpha_(nullptr), 408 vpx_codec_alpha_(nullptr),
409 weak_factory_(this) { 409 weak_factory_(this) {
410 thread_checker_.DetachFromThread(); 410 thread_checker_.DetachFromThread();
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 (*video_frame)->visible_data(VideoFrame::kUPlane), 936 (*video_frame)->visible_data(VideoFrame::kUPlane),
937 (*video_frame)->stride(VideoFrame::kUPlane), 937 (*video_frame)->stride(VideoFrame::kUPlane),
938 (*video_frame)->visible_data(VideoFrame::kVPlane), 938 (*video_frame)->visible_data(VideoFrame::kVPlane),
939 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), 939 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(),
940 coded_size.height()); 940 coded_size.height());
941 941
942 return true; 942 return true;
943 } 943 }
944 944
945 } // namespace media 945 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698