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

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

Issue 819203002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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/cast/test/utility/udp_proxy_main.cc ('k') | media/filters/gpu_video_decoder.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 (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/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 26 matching lines...) Expand all
37 // Yet another reason for having two threads :) 37 // Yet another reason for having two threads :)
38 static const int kDecodeThreads = 2; 38 static const int kDecodeThreads = 2;
39 static const int kMaxDecodeThreads = 16; 39 static const int kMaxDecodeThreads = 16;
40 40
41 // Returns the number of threads given the FFmpeg CodecID. Also inspects the 41 // Returns the number of threads given the FFmpeg CodecID. Also inspects the
42 // command line for a valid --video-threads flag. 42 // command line for a valid --video-threads flag.
43 static int GetThreadCount(AVCodecID codec_id) { 43 static int GetThreadCount(AVCodecID codec_id) {
44 // Refer to http://crbug.com/93932 for tsan suppressions on decoding. 44 // Refer to http://crbug.com/93932 for tsan suppressions on decoding.
45 int decode_threads = kDecodeThreads; 45 int decode_threads = kDecodeThreads;
46 46
47 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 47 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
48 std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads)); 48 std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads));
49 if (threads.empty() || !base::StringToInt(threads, &decode_threads)) 49 if (threads.empty() || !base::StringToInt(threads, &decode_threads))
50 return decode_threads; 50 return decode_threads;
51 51
52 decode_threads = std::max(decode_threads, 0); 52 decode_threads = std::max(decode_threads, 0);
53 decode_threads = std::min(decode_threads, kMaxDecodeThreads); 53 decode_threads = std::min(decode_threads, kMaxDecodeThreads);
54 return decode_threads; 54 return decode_threads;
55 } 55 }
56 56
57 static int GetVideoBufferImpl(struct AVCodecContext* s, 57 static int GetVideoBufferImpl(struct AVCodecContext* s,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 345 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
346 ReleaseFFmpegResources(); 346 ReleaseFFmpegResources();
347 return false; 347 return false;
348 } 348 }
349 349
350 av_frame_.reset(av_frame_alloc()); 350 av_frame_.reset(av_frame_alloc());
351 return true; 351 return true;
352 } 352 }
353 353
354 } // namespace media 354 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/utility/udp_proxy_main.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698