Bug 1343437 - MediaDataDemuxer::InitPromise resolve-value is now a MediaResult - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Tue, 28 Feb 2017 16:24:57 +1100
changeset 560821 bad4713ab14340a7227ca7fbddb4668966807320
parent 560820 cd683386d8566a20868ea84a377b513782dfc48b
child 560822 cd9b965cf3ccd98cfc376ba4b1b8b787a41eab02
push id53551
push usergsquelart@mozilla.com
push dateTue, 11 Apr 2017 23:47:44 +0000
reviewersjya
bugs1343437
milestone55.0a1
Bug 1343437 - MediaDataDemuxer::InitPromise resolve-value is now a MediaResult - r?jya In case of successful initialization, there could still be some warning about a recoverable error. To carry more information about this potential warning, the resolve-value type of the promise is changed from nsresult to MediaResult. Existing code doesn't need to be changed: - In Resolve() calls, the stored MediaResult can implicitly be constructed from an nsresult -- always NS_OK at the moment anyway. - In following Then(), the promise's MediaResult can implicitly be converted to an nsresult. Future patches will modify some of the Resolve's and Then's, to forward warning details to some Decoder Doctor object... MozReview-Commit-ID: J0bXDFxXQHQ
dom/media/MediaDataDemuxer.h
--- a/dom/media/MediaDataDemuxer.h
+++ b/dom/media/MediaDataDemuxer.h
@@ -27,17 +27,18 @@ class TrackMetadataHolder;
 // MediaDataDemuxer isn't designed to be thread safe.
 // When used by the MediaFormatDecoder, care is taken to ensure that the demuxer
 // will never be called from more than one thread at once.
 class MediaDataDemuxer
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDemuxer)
 
-  typedef MozPromise<nsresult, MediaResult, /* IsExclusive = */ true> InitPromise;
+  typedef
+    MozPromise<MediaResult, MediaResult, /* IsExclusive = */ true> InitPromise;
 
   // Initializes the demuxer. Other methods cannot be called unless
   // initialization has completed and succeeded.
   // Typically a demuxer will wait to parse the metadata before resolving the
   // promise. The promise must not be resolved until sufficient data is
   // supplied. For example, an incomplete metadata would cause the promise to be
   // rejected should no more data be coming, while the demuxer would wait
   // otherwise.