{"record":{"id":"b16af10f1560b83d","repo":"TeamNewPipe/NewPipe","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/schabi/newpipe/streams/OggFromWebMWriter.java","lineNumber":185,"sourceCode":"\n        /* step 1: get the amount of frames per seconds */\n        switch (webmTrack.kind) {\n            case Audio:\n                resolution = getSampleFrequencyFromTrack(webmTrack.bMetadata);\n                if (resolution == 0f) {\n                    throw new RuntimeException(\"cannot get the audio sample rate\");\n                }\n                break;\n            case Video:\n                // WARNING: untested\n                if (webmTrack.defaultDuration == 0) {\n                    throw new RuntimeException(\"missing default frame time\");\n                }\n                resolution = 1000f / ((float) webmTrack.defaultDuration\n                        / webmSegment.info.timecodeScale);\n                break;\n            default:\n                throw new RuntimeException(\"not implemented\");\n        }\n\n        /* step 2: create packet with code init data */\n        if (webmTrack.codecPrivate != null) {\n            addPacketSegment(webmTrack.codecPrivate.length);\n            makePacketheader(0x00, header, webmTrack.codecPrivate);\n            write(header);\n            output.write(webmTrack.codecPrivate);\n        }\n\n        /* step 3: create packet with metadata */\n        final byte[] buffer = makeMetadata();\n        if (buffer != null) {\n            addPacketSegment(buffer.length);\n            makePacketheader(0x00, header, buffer);\n            write(header);\n            output.write(buffer);\n        }","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/TeamNewPipe/NewPipe/blob/9e8be091560a69f35d44bd252eb00bc7911c977b/app/src/main/java/org/schabi/newpipe/streams/OggFromWebMWriter.java#L167-L203","documentation":"OggFromWebMWriter switches on webmTrack.kind and only handles Audio and Video. Any other track kind (e.g. Subtitles) falls through to default and throws RuntimeException \"not implemented\". The writer cannot mux non-AV tracks into Ogg.","triggerScenarios":"Selecting/parsing a WebM track whose kind is neither Audio nor Video (e.g. a subtitle or metadata track) and passing it to OggFromWebMWriter. The switch has no case for those kinds.","commonSituations":"Selecting the wrong track index from getAvailableTracks(); a WebM that contains subtitle tracks the caller did not filter out; iterating all tracks without checking kind.","solutions":["Select only an Audio (or Video) track before invoking the writer; filter getAvailableTracks() by kind.","Skip subtitle/metadata tracks entirely — Ogg muxing of them is unsupported.","Validate webmTrack.kind == Audio || webmTrack.kind == Video before constructing the writer."],"exampleFix":"// before — picks whatever track is first (could be subtitles)\nWebMTrack t = reader.getAvailableTracks()[0];\nreader.selectTrack(t);\n\n// after — pick an audio/video track explicitly\nWebMTrack t = Arrays.stream(reader.getAvailableTracks())\n    .filter(x -> x.kind == WebMTrack.Kind.Audio || x.kind == WebMTrack.Kind.Video)\n    .findFirst().orElseThrow(() -> new IOException(\"no AV track\"));\nreader.selectTrack(t);","handlingStrategy":"type-guard","validationCode":"// Select only Audio/Video tracks before invoking the writer.\nWebMTrack t = Arrays.stream(reader.getAvailableTracks())\n    .filter(x -> x.kind == WebMTrack.Kind.Audio || x.kind == WebMTrack.Kind.Video)\n    .findFirst()\n    .orElseThrow(() -> new IOException(\"no Audio/Video track available\"));\nreader.selectTrack(t);","typeGuard":"public static boolean isConvertibleTrack(WebMTrack t) {\n    return t.kind == WebMTrack.Kind.Audio || t.kind == WebMTrack.Kind.Video;\n}","tryCatchPattern":"try {\n    writer.write();\n} catch (RuntimeException e) {\n    if (\"not implemented\".equals(e.getMessage())) {\n        // selected a subtitle/metadata track — re-select an AV track\n        selectAvTrack();\n    } else throw e;\n}","preventionTips":["Always filter getAvailableTracks() by kind==Audio||Video before selection.","Never select a track by raw index without checking its kind.","Document that subtitle/metadata tracks are unsupported by this writer.","Add a unit test that asserts only AV tracks are selected."],"tags":["ogg","webm","track-selection","not-implemented","java"],"backgroundTag":null,"analyzedSha":"9e8be091560a69f35d44bd252eb00bc7911c977b","analyzedAt":"2026-08-14T00:11:33.519Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}