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