Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(logs): Add extra logging for 3015 errors #4932

Merged
merged 2 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,8 @@ shaka.media.MediaSourceEngine = class {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
exception);
exception,
this.video_.error || 'No error in the media element');
} finally {
// Unblock the queues.
for (const contentType in this.sourceBuffers_) {
Expand Down Expand Up @@ -1308,7 +1309,8 @@ shaka.media.MediaSourceEngine = class {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
exception));
exception,
this.video_.error || 'No error in the media element'));
}
this.popFromQueue_(contentType);
}
Expand Down
1 change: 1 addition & 0 deletions lib/util/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ shaka.util.Error.Code = {
/**
* A MediaSource operation threw an exception.
* <br> error.data[0] is the exception that was thrown.
* <br> error.data[1] is the error object from the video element.
*/
'MEDIA_SOURCE_OPERATION_THREW': 3015,

Expand Down
8 changes: 5 additions & 3 deletions test/media/media_source_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,13 @@ describe('MediaSourceEngine', () => {

it('rejects promise when operation throws', async () => {
audioSourceBuffer.appendBuffer.and.throwError('fail!');
mockVideo.error = {code: 5};
mockVideo.error = {code: 5, message: 'something failed'};
const expected = Util.jasmineError(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
jasmine.objectContaining({message: 'fail!'})));
jasmine.objectContaining({message: 'fail!'}),
{code: 5, message: 'something failed'}));
await expectAsync(
mediaSourceEngine.appendBuffer(
ContentType.AUDIO, buffer, null,
Expand Down Expand Up @@ -712,7 +713,8 @@ describe('MediaSourceEngine', () => {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MEDIA,
shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
jasmine.objectContaining({message: 'fail!'})));
jasmine.objectContaining({message: 'fail!'}),
{code: 5}));
await expectAsync(mediaSourceEngine.remove(ContentType.AUDIO, 1, 5))
.toBeRejectedWith(expected);
expect(audioSourceBuffer.remove).toHaveBeenCalledWith(1, 5);
Expand Down