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 3 // found in the LICENSE file. 4 5 #ifndef MEDIA_BASE_PIPELINE_STATUS_H_ 6 #define MEDIA_BASE_PIPELINE_STATUS_H_ 7 8 #include "base/callback.h" 9 10 #include <string> 11 12 namespace media { 13 14 // Status states for pipeline. All codes except PIPELINE_OK indicate errors. 15 // Logged to UMA, so never reuse a value, always add new/greater ones! 16 // TODO(vrk/scherkus): Trim the unused status codes. (crbug.com/126070) 17 enum PipelineStatus { 18 PIPELINE_OK = 0, 19 PIPELINE_ERROR_URL_NOT_FOUND = 1, 20 PIPELINE_ERROR_NETWORK = 2, 21 PIPELINE_ERROR_DECODE = 3, 22 PIPELINE_ERROR_DECRYPT = 4, 23 PIPELINE_ERROR_ABORT = 5, 24 PIPELINE_ERROR_INITIALIZATION_FAILED = 6, 25 PIPELINE_ERROR_COULD_NOT_RENDER = 8, 26 PIPELINE_ERROR_READ = 9, 27 PIPELINE_ERROR_OPERATION_PENDING = 10, 28 PIPELINE_ERROR_INVALID_STATE = 11, 29 // Demuxer related errors. 30 DEMUXER_ERROR_COULD_NOT_OPEN = 12, 31 DEMUXER_ERROR_COULD_NOT_PARSE = 13, 32 DEMUXER_ERROR_NO_SUPPORTED_STREAMS = 14, 33 // Decoder related errors. 34 DECODER_ERROR_NOT_SUPPORTED = 15, 35 PIPELINE_STATUS_MAX, // Must be greater than all other values logged. 36 }; 37 38 typedef base::Callback<void(PipelineStatus)> PipelineStatusCB; 39 40 // Wrap & return a callback around |cb| which reports its argument to UMA under 41 // the requested |name|. 42 PipelineStatusCB CreateUMAReportingPipelineCB(const std::string& name, 43 const PipelineStatusCB& cb); 44 45 // TODO(scherkus): this should be moved alongside host interface definitions. 46 struct PipelineStatistics { 47 PipelineStatistics() 48 : audio_bytes_decoded(0), 49 video_bytes_decoded(0), 50 video_frames_decoded(0), 51 video_frames_dropped(0) { 52 } 53 54 uint32 audio_bytes_decoded; // Should be uint64? 55 uint32 video_bytes_decoded; // Should be uint64? 56 uint32 video_frames_decoded; 57 uint32 video_frames_dropped; 58 }; 59 60 // Used for updating pipeline statistics. 61 typedef base::Callback<void(const PipelineStatistics&)> StatisticsCB; 62 63 } // namespace media 64 65 #endif // MEDIA_BASE_PIPELINE_STATUS_H_ 66