Commit 2f3abb9b authored by xhwang@chromium.org's avatar xhwang@chromium.org

Change Deryptor::DecryptStatus and VideoDecoder::DecoderStatus to *::Status.

Previously this was not possible because it conflicts with a macro in x11. This has been fixed by acolwell@. Make this change now to be consistent with DemuxerStream::Status, AudioDecoder::Status, and SourceBufferStream::Status.

BUG=none
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10825194

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150397 0039d316-1c4b-4281-b951-d872f2087c98
parent ffd2c4e9
......@@ -159,7 +159,7 @@ class CaptureVideoDecoderTest : public ::testing::Test {
decoder_->OnBufferReady(vc_impl_.get(), buffer);
}
MOCK_METHOD2(FrameReady, void(media::VideoDecoder::DecoderStatus status,
MOCK_METHOD2(FrameReady, void(media::VideoDecoder::Status status,
const scoped_refptr<media::VideoFrame>&));
// Fixture members.
......
......@@ -220,7 +220,7 @@ class RTCVideoDecoderTest : public testing::Test {
decoder_->RenderFrame(&video_frame);
}
MOCK_METHOD2(FrameReady, void(media::VideoDecoder::DecoderStatus status,
MOCK_METHOD2(FrameReady, void(media::VideoDecoder::Status status,
const scoped_refptr<media::VideoFrame>&));
// Fixture members.
......
......@@ -32,7 +32,7 @@ class MEDIA_EXPORT Decryptor {
kDomainError
};
enum DecryptStatus {
enum Status {
kSuccess, // Decryption successfully completed. Decrypted buffer ready.
kNoKey, // No key is available to decrypt.
kError // Key is available but an error occurred during decryption.
......@@ -73,7 +73,7 @@ class MEDIA_EXPORT Decryptor {
// |encrypted| buffer. In this case the decrypted buffer must be NULL.
// If the returned status is kError, unexpected error has occurred. In this
// case the decrypted buffer must be NULL.
typedef base::Callback<void(DecryptStatus,
typedef base::Callback<void(Status,
const scoped_refptr<DecoderBuffer>&)> DecryptCB;
virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) = 0;
......
......@@ -20,7 +20,7 @@ class MEDIA_EXPORT VideoDecoder
: public base::RefCountedThreadSafe<VideoDecoder> {
public:
// Status codes for read operations on VideoDecoder.
enum DecoderStatus {
enum Status {
kOk, // Everything went as planned.
kDecodeError, // Decoding error happened.
kDecryptError // Decrypting error happened.
......@@ -47,8 +47,7 @@ class MEDIA_EXPORT VideoDecoder
// frames contain decoded video data or may indicate the end of the stream.
// NULL video frames indicate an aborted read. This can happen if the
// DemuxerStream gets flushed and doesn't have any more data to return.
typedef base::Callback<void(DecoderStatus,
const scoped_refptr<VideoFrame>&)> ReadCB;
typedef base::Callback<void(Status, const scoped_refptr<VideoFrame>&)> ReadCB;
virtual void Read(const ReadCB& read_cb) = 0;
// Reset decoder state, fulfilling all pending ReadCB and dropping extra
......
......@@ -274,7 +274,7 @@ class AesDecryptorTest : public testing::Test {
session_id_string_);
}
MOCK_METHOD2(BufferDecrypted, void(Decryptor::DecryptStatus,
MOCK_METHOD2(BufferDecrypted, void(Decryptor::Status,
const scoped_refptr<DecoderBuffer>&));
void DecryptAndExpectToSucceed(const scoped_refptr<DecoderBuffer>& encrypted,
......
......@@ -322,7 +322,7 @@ void FFmpegVideoDecoder::DoDecryptOrDecodeBuffer(
}
if (status != DemuxerStream::kOk) {
DecoderStatus decoder_status =
Status decoder_status =
(status == DemuxerStream::kAborted) ? kOk : kDecodeError;
base::ResetAndReturn(&read_cb_).Run(decoder_status, NULL);
return;
......@@ -340,14 +340,14 @@ void FFmpegVideoDecoder::DoDecryptOrDecodeBuffer(
}
void FFmpegVideoDecoder::BufferDecrypted(
Decryptor::DecryptStatus decrypt_status,
Decryptor::Status decrypt_status,
const scoped_refptr<DecoderBuffer>& buffer) {
message_loop_->PostTask(FROM_HERE, base::Bind(
&FFmpegVideoDecoder::DoBufferDecrypted, this, decrypt_status, buffer));
}
void FFmpegVideoDecoder::DoBufferDecrypted(
Decryptor::DecryptStatus decrypt_status,
Decryptor::Status decrypt_status,
const scoped_refptr<DecoderBuffer>& buffer) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
DCHECK_NE(state_, kUninitialized);
......
......@@ -65,11 +65,11 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
// Callback called by the decryptor to deliver decrypted data buffer and
// reporting decrypt status. This callback could be called synchronously or
// asynchronously.
void BufferDecrypted(Decryptor::DecryptStatus decrypt_status,
void BufferDecrypted(Decryptor::Status decrypt_status,
const scoped_refptr<DecoderBuffer>& buffer);
// Carries out the operation scheduled by BufferDecrypted().
void DoBufferDecrypted(Decryptor::DecryptStatus decrypt_status,
void DoBufferDecrypted(Decryptor::Status decrypt_status,
const scoped_refptr<DecoderBuffer>& buffer);
void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer);
......
......@@ -128,7 +128,7 @@ class FFmpegVideoDecoderTest : public testing::Test {
// Sets up expectations and actions to put FFmpegVideoDecoder in an active
// decoding state.
void EnterDecodingState() {
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
DecodeSingleFrame(i_frame_buffer_, &status, &video_frame);
......@@ -141,7 +141,7 @@ class FFmpegVideoDecoderTest : public testing::Test {
// of stream state.
void EnterEndOfStreamState() {
scoped_refptr<VideoFrame> video_frame;
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
Read(&status, &video_frame);
EXPECT_EQ(status, VideoDecoder::kOk);
ASSERT_TRUE(video_frame);
......@@ -153,7 +153,7 @@ class FFmpegVideoDecoderTest : public testing::Test {
// and multithreaded decoders. End of stream buffers are used to trigger
// the frame to be returned in the multithreaded decoder case.
void DecodeSingleFrame(const scoped_refptr<DecoderBuffer>& buffer,
VideoDecoder::DecoderStatus* status,
VideoDecoder::Status* status,
scoped_refptr<VideoFrame>* video_frame) {
EXPECT_CALL(*demuxer_, Read(_))
.WillOnce(ReturnBuffer(buffer))
......@@ -172,8 +172,8 @@ class FFmpegVideoDecoderTest : public testing::Test {
int expected_height) {
Initialize();
VideoDecoder::DecoderStatus status_a;
VideoDecoder::DecoderStatus status_b;
VideoDecoder::Status status_a;
VideoDecoder::Status status_b;
scoped_refptr<VideoFrame> video_frame_a;
scoped_refptr<VideoFrame> video_frame_b;
......@@ -201,7 +201,7 @@ class FFmpegVideoDecoderTest : public testing::Test {
EXPECT_EQ(expected_height, video_frame_b->data_size().height());
}
void Read(VideoDecoder::DecoderStatus* status,
void Read(VideoDecoder::Status* status,
scoped_refptr<VideoFrame>* video_frame) {
EXPECT_CALL(*this, FrameReady(_, _))
.WillOnce(DoAll(SaveArg<0>(status), SaveArg<1>(video_frame)));
......@@ -211,7 +211,7 @@ class FFmpegVideoDecoderTest : public testing::Test {
message_loop_.RunAllPending();
}
MOCK_METHOD2(FrameReady, void(VideoDecoder::DecoderStatus,
MOCK_METHOD2(FrameReady, void(VideoDecoder::Status,
const scoped_refptr<VideoFrame>&));
MessageLoop message_loop_;
......@@ -329,7 +329,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeFrame_Normal) {
Initialize();
// Simulate decoding a single frame.
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
DecodeSingleFrame(i_frame_buffer_, &status, &video_frame);
......@@ -345,9 +345,9 @@ TEST_F(FFmpegVideoDecoderTest, DecodeFrame_0ByteFrame) {
scoped_refptr<DecoderBuffer> zero_byte_buffer = new DecoderBuffer(0);
VideoDecoder::DecoderStatus status_a;
VideoDecoder::DecoderStatus status_b;
VideoDecoder::DecoderStatus status_c;
VideoDecoder::Status status_a;
VideoDecoder::Status status_b;
VideoDecoder::Status status_c;
scoped_refptr<VideoFrame> video_frame_a;
scoped_refptr<VideoFrame> video_frame_b;
scoped_refptr<VideoFrame> video_frame_c;
......@@ -392,7 +392,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeFrame_DecodeError) {
// Our read should still get satisfied with end of stream frame during an
// error.
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
Read(&status, &video_frame);
EXPECT_EQ(status, VideoDecoder::kDecodeError);
......@@ -409,7 +409,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeFrame_DecodeError) {
TEST_F(FFmpegVideoDecoderTest, DecodeFrame_DecodeErrorAtEndOfStream) {
Initialize();
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
DecodeSingleFrame(corrupt_i_frame_buffer_, &status, &video_frame);
......@@ -449,7 +449,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_Normal) {
EXPECT_CALL(*decryptor_, Decrypt(encrypted_i_frame_buffer_, _))
.WillRepeatedly(RunDecryptCB(Decryptor::kSuccess, i_frame_buffer_));
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
DecodeSingleFrame(encrypted_i_frame_buffer_, &status, &video_frame);
......@@ -471,7 +471,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_DecryptError) {
// Our read should still get satisfied with end of stream frame during an
// error.
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
Read(&status, &video_frame);
EXPECT_EQ(VideoDecoder::kDecryptError, status);
......@@ -493,7 +493,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_NoDecryptionKey) {
// Our read should still get satisfied with end of stream frame during an
// error.
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
Read(&status, &video_frame);
EXPECT_EQ(VideoDecoder::kDecryptError, status);
......@@ -516,7 +516,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_CorruptedBufferReturned) {
// Our read should still get satisfied with end of stream frame during an
// error.
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
Read(&status, &video_frame);
EXPECT_EQ(VideoDecoder::kDecodeError, status);
......@@ -622,7 +622,7 @@ TEST_F(FFmpegVideoDecoderTest, AbortPendingRead) {
EXPECT_CALL(*demuxer_, Read(_))
.WillOnce(ReturnBuffer(scoped_refptr<DecoderBuffer>()));
VideoDecoder::DecoderStatus status;
VideoDecoder::Status status;
scoped_refptr<VideoFrame> video_frame;
Read(&status, &video_frame);
......
......@@ -236,7 +236,7 @@ void GpuVideoDecoder::RequestBufferDecode(
// TODO(acolwell): Add support for reinitializing the decoder when
// |status| == kConfigChanged. For now we just trigger a decode error.
DecoderStatus decoder_status =
Status decoder_status =
(status == DemuxerStream::kAborted) ? kOk : kDecodeError;
gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind(
pending_read_cb_, decoder_status, scoped_refptr<VideoFrame>()));
......
......@@ -382,7 +382,7 @@ VideoRendererBase::~VideoRendererBase() {
DCHECK(state_ == kUninitialized || state_ == kStopped) << state_;
}
void VideoRendererBase::FrameReady(VideoDecoder::DecoderStatus status,
void VideoRendererBase::FrameReady(VideoDecoder::Status status,
const scoped_refptr<VideoFrame>& frame) {
base::AutoLock auto_lock(lock_);
DCHECK_NE(state_, kUninitialized);
......
......@@ -83,7 +83,7 @@ class MEDIA_EXPORT VideoRendererBase
private:
// Callback from the video decoder delivering decoded video frames and
// reporting video decoder status.
void FrameReady(VideoDecoder::DecoderStatus status,
void FrameReady(VideoDecoder::Status status,
const scoped_refptr<VideoFrame>& frame);
// Helper method for adding a frame to |ready_frames_|
......
......@@ -243,7 +243,7 @@ void ProxyDecryptor::OnBufferDecrypted(
const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy,
const scoped_refptr<media::DecoderBuffer>& encrypted,
const media::Decryptor::DecryptCB& decrypt_cb,
media::Decryptor::DecryptStatus status,
media::Decryptor::Status status,
const scoped_refptr<media::DecoderBuffer>& decrypted) {
if (status == media::Decryptor::kSuccess ||
status == media::Decryptor::kError) {
......
......@@ -75,7 +75,7 @@ class ProxyDecryptor : public media::Decryptor {
const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy,
const scoped_refptr<media::DecoderBuffer>& encrypted,
const media::Decryptor::DecryptCB& decrypt_cb,
media::Decryptor::DecryptStatus status,
media::Decryptor::Status status,
const scoped_refptr<media::DecoderBuffer>& decrypted);
media::DecryptorClient* client_;
......
......@@ -97,7 +97,7 @@ class ProxyDecryptorTest : public testing::Test {
kFakeSessionId);
}
MOCK_METHOD2(BufferDecrypted, void(Decryptor::DecryptStatus,
MOCK_METHOD2(BufferDecrypted, void(Decryptor::Status,
const scoped_refptr<DecoderBuffer>&));
protected:
......
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