Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
| 6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 8 namespace chromecast { | 10 namespace chromecast { |
| 9 class TaskRunner; | 11 class TaskRunner; |
| 10 | 12 |
| 11 namespace media { | 13 namespace media { |
| 12 | 14 |
| 15 enum class AudioContentType; | |
| 16 | |
| 13 // Supplies creation parameters to platform-specific pipeline backend. | 17 // Supplies creation parameters to platform-specific pipeline backend. |
| 14 struct MediaPipelineDeviceParams { | 18 struct MediaPipelineDeviceParams { |
| 15 enum MediaSyncType { | 19 enum MediaSyncType { |
| 16 // Default operation, synchronize playback using PTS with higher latency. | 20 // Default operation, synchronize playback using PTS with higher latency. |
| 17 kModeSyncPts = 0, | 21 kModeSyncPts = 0, |
| 18 // With this mode, synchronization is disabled and audio/video frames are | 22 // With this mode, synchronization is disabled and audio/video frames are |
| 19 // rendered "right away": | 23 // rendered "right away": |
| 20 // - for audio, frames are still rendered based on the sampling frequency | 24 // - for audio, frames are still rendered based on the sampling frequency |
| 21 // - for video, frames are rendered as soon as available at the output of | 25 // - for video, frames are rendered as soon as available at the output of |
| 22 // the video decoder. | 26 // the video decoder. |
| 23 // The assumption is that no B frames are used when synchronization is | 27 // The assumption is that no B frames are used when synchronization is |
| 24 // disabled, otherwise B frames would always be skipped. | 28 // disabled, otherwise B frames would always be skipped. |
| 25 kModeIgnorePts = 1, | 29 kModeIgnorePts = 1, |
| 26 // In addition to the constraints above, also do not wait for vsync. | 30 // In addition to the constraints above, also do not wait for vsync. |
| 27 kModeIgnorePtsAndVSync = 2, | 31 kModeIgnorePtsAndVSync = 2, |
| 28 }; | 32 }; |
| 29 | 33 |
| 30 enum AudioStreamType { | 34 enum AudioStreamType { |
| 31 // "Real" audio stream. If this stream underruns, all audio output may pause | 35 // "Real" audio stream. If this stream underruns, all audio output may pause |
| 32 // until more real stream data is available. | 36 // until more real stream data is available. |
| 33 kAudioStreamNormal = 0, | 37 kAudioStreamNormal = 0, |
| 34 // Sound-effects audio stream. May be interrupted if a real audio stream | 38 // Sound-effects audio stream. May be interrupted if a real audio stream |
| 35 // is created with a different sample rate. Underruns on an effects stream | 39 // is created with a different sample rate. Underruns on an effects stream |
| 36 // do not affect output of real audio streams. | 40 // do not affect output of real audio streams. |
| 37 kAudioStreamSoundEffects = 1, | 41 kAudioStreamSoundEffects = 1, |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 MediaPipelineDeviceParams(TaskRunner* task_runner_in) | 44 MediaPipelineDeviceParams(TaskRunner* task_runner_in, |
| 45 AudioContentType content_type_in, | |
| 46 const std::string& device_id_in) | |
|
alokp
2017/02/24 17:34:26
Do we need both - content_type and device_id?
kmackay
2017/02/24 19:01:06
Ben is planning to use device_id in the short term
| |
| 41 : sync_type(kModeSyncPts), | 47 : sync_type(kModeSyncPts), |
| 42 audio_type(kAudioStreamNormal), | 48 audio_type(kAudioStreamNormal), |
| 43 task_runner(task_runner_in) {} | 49 task_runner(task_runner_in), |
| 50 content_type(content_type_in), | |
| 51 device_id(device_id_in) {} | |
| 44 | 52 |
| 45 MediaPipelineDeviceParams(MediaSyncType sync_type_in, | 53 MediaPipelineDeviceParams(MediaSyncType sync_type_in, |
| 46 TaskRunner* task_runner_in) | 54 TaskRunner* task_runner_in, |
| 55 AudioContentType content_type_in, | |
| 56 const std::string& device_id_in) | |
| 47 : sync_type(sync_type_in), | 57 : sync_type(sync_type_in), |
| 48 audio_type(kAudioStreamNormal), | 58 audio_type(kAudioStreamNormal), |
| 49 task_runner(task_runner_in) {} | 59 task_runner(task_runner_in), |
| 60 content_type(content_type_in), | |
| 61 device_id(device_id_in) {} | |
| 50 | 62 |
| 51 MediaPipelineDeviceParams(MediaSyncType sync_type_in, | 63 MediaPipelineDeviceParams(MediaSyncType sync_type_in, |
| 52 AudioStreamType audio_type_in, | 64 AudioStreamType audio_type_in, |
| 53 TaskRunner* task_runner_in) | 65 TaskRunner* task_runner_in, |
| 66 AudioContentType content_type_in, | |
| 67 const std::string& device_id_in) | |
| 54 : sync_type(sync_type_in), | 68 : sync_type(sync_type_in), |
| 55 audio_type(audio_type_in), | 69 audio_type(audio_type_in), |
| 56 task_runner(task_runner_in) {} | 70 task_runner(task_runner_in), |
| 71 content_type(content_type_in), | |
| 72 device_id(device_id_in) {} | |
| 57 | 73 |
| 58 const MediaSyncType sync_type; | 74 const MediaSyncType sync_type; |
| 59 const AudioStreamType audio_type; | 75 const AudioStreamType audio_type; |
| 60 | 76 |
| 61 // task_runner allows backend implementations to post tasks to the media | 77 // task_runner allows backend implementations to post tasks to the media |
| 62 // thread. Since all calls from cast_shell into the backend are made on | 78 // thread. Since all calls from cast_shell into the backend are made on |
| 63 // the media thread, this may simplify thread management and safety for | 79 // the media thread, this may simplify thread management and safety for |
| 64 // some backends. | 80 // some backends. |
| 65 TaskRunner* const task_runner; | 81 TaskRunner* const task_runner; |
| 82 | |
| 83 const AudioContentType content_type; | |
| 84 const std::string device_id; | |
| 66 }; | 85 }; |
| 67 | 86 |
| 68 } // namespace media | 87 } // namespace media |
| 69 } // namespace chromecast | 88 } // namespace chromecast |
| 70 | 89 |
| 71 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_PARAMS_H_ | 90 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_PIPELINE_DEVICE_PARAMS_H_ |
| OLD | NEW |