Commit a5151532 authored by Ken MacKay's avatar Ken MacKay Committed by Commit Bot

[Chromecast] Allow sounds to be played as other content types

Merge-With: eureka-internal/439192

Bug: internal b/162442148
Change-Id: I48246585ffde00158b1aa9ee7a6c403b6668259f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363447Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Kenneth MacKay <kmackay@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800598}
parent 5e6d2106
......@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/time/time.h"
#include "chromecast/public/volume_control.h"
namespace chromecast {
namespace media {
......@@ -43,7 +44,7 @@ class CastSoundsManager {
bool repeat) = 0;
// Plays the sound added for |key|.
virtual void Play(int key) = 0;
virtual void Play(int key, AudioContentType content_type) = 0;
// Stops playing the sound added for |key| if it is currently playing.
virtual void Stop(int key) = 0;
......
......@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/strings/string_piece.h"
#include "chromecast/public/media/media_pipeline_device_params.h"
#include "chromecast/public/volume_control.h"
namespace chromecast {
namespace media {
......@@ -25,7 +26,10 @@ class SoundPlayer {
// |sound_key| so the Stop() function can later identify which sound should be
// stopped. If |repeat| is true, the sound is repeated until Stop() is called
// with the same |sound_key| or another sound is played.
virtual void Play(int sound_key, int resource_id, bool repeat) = 0;
virtual void Play(int sound_key,
int resource_id,
bool repeat,
AudioContentType content_type) = 0;
// Plays the sound using the provided |audio_data|.
// Once played, audio data is registered with a |sound_key| so the Stop()
......@@ -34,14 +38,16 @@ class SoundPlayer {
// |sound_key| or another sound is played.
virtual void PlayAudioData(int sound_key,
scoped_refptr<AudioData> audio_data,
bool repeat) = 0;
bool repeat,
AudioContentType content_type) = 0;
// Plays the sound resource with |resource_id| starting at |timestamp|.
// Any sound that is currently playing is stopped immediately.
// If |audio_channel| is kLeft or kRight, only that channel is played.
virtual void PlayAtTime(int resource_id,
int64_t timestamp,
media::AudioChannel audio_channel) = 0;
media::AudioChannel audio_channel,
AudioContentType content_type) = 0;
// Stops playing the sound resource with |resource_id| if it is currently
// playing.
......
......@@ -21,7 +21,7 @@ class MockCastSoundsManager : public CastSoundsManager {
~MockCastSoundsManager() override;
MOCK_METHOD4(AddSound, void(int, int, bool, bool));
MOCK_METHOD4(AddSoundWithAudioData, void(int, const std::string, bool, bool));
MOCK_METHOD1(Play, void(int));
MOCK_METHOD2(Play, void(int, AudioContentType));
MOCK_METHOD1(Stop, void(int));
void GetDuration(int key, DurationCallback callback) override {
DoGetDuration(key, &callback);
......
......@@ -19,14 +19,14 @@ class MockSoundPlayer : public SoundPlayer {
MockSoundPlayer();
~MockSoundPlayer() override;
MOCK_METHOD(void, Play, (int, int, bool), (override));
MOCK_METHOD(void, Play, (int, int, bool, AudioContentType), (override));
MOCK_METHOD(void,
PlayAudioData,
(int, scoped_refptr<AudioData>, bool),
(int, scoped_refptr<AudioData>, bool, AudioContentType),
(override));
MOCK_METHOD(void,
PlayAtTime,
(int, int64_t, media::AudioChannel),
(int, int64_t, media::AudioChannel, AudioContentType),
(override));
MOCK_METHOD(void, Stop, (int), (override));
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment