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

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 1143223007: media: Reland "Simplify {Audio|Video}Decoder initialization callback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index 7211655dfbd3157a37baeaac1b0057071f07e8f3..504ed847767b86a0748b950a7621ebf56eab9245 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -105,15 +105,17 @@ static bool IsCodedSizeSupported(const gfx::Size& coded_size,
coded_size.height() >= min_resolution.height());
}
-// Report |status| to UMA and run |cb| with it. This is super-specific to the
+// Report |success| to UMA and run |cb| with it. This is super-specific to the
// UMA stat reported because the UMA_HISTOGRAM_ENUMERATION API requires a
// callsite to always be called with the same stat name (can't parameterize it).
static void ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB(
- const PipelineStatusCB& cb,
- PipelineStatus status) {
+ const VideoDecoder::InitCB& cb,
+ bool success) {
+ // TODO(xhwang): Report |success| directly.
+ PipelineStatus status = success ? PIPELINE_OK : DECODER_ERROR_NOT_SUPPORTED;
UMA_HISTOGRAM_ENUMERATION(
"Media.GpuVideoDecoderInitializeStatus", status, PIPELINE_STATUS_MAX + 1);
- cb.Run(status);
+ cb.Run(success);
}
std::string GpuVideoDecoder::GetDisplayName() const {
@@ -122,16 +124,16 @@ std::string GpuVideoDecoder::GetDisplayName() const {
void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool /* low_delay */,
- const PipelineStatusCB& orig_status_cb,
+ const InitCB& init_cb,
const OutputCB& output_cb) {
DVLOG(3) << "Initialize()";
DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
DCHECK(config.IsValidConfig());
DCHECK(!config.is_encrypted());
- PipelineStatusCB status_cb =
+ InitCB bound_init_cb =
base::Bind(&ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB,
- BindToCurrentLoop(orig_status_cb));
+ BindToCurrentLoop(init_cb));
bool previously_initialized = config_.IsValidConfig();
DVLOG(1) << "(Re)initializing GVD with config: "
@@ -141,12 +143,12 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
// (http://crbug.com/260224).
if (previously_initialized && (config_.profile() != config.profile())) {
DVLOG(1) << "Codec or profile changed, cannot reinitialize.";
- status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
+ bound_init_cb.Run(false);
return;
}
if (!IsProfileSupported(config.profile(), config.coded_size())) {
- status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
+ bound_init_cb.Run(false);
return;
}
@@ -158,18 +160,18 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
// Reinitialization with a different config (but same codec and profile).
// VDA should handle it by detecting this in-stream by itself,
// no need to notify it.
- status_cb.Run(PIPELINE_OK);
+ bound_init_cb.Run(true);
return;
}
vda_ = factories_->CreateVideoDecodeAccelerator().Pass();
if (!vda_ || !vda_->Initialize(config.profile(), this)) {
- status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
+ bound_init_cb.Run(false);
return;
}
DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded.";
- status_cb.Run(PIPELINE_OK);
+ bound_init_cb.Run(true);
}
void GpuVideoDecoder::DestroyPictureBuffers(PictureBufferMap* buffers) {
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698