mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 905513 - Don't clobber audio VideoInfo fields when accepting video configuration. r=doublec
This commit is contained in:
parent
e5ba858708
commit
b64f0348e3
@ -38,7 +38,7 @@ public:
|
||||
|
||||
bool OnDecodeThread() const MOZ_OVERRIDE;
|
||||
|
||||
MediaResource* GetResource() const MOZ_FINAL MOZ_OVERRIDE;
|
||||
MediaResource* GetResource() const MOZ_OVERRIDE;
|
||||
|
||||
void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
MediaDecoderOwner* GetOwner() MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
protected:
|
||||
// This monitor object is not really used to synchronize access to anything.
|
||||
// It's just there in order for us to be able to override
|
||||
// GetReentrantMonitor correctly.
|
||||
|
@ -35,7 +35,7 @@ class TimeRanges;
|
||||
class MediaSourceReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
MediaSourceReader(AbstractMediaDecoder* aDecoder)
|
||||
MediaSourceReader(MediaSourceDecoder* aDecoder)
|
||||
: MediaDecoderReader(aDecoder)
|
||||
{
|
||||
}
|
||||
@ -184,8 +184,6 @@ MediaSourceReader::ReadMetadata(VideoInfo* aInfo, MetadataTags** aTags)
|
||||
|
||||
MediaSourceDecoder* decoder = static_cast<MediaSourceDecoder*>(mDecoder);
|
||||
const nsTArray<MediaDecoderReader*>& readers = decoder->GetReaders();
|
||||
bool gotVideo = false;
|
||||
bool gotAudio = false;
|
||||
for (uint32_t i = 0; i < readers.Length(); ++i) {
|
||||
MediaDecoderReader* reader = readers[i];
|
||||
VideoInfo vi;
|
||||
@ -194,17 +192,17 @@ MediaSourceReader::ReadMetadata(VideoInfo* aInfo, MetadataTags** aTags)
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (vi.mHasVideo && !gotVideo) {
|
||||
mInfo = vi;
|
||||
if (vi.mHasVideo && !mInfo.mHasVideo) {
|
||||
mInfo.mDisplay = vi.mDisplay;
|
||||
mInfo.mStereoMode = vi.mStereoMode;
|
||||
mInfo.mHasVideo = true;
|
||||
decoder->SetVideoReader(reader);
|
||||
gotVideo = true;
|
||||
}
|
||||
if (vi.mHasAudio && !gotAudio) {
|
||||
if (vi.mHasAudio && !mInfo.mHasAudio) {
|
||||
mInfo.mAudioRate = vi.mAudioRate;
|
||||
mInfo.mAudioChannels = vi.mAudioChannels;
|
||||
mInfo.mHasAudio = true;
|
||||
decoder->SetAudioReader(reader);
|
||||
gotAudio = true;
|
||||
}
|
||||
}
|
||||
*aInfo = mInfo;
|
||||
|
@ -60,6 +60,12 @@ SubBufferDecoder::OnDecodeThread() const
|
||||
return mParentDecoder->OnDecodeThread();
|
||||
}
|
||||
|
||||
SourceBufferResource*
|
||||
SubBufferDecoder::GetResource() const
|
||||
{
|
||||
return static_cast<SourceBufferResource*>(mResource.get());
|
||||
}
|
||||
|
||||
void
|
||||
SubBufferDecoder::SetMediaDuration(int64_t aDuration)
|
||||
{
|
||||
@ -226,7 +232,7 @@ SourceBuffer::Detach()
|
||||
void
|
||||
SourceBuffer::Ended()
|
||||
{
|
||||
static_cast<SourceBufferResource*>(mDecoder->GetResource())->Ended();
|
||||
mDecoder->GetResource()->Ended();
|
||||
}
|
||||
|
||||
SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
|
||||
@ -247,7 +253,7 @@ SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
|
||||
SourceBuffer::~SourceBuffer()
|
||||
{
|
||||
if (mDecoder) {
|
||||
static_cast<SourceBufferResource*>(mDecoder->GetResource())->Ended();
|
||||
mDecoder->GetResource()->Ended();
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,9 +327,9 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
|
||||
// XXX: For future reference: NDA call must run on the main thread.
|
||||
mDecoder->NotifyDataArrived(reinterpret_cast<const char*>(aData),
|
||||
aLength,
|
||||
static_cast<SourceBufferResource*>(mDecoder->GetResource())->GetLength());
|
||||
mDecoder->GetResource()->GetLength());
|
||||
// TODO: Run buffer append algorithm asynchronously (would call StopUpdating()).
|
||||
static_cast<SourceBufferResource*>(mDecoder->GetResource())->AppendData(aData, aLength);
|
||||
mDecoder->GetResource()->AppendData(aData, aLength);
|
||||
StopUpdating();
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define MOZILLA_SUBBUFFERDECODER_H_
|
||||
|
||||
#include "BufferDecoder.h"
|
||||
#include "SourceBufferResource.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -32,6 +33,7 @@ public:
|
||||
ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;
|
||||
bool OnStateMachineThread() const MOZ_OVERRIDE;
|
||||
bool OnDecodeThread() const MOZ_OVERRIDE;
|
||||
SourceBufferResource* GetResource() const MOZ_OVERRIDE;
|
||||
void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
|
||||
void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
|
||||
void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user